Skip to content

Commit 4420b90

Browse files
arunjose696akoch-yatta
authored andcommitted
Use Rectangle.ofFloat for bounds in WM_PAINT to avoid rounding issues
Set paint event bounds using Rectangle.ofFloat in WM_PAINT to prevent rounding errors from pixel-to-point conversions. The current issue being solved with this is, when resizing or expanding scrollables with styled text (e.g. Git revision information), the width of the newly painted region can be small such that they are non-zero in pixels but rounded down to zero in points (after pixelToPoint call). This causes StyledText::handlePaint to skip drawing due to event.width == 0, resulting in visible rendering artifacts. Using float-based bounds preserves non-zero regions and prevents missed paint operations during resize.
1 parent ddac0aa commit 4420b90

File tree

1 file changed

+1
-1
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets

1 file changed

+1
-1
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Composite.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1532,7 +1532,7 @@ LRESULT WM_PAINT (long wParam, long lParam) {
15321532

15331533
Event event = new Event ();
15341534
event.gc = gc;
1535-
event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle(ps.left, ps.top, width, height), getZoom()));
1535+
event.setBounds(Win32DPIUtils.pixelToPoint(new Rectangle.OfFloat(ps.left, ps.top, width, height), getZoom()));
15361536
sendEvent (SWT.Paint, event);
15371537
if (data.focusDrawn && !isDisposed ()) updateUIState ();
15381538
gc.dispose ();

0 commit comments

Comments
 (0)