Skip to content

Commit 41d3797

Browse files
committed
[Win32] Convert dash offset for line attributes in GC into pixels
When setting line attributes in a GC, the properties containing zoom-specific values are transformed from point into pixel values when assigning them to the actual GC data. While this is properly done for line width and dash, it is currently not done for the dash offset. With this change, also the dash offset is properly transformed into a pixel value.
1 parent f332d79 commit 41d3797

File tree

1 file changed

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

1 file changed

+3
-1
lines changed

bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4199,6 +4199,7 @@ public LineAttributes getLineAttributes () {
41994199
if(attributes.dash != null) {
42004200
attributes.dash = Win32DPIUtils.pixelToPoint(drawable, attributes.dash, deviceZoom);
42014201
}
4202+
attributes.dashOffset = Win32DPIUtils.pixelToPoint(drawable, attributes.dashOffset, deviceZoom);
42024203
return attributes;
42034204
}
42044205

@@ -5367,8 +5368,9 @@ void apply() {
53675368
private LineAttributes convertToPixels(LineAttributes attributes) {
53685369
int zoom = getZoom();
53695370
float[] dashInPixels = Win32DPIUtils.pointToPixel(drawable, attributes.dash, zoom);
5371+
float dashOffsetInPixels = Win32DPIUtils.pointToPixel(drawable, attributes.dashOffset, zoom);
53705372
float widthInPixels = Win32DPIUtils.pointToPixel(drawable, attributes.width, zoom);
5371-
LineAttributes lineAttributesInPixels = new LineAttributes(widthInPixels, attributes.cap, attributes.join, attributes.style, dashInPixels, attributes.dashOffset, attributes.miterLimit);
5373+
LineAttributes lineAttributesInPixels = new LineAttributes(widthInPixels, attributes.cap, attributes.join, attributes.style, dashInPixels, dashOffsetInPixels, attributes.miterLimit);
53725374
return lineAttributesInPixels;
53735375
}
53745376
}

0 commit comments

Comments
 (0)