wxMSW: A better (IMHO) RTL fixes for wx{Auto}BufferedDC (PR #26398)

19 views
Skip to first unread message

AliKet

unread,
Apr 19, 2026, 8:51:03 PM (4 days ago) Apr 19
to wx-...@googlegroups.com, Subscribed

Also fix custom drawing where wxDC::DeviceToLogical() and related functions need to be used.


You can view, comment on, or merge this pull request online at:

  https://github.com/wxWidgets/wxWidgets/pull/26398

Commit Summary

  • 2e0d08c wxDC::LogicalToDevice{Rel}() now always return unmirrored coordinates under wxMSW
  • 5827b4c Remove unnecessary hack from wxMSWDCImpl::DoSetClippingRegion()
  • ada3d84 Really fix using wx{Auto}BufferedDC in RTL layout under wxMSW
  • af13c88 Fix rendering GridFrame (from griddemo) in RTL layout
  • dadf3ab Update OneDevRegionRTL test after recent changes

File Changes

(3 files)

Patch Links:


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26398@github.com>

AliKet

unread,
Apr 19, 2026, 9:08:20 PM (4 days ago) Apr 19
to wx-...@googlegroups.com, Push

@AliKet pushed 1 commit.

  • da9c92e Try to fix OneDevRegionRTL test failures


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26398/before/dadf3abdbdd31adb1fd1a8d02cdc4cda91fcc3d1/after/da9c92e042f90405ddba3e80e9f4c2e8c1a6ef1b@github.com>

AliKet

unread,
Apr 19, 2026, 9:31:50 PM (4 days ago) Apr 19
to wx-...@googlegroups.com, Subscribed
AliKet left a comment (wxWidgets/wxWidgets#26398)

I don't have a real explanation of why we need this commit da9c92e to fix tests failures in OneDevRegionRTL, Just some weired rounding errors? I'm guessing...


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26398/c4277339869@github.com>

AliKet

unread,
Apr 19, 2026, 9:49:20 PM (4 days ago) Apr 19
to wx-...@googlegroups.com, Subscribed
AliKet left a comment (wxWidgets/wxWidgets#26398)

Micro-optimisation:

diff --git a/src/msw/dc.cpp b/src/msw/dc.cpp
index dc56fa3e53..dda510a168 100644
--- a/src/msw/dc.cpp
+++ b/src/msw/dc.cpp
@@ -2379,10 +2379,12 @@ bool wxMSWDCImpl::DoStretchBlit(wxCoord xdest, wxCoord ydest,
                 // automatically as it doesn't even work with the source HDC.
                 // So do this manually to ensure that the coordinates are
                 // interpreted in the same way here as in all the other cases.
-                xsrc = source->LogicalToDeviceX(xsrcOrig);
-                ysrc = source->LogicalToDeviceY(ysrcOrig);
-                srcWidth = source->LogicalToDeviceXRel(srcWidth);
-                srcHeight = source->LogicalToDeviceYRel(srcHeight);
+                const auto devPos = implSrc->LogicalToDevice(xsrcOrig, ysrcOrig);
+                const auto devSize = implSrc->LogicalToDeviceRel(srcWidth, srcHeight);
+                xsrc = devPos.x;
+                ysrc = devPos.y;
+                srcWidth = devSize.x;
+                srcHeight = devSize.y;
 
                 // Figure out what co-ordinate system we're supposed to specify
                 // ysrc in.

LogicalToDevice{X,Y}[Rel]() now internally call SetLayout() to force LTR before calling LPtoDP() as a pre-condition and restore the old layout when the function returns as a post-condition. So there will be 8 calls to SetLayout() with the old code, but 4 with the patch above. I didn't try to profile this to see whether the patch makes any difference, but I still prefer to apply it, though.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26398/c4277383706@github.com>

AliKet

unread,
Apr 19, 2026, 9:54:39 PM (4 days ago) Apr 19
to wx-...@googlegroups.com, Subscribed
AliKet left a comment (wxWidgets/wxWidgets#26398)

@vslavik I would be grateful if you could test this and see whether it breaks something I’m not aware of. Thanks in advance!


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/pull/26398/c4277396612@github.com>

Reply all
Reply to author
Forward
0 new messages