Audacity 3.2.0
Overlay.cpp
Go to the documentation of this file.
1//
2// Overlay.cpp
3// Audacity
4//
5// Created by Paul Licameli on 5/7/16.
6//
7//
8
9#include "Overlay.h"
10
11#include <wx/dc.h>
12
14{
15}
16
17std::pair<wxRect, bool> Overlay::GetRectangle(wxSize size)
18{
19 auto result = DoGetRectangle(size);
20#ifdef __WXMAC__
21 // On OSX, if a HiDPI resolution is being used, a vertical line will actually take up
22 // more than 1 pixel (even though it is drawn as 1), so we restore the surrounding
23 // pixels as well. (This is because the wxClientDC doesn't know about the scaling.
24 result.first.Inflate(1, 0);
25#endif
26 return result;
27}
28
29void Overlay::Erase(wxDC &dc, wxDC &src)
30{
31 wxRect rect(dc.GetSize());
32 rect.Intersect(src.GetSize());
33 auto smallRect(GetRectangle(src.GetSize()).first);
34 rect.Intersect(smallRect);
35 if (!rect.IsEmpty())
36 dc.Blit(rect.x, rect.y, rect.width, rect.height,
37 &src, rect.x, rect.y);
38}
std::pair< wxRect, bool > GetRectangle(wxSize size)
Definition: Overlay.cpp:17
virtual std::pair< wxRect, bool > DoGetRectangle(wxSize size)=0
virtual void Erase(wxDC &dc, wxDC &src)
Definition: Overlay.cpp:29
virtual ~Overlay()=0
Definition: Overlay.cpp:13