summaryrefslogtreecommitdiff
path: root/wx+
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2021-04-05 11:02:07 -0400
committerB Stack <bgstack15@gmail.com>2021-04-05 11:02:07 -0400
commit74361d859354e4416285cd803b1b0075be1fe514 (patch)
treedafb5e266c513a5ed9863401e62d246742861e0c /wx+
parentMerge branch '11.7' into 'master' (diff)
downloadFreeFileSync-74361d859354e4416285cd803b1b0075be1fe514.tar.gz
FreeFileSync-74361d859354e4416285cd803b1b0075be1fe514.tar.bz2
FreeFileSync-74361d859354e4416285cd803b1b0075be1fe514.zip
add upstream 11.9
Diffstat (limited to 'wx+')
-rw-r--r--wx+/dc.h18
-rw-r--r--wx+/grid.cpp16
-rw-r--r--wx+/image_tools.cpp4
3 files changed, 26 insertions, 12 deletions
diff --git a/wx+/dc.h b/wx+/dc.h
index 6769b779..e12c04e3 100644
--- a/wx+/dc.h
+++ b/wx+/dc.h
@@ -64,9 +64,10 @@ void drawFilledRectangle(wxDC& dc, wxRect rect, int borderWidth, const wxColor&
/* Standard DPI:
Windows/Ubuntu: 96 x 96
macOS: wxWidgets uses DIP (note: wxScreenDC().GetPPI() returns 72 x 72 which is a lie; looks like 96 x 96) */
+constexpr int defaultDpi = 96;
inline
-int fastFromDIP(int d) //like wxWindow::FromDIP (but tied to primary monitor and buffered)
+int getDPI()
{
#ifndef wxHAVE_DPI_INDEPENDENT_PIXELS
#error why is wxHAVE_DPI_INDEPENDENT_PIXELS not defined?
@@ -75,11 +76,24 @@ int fastFromDIP(int d) //like wxWindow::FromDIP (but tied to primary monitor and
//=> requires general fix at wxWidgets-level
//https://github.com/wxWidgets/wxWidgets/blob/d9d05c2bb201078f5e762c42458ca2f74af5b322/include/wx/window.h#L2060
- return d; //e.g. macOS, GTK3
+ return defaultDpi; //e.g. macOS, GTK3
+}
+
+
+inline
+int fastFromDIP(int d) //like wxWindow::FromDIP (but tied to primary monitor and buffered)
+{
+ return numeric::intDivRound(d * getDPI() - 10 /*round values like 1.5 down => 1 pixel on 150% scale*/, defaultDpi);
}
int fastFromDIP(double d) = delete;
+inline
+int getDpiScalePercent()
+{
+ return numeric::intDivRound(100 * getDPI(), defaultDpi);
+}
+
//---------------------- implementation ------------------------
class RecursiveDcClipper
diff --git a/wx+/grid.cpp b/wx+/grid.cpp
index 0111ccf7..ab9babbb 100644
--- a/wx+/grid.cpp
+++ b/wx+/grid.cpp
@@ -2003,24 +2003,24 @@ std::vector<Grid::ColAttributes> Grid::getColumnConfig() const
//get non-visible columns (+ outdated visible ones)
std::vector<ColAttributes> output = oldColAttributes_;
- auto iterVcols = visibleCols_.begin();
- auto iterVcolsend = visibleCols_.end();
+ auto itVcols = visibleCols_.begin();
+ auto itVcolsend = visibleCols_.end();
//update visible columns but keep order of non-visible ones!
for (ColAttributes& ca : output)
if (ca.visible)
{
- if (iterVcols != iterVcolsend)
+ if (itVcols != itVcolsend)
{
- ca.type = iterVcols->type;
- ca.stretch = iterVcols->stretch;
- ca.offset = iterVcols->offset;
- ++iterVcols;
+ ca.type = itVcols->type;
+ ca.stretch = itVcols->stretch;
+ ca.offset = itVcols->offset;
+ ++itVcols;
}
else
assert(false);
}
- assert(iterVcols == iterVcolsend);
+ assert(itVcols == itVcolsend);
return output;
}
diff --git a/wx+/image_tools.cpp b/wx+/image_tools.cpp
index bbc8cee7..b95a7369 100644
--- a/wx+/image_tools.cpp
+++ b/wx+/image_tools.cpp
@@ -334,8 +334,8 @@ wxImage zen::bilinearScale(const wxImage& img, int width, int height)
const auto imgWriter = [rgb = imgOut.GetData(), alpha = imgOut.GetAlpha()](const xbrz::BytePixel& pix) mutable
{
const unsigned char a = pix[0];
- * alpha++ = a;
- * rgb++ = xbrz::demultiply(pix[1], a); //r
+ *alpha++ = a;
+ *rgb++ = xbrz::demultiply(pix[1], a); //r
*rgb++ = xbrz::demultiply(pix[2], a); //g
*rgb++ = xbrz::demultiply(pix[3], a); //b
};
bgstack15