Bug in drawing demo? (Issue #25845)

41 views
Skip to first unread message

AliKet

unread,
Sep 30, 2025, 10:24:27 AMSep 30
to wx-...@googlegroups.com, Subscribed
AliKet created an issue (wxWidgets/wxWidgets#25845)

Description

I noticed that in the Regions screen F8 of the drawing sample the regions created using SetDeviceClippingRegion() never update when they are scrolled out and than scrolled in to view.

I haven't investigated the issue in-depth, so I don't know what's going on here.

Before scrolling:

drawing.png (view on web)

After scrolling:

drawing_bug.png (view on web)

Platform and version information

  • wxWidgets version you use: master
  • wxWidgets port you use: wxMSW
  • OS and its version: Windows 10


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/issues/25845@github.com>

VZ

unread,
Sep 30, 2025, 10:29:01 AMSep 30
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25845)

To be honest, I never understood what was this demonstrating, so I'm going to have trouble fixing it. This code was originally added in bc3cedf ( Added test for region clipping. Corrected makefile., 2000-03-02) by @RobertRoeb but I doubt even he remembers what was this supposed to be about...

Maybe we should just remove this?


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/issues/25845/3352484873@github.com>

AliKet

unread,
Sep 30, 2025, 4:38:04 PMSep 30
to wx-...@googlegroups.com, Subscribed
AliKet left a comment (wxWidgets/wxWidgets#25845)

I forgot to mention that the problem is only with the GDI backend, not with GDI+ nor Direct2D.


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/issues/25845/3353724289@github.com>

VZ

unread,
Sep 30, 2025, 4:41:36 PMSep 30
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25845)

Ugh, if there is difference between wxDC and wxGC behaviour, there is definitely a bug which needs to be debugged, thanks for mentioning this.


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/issues/25845/3353737230@github.com>

AliKet

unread,
Sep 30, 2025, 4:57:12 PMSep 30
to wx-...@googlegroups.com, Subscribed
AliKet left a comment (wxWidgets/wxWidgets#25845)
diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp
index 532965c494..11d9c0c685 100644
--- a/samples/drawing/drawing.cpp
+++ b/samples/drawing/drawing.cpp
@@ -639,6 +639,8 @@ MyCanvas::MyCanvas(MyFrame *parent)
     m_showBBox = false;
     m_sizeDIP = wxSize(0, 0);

+    SetDoubleBuffered(true);
+
     auto cursorBitmaps = wxBitmapBundle::FromBitmaps(wxBitmap(cursor_xpm),
                                                      wxBitmap(cursor_2x_xpm));
     m_customCursor = wxCursorBundle(cursorBitmaps, wxPoint(4, 4));

The patch above fixes the problem for me. but then, there is still a difference between drawing backends:

1- With GDI+ and Direct2D: All regions scroll with the canvas as you scroll it.
2- With GDI: The grey regions don't scroll with the canvas.

and I don't know which behaviour is correct: 1 or 2 ?


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/issues/25845/3353780411@github.com>

RobertRoeb

unread,
Oct 1, 2025, 3:13:45 AMOct 1
to wx-...@googlegroups.com, Subscribed
RobertRoeb left a comment (wxWidgets/wxWidgets#25845)

To be honest, I never understood what was this demonstrating, so I'm going to have trouble fixing it. This code was originally added in bc3cedf ( Added test for region clipping. Corrected makefile., 2000-03-02) by @RobertRoeb but I doubt even he remembers what was this supposed to be about...

Maybe we should just remove this?

I added it in 2000 to discover subtle differences in region clipping code in 2025. I remember that very precisely.


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/issues/25845/3355041398@github.com>

RobertRoeb

unread,
Oct 1, 2025, 3:16:09 AMOct 1
to wx-...@googlegroups.com, Subscribed
RobertRoeb left a comment (wxWidgets/wxWidgets#25845)

there is still a difference between drawing backends:

1- With GDI+ and Direct2D: All regions scroll with the canvas as you scroll it. 2- With GDI: The grey
regions don't scroll with the canvas.

and I don't know which behaviour is correct: 1 or 2 ?

I think 2, but I will also check on wxGTK and wxMAC


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/issues/25845/3355048305@github.com>

RobertRoeb

unread,
Oct 1, 2025, 3:33:27 AMOct 1
to wx-...@googlegroups.com, Subscribed
RobertRoeb left a comment (wxWidgets/wxWidgets#25845)

1- With GDI+ and Direct2D: All regions scroll with the canvas as you scroll it.

That is wrong as clipping regions (and update regions) must not be scrolled, wxGTK and wxMAC behave like what you describe for GDI on wxMSW. The grey rectangles should get smaller at the bottom and eventually disappear, the smileys move up and also disappear eventually.


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/issues/25845/3355114837@github.com>

AliKet

unread,
Oct 1, 2025, 6:52:23 AMOct 1
to wx-...@googlegroups.com, Subscribed
AliKet left a comment (wxWidgets/wxWidgets#25845)

there is still a difference between drawing backends:
1- With GDI+ and Direct2D: All regions scroll with the canvas as you scroll it. 2- With GDI: The grey
regions don't scroll with the canvas.
and I don't know which behaviour is correct: 1 or 2 ?

I think 2, but I will also check on wxGTK and wxMAC

That's what I thought too.. i.e. grey regions shouldn't be scrolled.


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/issues/25845/3355770298@github.com>

AliKet

unread,
Oct 1, 2025, 7:08:47 AMOct 1
to wx-...@googlegroups.com, Subscribed
AliKet left a comment (wxWidgets/wxWidgets#25845)

I just tested wxGTK3 and wxQt behaviours:

  • (wxGTK3 & wxQt) + wxDC: is like GDI.
  • (wxGTK3 & wxQt) + wxGC: is like GDI+ and Direct2D.


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/issues/25845/3355828325@github.com>

VZ

unread,
Oct 1, 2025, 7:49:39 AMOct 1
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25845)

So basically wxGC doesn't behave the same as wxDC but does behave the same in all platforms?

I'm not sure if we should change it in this case...


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/issues/25845/3355956119@github.com>

RobertRoeb

unread,
Oct 1, 2025, 7:55:00 AMOct 1
to wx-...@googlegroups.com, Subscribed
RobertRoeb left a comment (wxWidgets/wxWidgets#25845)

Does not wxOSX use wxGC to simulate a wxDC? But wxMac behaves correctly in the sample.


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/issues/25845/3355971272@github.com>

Stefan Csomor

unread,
Oct 1, 2025, 8:14:08 AMOct 1
to wx-...@googlegroups.com, Subscribed
csomor left a comment (wxWidgets/wxWidgets#25845)

Does not wxOSX use wxGC to simulate a wxDC? But wxMac behaves correctly in the sample.

yes, wxOSX always uses wxGC for wxDC (dcgraph.cpp) since the move from QuickDraw to CoreGraphics somewhen in this century IIRC


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/issues/25845/3356032126@github.com>

VZ

unread,
Oct 1, 2025, 8:57:39 AMOct 1
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#25845)

Does not wxOSX use wxGC to simulate a wxDC? But wxMac behaves correctly in the sample.

So wxGC implementation in wxOSX must have been done right from this point of view, but wxGC in the other ports is different...


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/issues/25845/3356176166@github.com>

AliKet

unread,
Oct 12, 2025, 7:07:28 PM (4 days ago) Oct 12
to wx-...@googlegroups.com, Subscribed
AliKet left a comment (wxWidgets/wxWidgets#25845)

Does not wxOSX use wxGC to simulate a wxDC? But wxMac behaves correctly in the sample.

So wxGC implementation in wxOSX must have been done right from this point of view, but wxGC in the other ports is different...

See #25877


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/issues/25845/3395450474@github.com>

Reply all
Reply to author
Forward
0 new messages