forked from audacity/audacity
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOverlay.cpp
More file actions
38 lines (33 loc) · 896 Bytes
/
Copy pathOverlay.cpp
File metadata and controls
38 lines (33 loc) · 896 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//
// Overlay.cpp
// Audacity
//
// Created by Paul Licameli on 5/7/16.
//
//
#include "Overlay.h"
#include <wx/dc.h>
Overlay::~Overlay()
{
}
std::pair<wxRect, bool> Overlay::GetRectangle(wxSize size)
{
auto result = DoGetRectangle(size);
#ifdef __WXMAC__
// On OSX, if a HiDPI resolution is being used, a vertical line will actually take up
// more than 1 pixel (even though it is drawn as 1), so we restore the surrounding
// pixels as well. (This is because the wxClientDC doesn't know about the scaling.
result.first.Inflate(1, 0);
#endif
return result;
}
void Overlay::Erase(wxDC &dc, wxDC &src)
{
wxRect rect(dc.GetSize());
rect.Intersect(src.GetSize());
auto smallRect(GetRectangle(src.GetSize()).first);
rect.Intersect(smallRect);
if (!rect.IsEmpty())
dc.Blit(rect.x, rect.y, rect.width, rect.height,
&src, rect.x, rect.y);
}