summaryrefslogtreecommitdiff
path: root/wx+/image_tools.cpp
diff options
context:
space:
mode:
authorB. Stack <bgstack15@gmail.com>2023-11-27 10:33:00 -0500
committerB. Stack <bgstack15@gmail.com>2023-11-27 10:33:00 -0500
commit2e61b9b6258f29c03cb3b0da48282f3a87590702 (patch)
tree2be66dfaf965d246ea2df6248c7890208887e6bb /wx+/image_tools.cpp
parentadd upstream 13.1 (diff)
downloadFreeFileSync-2e61b9b6258f29c03cb3b0da48282f3a87590702.tar.gz
FreeFileSync-2e61b9b6258f29c03cb3b0da48282f3a87590702.tar.bz2
FreeFileSync-2e61b9b6258f29c03cb3b0da48282f3a87590702.zip
add upstream 13.213.2
Diffstat (limited to 'wx+/image_tools.cpp')
-rw-r--r--wx+/image_tools.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/wx+/image_tools.cpp b/wx+/image_tools.cpp
index b054ad78..e95797ca 100644
--- a/wx+/image_tools.cpp
+++ b/wx+/image_tools.cpp
@@ -168,7 +168,7 @@ wxImage zen::stackImages(const wxImage& img1, const wxImage& img2, ImageStackLay
wxImage zen::createImageFromText(const wxString& text, const wxFont& font, const wxColor& col, ImageStackAlignment textAlign)
{
wxMemoryDC dc; //the context used for bitmaps
- setScaleFactor(dc, getDisplayScaleFactor());
+ setScaleFactor(dc, getScreenDpiScale());
dc.SetFont(font); //the font parameter of GetTextExtent() is not evaluated on OS X, wxWidgets 2.9.5, so apply it to the DC directly!
std::vector<std::pair<wxString, wxSize>> lineInfo; //text + extent
@@ -186,8 +186,9 @@ wxImage zen::createImageFromText(const wxString& text, const wxFont& font, const
if (maxWidth == 0 || lineHeight == 0)
return wxNullImage;
- wxBitmap newBitmap(maxWidth, lineHeight * lineInfo.size()); //seems we don't need to pass 24-bit depth here even for high-contrast color schemes
- newBitmap.SetScaleFactor(getDisplayScaleFactor());
+ wxBitmap newBitmap(wxsizeToScreen(maxWidth),
+ wxsizeToScreen(static_cast<int>(lineHeight * lineInfo.size()))); //seems we don't need to pass 24-bit depth here even for high-contrast color schemes
+ newBitmap.SetScaleFactor(getScreenDpiScale());
{
dc.SelectObject(newBitmap); //copies scale factor from wxBitmap
ZEN_ON_SCOPE_EXIT(dc.SelectObject(wxNullBitmap));
@@ -377,10 +378,10 @@ void zen::convertToVanillaImage(wxImage& img)
const int height = img.GetHeight();
if (width <= 0 || height <= 0) return;
- unsigned char mask_r = 0;
- unsigned char mask_g = 0;
- unsigned char mask_b = 0;
- const bool haveMask = img.HasMask() && img.GetOrFindMaskColour(&mask_r, &mask_g, &mask_b);
+ unsigned char maskR = 0;
+ unsigned char maskG = 0;
+ unsigned char maskB = 0;
+ const bool haveMask = img.HasMask() && img.GetOrFindMaskColour(&maskR, &maskG, &maskB);
//check for mask before calling wxImage::GetOrFindMaskColour() to skip needlessly searching for new mask color
img.SetAlpha();
@@ -402,9 +403,9 @@ void zen::convertToVanillaImage(wxImage& img)
const unsigned char g = *rgb++;
const unsigned char b = *rgb++;
- if (r == mask_r &&
- g == mask_g &&
- b == mask_b)
+ if (r == maskR &&
+ g == maskG &&
+ b == maskB)
alpha[i] = wxIMAGE_ALPHA_TRANSPARENT;
}
}
bgstack15