View | Details | Raw Unified | Return to bug 242280 | Differences between
and this patch

Collapse All | Expand All

(-)Eclipse SWT/win32/org/eclipse/swt/graphics/GC.java (-54 / +56 lines)
Lines 80-88 Link Here
80
	static final int PEN = 1 << 11;
80
	static final int PEN = 1 << 11;
81
	static final int NULL_BRUSH = 1 << 12;
81
	static final int NULL_BRUSH = 1 << 12;
82
	static final int NULL_PEN = 1 << 13;
82
	static final int NULL_PEN = 1 << 13;
83
	static final int DRAW_OFFSET = 1 << 14;
84
83
85
	static final int DRAW = FOREGROUND | LINE_STYLE | LINE_WIDTH | LINE_CAP | LINE_JOIN | LINE_MITERLIMIT | PEN | NULL_BRUSH | DRAW_OFFSET;
84
	static final int DRAW = FOREGROUND | LINE_STYLE | LINE_WIDTH | LINE_CAP | LINE_JOIN | LINE_MITERLIMIT | PEN | NULL_BRUSH;
86
	static final int FILL = BACKGROUND | BRUSH | NULL_PEN;
85
	static final int FILL = BACKGROUND | BRUSH | NULL_PEN;
87
86
88
	static final float[] LINE_DOT_ZERO = new float[]{3, 3};
87
	static final float[] LINE_DOT_ZERO = new float[]{3, 3};
Lines 299-324 Link Here
299
			if (data.gdipFont != 0) Gdip.Font_delete(data.gdipFont);
298
			if (data.gdipFont != 0) Gdip.Font_delete(data.gdipFont);
300
			data.gdipFont = gdipFont;
299
			data.gdipFont = gdipFont;
301
		}
300
		}
302
		if ((state & DRAW_OFFSET) != 0) {
303
			data.gdipXOffset = data.gdipYOffset = 0;
304
			int /*long*/ matrix = Gdip.Matrix_new(1, 0, 0, 1, 0, 0);
305
			float[] point = new float[]{1, 1};
306
			Gdip.Graphics_GetTransform(gdipGraphics, matrix);
307
			Gdip.Matrix_TransformPoints(matrix, point, 1);
308
			Gdip.Matrix_delete(matrix);
309
			float scaling = point[0];
310
			if (scaling < 0) scaling = -scaling;
311
			float penWidth = data.lineWidth * scaling;
312
			if (penWidth == 0 || ((int)penWidth % 2) == 1) {
313
				data.gdipXOffset = 0.5f / scaling;
314
			}
315
			scaling = point[1];
316
			if (scaling < 0) scaling = -scaling;
317
			penWidth = data.lineWidth * scaling;
318
			if (penWidth == 0 || ((int)penWidth % 2) == 1) {
319
				data.gdipYOffset = 0.5f / scaling;
320
			}
321
		}
322
		return;
301
		return;
323
	}
302
	}
324
	if ((state & (FOREGROUND | LINE_CAP | LINE_JOIN | LINE_STYLE | LINE_WIDTH)) != 0) {
303
	if ((state & (FOREGROUND | LINE_CAP | LINE_JOIN | LINE_STYLE | LINE_WIDTH)) != 0) {
Lines 692-698 Link Here
692
	if (width == 0 || height == 0 || arcAngle == 0) return;
671
	if (width == 0 || height == 0 || arcAngle == 0) return;
693
	int /*long*/ gdipGraphics = data.gdipGraphics;
672
	int /*long*/ gdipGraphics = data.gdipGraphics;
694
	if (gdipGraphics != 0) {
673
	if (gdipGraphics != 0) {
695
		Gdip.Graphics_TranslateTransform(gdipGraphics, data.gdipXOffset, data.gdipYOffset, Gdip.MatrixOrderPrepend);
696
		if (width == height) {
674
		if (width == height) {
697
			Gdip.Graphics_DrawArc(gdipGraphics, data.gdipPen, x, y, width, height, -startAngle, -arcAngle);
675
			Gdip.Graphics_DrawArc(gdipGraphics, data.gdipPen, x, y, width, height, -startAngle, -arcAngle);
698
		} else {
676
		} else {
Lines 706-712 Link Here
706
			Gdip.Matrix_delete(matrix);
684
			Gdip.Matrix_delete(matrix);
707
			Gdip.GraphicsPath_delete(path);
685
			Gdip.GraphicsPath_delete(path);
708
		}
686
		}
709
		Gdip.Graphics_TranslateTransform(gdipGraphics, -data.gdipXOffset, -data.gdipYOffset, Gdip.MatrixOrderPrepend);
710
		return;
687
		return;
711
	}
688
	}
712
	if ((data.style & SWT.MIRRORED) != 0) {
689
	if ((data.style & SWT.MIRRORED) != 0) {
Lines 785-791 Link Here
785
	int /*long*/ gdipGraphics = data.gdipGraphics;
762
	int /*long*/ gdipGraphics = data.gdipGraphics;
786
	if (gdipGraphics != 0) {
763
	if (gdipGraphics != 0) {
787
		int /*long*/ clipRgn = 0;
764
		int /*long*/ clipRgn = 0;
788
		Gdip.Graphics_SetPixelOffsetMode(gdipGraphics, Gdip.PixelOffsetModeNone);
789
		int /*long*/ rgn = Gdip.Region_new();
765
		int /*long*/ rgn = Gdip.Region_new();
790
		if (rgn == 0) SWT.error(SWT.ERROR_NO_HANDLES);
766
		if (rgn == 0) SWT.error(SWT.ERROR_NO_HANDLES);
791
		Gdip.Graphics_GetClip(gdipGraphics, rgn);
767
		Gdip.Graphics_GetClip(gdipGraphics, rgn);
Lines 793-799 Link Here
793
			clipRgn = Gdip.Region_GetHRGN(rgn, gdipGraphics);
769
			clipRgn = Gdip.Region_GetHRGN(rgn, gdipGraphics);
794
		}
770
		}
795
		Gdip.Region_delete(rgn);
771
		Gdip.Region_delete(rgn);
796
		Gdip.Graphics_SetPixelOffsetMode(gdipGraphics, Gdip.PixelOffsetModeHalf);
797
		float[] lpXform = null;
772
		float[] lpXform = null;
798
		int /*long*/ matrix = Gdip.Matrix_new(1, 0, 0, 1, 0, 0);
773
		int /*long*/ matrix = Gdip.Matrix_new(1, 0, 0, 1, 0, 0);
799
		if (matrix == 0) SWT.error(SWT.ERROR_NO_HANDLES);
774
		if (matrix == 0) SWT.error(SWT.ERROR_NO_HANDLES);
Lines 1615-1623 Link Here
1615
	checkGC(DRAW);
1590
	checkGC(DRAW);
1616
	int /*long*/ gdipGraphics = data.gdipGraphics;
1591
	int /*long*/ gdipGraphics = data.gdipGraphics;
1617
	if (gdipGraphics != 0) {
1592
	if (gdipGraphics != 0) {
1618
		Gdip.Graphics_TranslateTransform(gdipGraphics, data.gdipXOffset, data.gdipYOffset, Gdip.MatrixOrderPrepend);
1619
		Gdip.Graphics_DrawLine(gdipGraphics, data.gdipPen, x1, y1, x2, y2);
1593
		Gdip.Graphics_DrawLine(gdipGraphics, data.gdipPen, x1, y1, x2, y2);
1620
		Gdip.Graphics_TranslateTransform(gdipGraphics, -data.gdipXOffset, -data.gdipYOffset, Gdip.MatrixOrderPrepend);
1621
		return;
1594
		return;
1622
	}
1595
	}
1623
	if ((data.style & SWT.MIRRORED) != 0) {
1596
	if ((data.style & SWT.MIRRORED) != 0) {
Lines 1664-1672 Link Here
1664
	checkGC(DRAW);
1637
	checkGC(DRAW);
1665
	int /*long*/ gdipGraphics = data.gdipGraphics;
1638
	int /*long*/ gdipGraphics = data.gdipGraphics;
1666
	if (gdipGraphics != 0) {
1639
	if (gdipGraphics != 0) {
1667
		Gdip.Graphics_TranslateTransform(gdipGraphics, data.gdipXOffset, data.gdipYOffset, Gdip.MatrixOrderPrepend);
1668
		Gdip.Graphics_DrawEllipse(gdipGraphics, data.gdipPen, x, y, width, height);
1640
		Gdip.Graphics_DrawEllipse(gdipGraphics, data.gdipPen, x, y, width, height);
1669
		Gdip.Graphics_TranslateTransform(gdipGraphics, -data.gdipXOffset, -data.gdipYOffset, Gdip.MatrixOrderPrepend);
1670
		return;
1641
		return;
1671
	}
1642
	}
1672
	if ((data.style & SWT.MIRRORED) != 0) {
1643
	if ((data.style & SWT.MIRRORED) != 0) {
Lines 1705-1713 Link Here
1705
	initGdip();
1676
	initGdip();
1706
	checkGC(DRAW);
1677
	checkGC(DRAW);
1707
	int /*long*/ gdipGraphics = data.gdipGraphics;
1678
	int /*long*/ gdipGraphics = data.gdipGraphics;
1708
	Gdip.Graphics_TranslateTransform(gdipGraphics, data.gdipXOffset, data.gdipYOffset, Gdip.MatrixOrderPrepend);
1709
	Gdip.Graphics_DrawPath(gdipGraphics, data.gdipPen, path.handle);
1679
	Gdip.Graphics_DrawPath(gdipGraphics, data.gdipPen, path.handle);
1710
	Gdip.Graphics_TranslateTransform(gdipGraphics, -data.gdipXOffset, -data.gdipYOffset, Gdip.MatrixOrderPrepend);
1711
}
1680
}
1712
1681
1713
/** 
1682
/** 
Lines 1760-1768 Link Here
1760
	checkGC(DRAW);
1729
	checkGC(DRAW);
1761
	int /*long*/ gdipGraphics = data.gdipGraphics;
1730
	int /*long*/ gdipGraphics = data.gdipGraphics;
1762
	if (gdipGraphics != 0) {
1731
	if (gdipGraphics != 0) {
1763
		Gdip.Graphics_TranslateTransform(gdipGraphics, data.gdipXOffset, data.gdipYOffset, Gdip.MatrixOrderPrepend);
1764
		Gdip.Graphics_DrawPolygon(gdipGraphics, data.gdipPen, pointArray, pointArray.length / 2);
1732
		Gdip.Graphics_DrawPolygon(gdipGraphics, data.gdipPen, pointArray, pointArray.length / 2);
1765
		Gdip.Graphics_TranslateTransform(gdipGraphics, -data.gdipXOffset, -data.gdipYOffset, Gdip.MatrixOrderPrepend);
1766
		return;
1733
		return;
1767
	}
1734
	}
1768
	if ((data.style & SWT.MIRRORED) != 0) {
1735
	if ((data.style & SWT.MIRRORED) != 0) {
Lines 1805-1813 Link Here
1805
	checkGC(DRAW);
1772
	checkGC(DRAW);
1806
	int /*long*/ gdipGraphics = data.gdipGraphics;
1773
	int /*long*/ gdipGraphics = data.gdipGraphics;
1807
	if (gdipGraphics != 0) {
1774
	if (gdipGraphics != 0) {
1808
		Gdip.Graphics_TranslateTransform(gdipGraphics, data.gdipXOffset, data.gdipYOffset, Gdip.MatrixOrderPrepend);
1809
		Gdip.Graphics_DrawLines(gdipGraphics, data.gdipPen, pointArray, pointArray.length / 2);
1775
		Gdip.Graphics_DrawLines(gdipGraphics, data.gdipPen, pointArray, pointArray.length / 2);
1810
		Gdip.Graphics_TranslateTransform(gdipGraphics, -data.gdipXOffset, -data.gdipYOffset, Gdip.MatrixOrderPrepend);
1811
		return;
1776
		return;
1812
	}
1777
	}
1813
	if ((data.style & SWT.MIRRORED) != 0) {
1778
	if ((data.style & SWT.MIRRORED) != 0) {
Lines 1861-1869 Link Here
1861
			y = y + height;
1826
			y = y + height;
1862
			height = -height;
1827
			height = -height;
1863
		}
1828
		}
1864
		Gdip.Graphics_TranslateTransform(gdipGraphics, data.gdipXOffset, data.gdipYOffset, Gdip.MatrixOrderPrepend);
1865
		Gdip.Graphics_DrawRectangle(gdipGraphics, data.gdipPen, x, y, width, height);
1829
		Gdip.Graphics_DrawRectangle(gdipGraphics, data.gdipPen, x, y, width, height);
1866
		Gdip.Graphics_TranslateTransform(gdipGraphics, -data.gdipXOffset, -data.gdipYOffset, Gdip.MatrixOrderPrepend);
1867
		return;
1830
		return;
1868
	}
1831
	}
1869
	if ((data.style & SWT.MIRRORED) != 0) {
1832
	if ((data.style & SWT.MIRRORED) != 0) {
Lines 1998-2004 Link Here
1998
	if (nah < 0)
1961
	if (nah < 0)
1999
		nah = 0 - nah;
1962
		nah = 0 - nah;
2000
	
1963
	
2001
	Gdip.Graphics_TranslateTransform(gdipGraphics, data.gdipXOffset, data.gdipYOffset, Gdip.MatrixOrderPrepend);
2002
	if (naw == 0 || nah == 0) {
1964
	if (naw == 0 || nah == 0) {
2003
		Gdip.Graphics_DrawRectangle(gdipGraphics, data.gdipPen, x, y, width, height);
1965
		Gdip.Graphics_DrawRectangle(gdipGraphics, data.gdipPen, x, y, width, height);
2004
	} else {
1966
	} else {
Lines 2026-2032 Link Here
2026
		Gdip.Graphics_DrawPath(gdipGraphics, pen, path);
1988
		Gdip.Graphics_DrawPath(gdipGraphics, pen, path);
2027
		Gdip.GraphicsPath_delete(path);
1989
		Gdip.GraphicsPath_delete(path);
2028
	}
1990
	}
2029
	Gdip.Graphics_TranslateTransform(gdipGraphics, -data.gdipXOffset, -data.gdipYOffset, Gdip.MatrixOrderPrepend);
2030
}
1991
}
2031
1992
2032
/** 
1993
/** 
Lines 2090-2096 Link Here
2090
		if (!isTransparent) {
2051
		if (!isTransparent) {
2091
			RectF bounds = new RectF();
2052
			RectF bounds = new RectF();
2092
			Gdip.Graphics_MeasureString(gdipGraphics, buffer, length, data.gdipFont, pt, format, bounds);
2053
			Gdip.Graphics_MeasureString(gdipGraphics, buffer, length, data.gdipFont, pt, format, bounds);
2054
			gdiFillPrepare();
2093
			Gdip.Graphics_FillRectangle(gdipGraphics, data.gdipBrush, x, y, Math.round(bounds.Width), Math.round(bounds.Height));
2055
			Gdip.Graphics_FillRectangle(gdipGraphics, data.gdipBrush, x, y, Math.round(bounds.Width), Math.round(bounds.Height));
2056
			gdiFillRestore();
2094
		}
2057
		}
2095
		int gstate = 0;
2058
		int gstate = 0;
2096
		int /*long*/ brush = getFgBrush();
2059
		int /*long*/ brush = getFgBrush();
Lines 2111-2117 Link Here
2111
		}
2074
		}
2112
		pt.X = x;
2075
		pt.X = x;
2113
		pt.Y = y;
2076
		pt.Y = y;
2077
		gdiFillPrepare();
2114
		Gdip.Graphics_DrawString(gdipGraphics, buffer, length, data.gdipFont, pt, format, brush);
2078
		Gdip.Graphics_DrawString(gdipGraphics, buffer, length, data.gdipFont, pt, format, brush);
2079
		gdiFillRestore();
2115
		if ((data.style & SWT.MIRRORED) != 0) {
2080
		if ((data.style & SWT.MIRRORED) != 0) {
2116
			switch (Gdip.Brush_GetType(brush)) {
2081
			switch (Gdip.Brush_GetType(brush)) {
2117
				case Gdip.BrushTypeLinearGradient:
2082
				case Gdip.BrushTypeLinearGradient:
Lines 2289-2295 Link Here
2289
		if ((flags & SWT.DRAW_TRANSPARENT) == 0) {
2254
		if ((flags & SWT.DRAW_TRANSPARENT) == 0) {
2290
			RectF bounds = new RectF();
2255
			RectF bounds = new RectF();
2291
			Gdip.Graphics_MeasureString(gdipGraphics, buffer, length, data.gdipFont, pt, format, bounds);
2256
			Gdip.Graphics_MeasureString(gdipGraphics, buffer, length, data.gdipFont, pt, format, bounds);
2257
			gdiFillPrepare();
2292
			Gdip.Graphics_FillRectangle(gdipGraphics, data.gdipBrush, x, y, Math.round(bounds.Width), Math.round(bounds.Height));
2258
			Gdip.Graphics_FillRectangle(gdipGraphics, data.gdipBrush, x, y, Math.round(bounds.Width), Math.round(bounds.Height));
2259
			gdiFillRestore();
2293
		}
2260
		}
2294
		int gstate = 0;
2261
		int gstate = 0;
2295
		int /*long*/ brush = getFgBrush();
2262
		int /*long*/ brush = getFgBrush();
Lines 2449-2454 Link Here
2449
	if (width == 0 || height == 0 || arcAngle == 0) return;
2416
	if (width == 0 || height == 0 || arcAngle == 0) return;
2450
	int /*long*/ gdipGraphics = data.gdipGraphics;
2417
	int /*long*/ gdipGraphics = data.gdipGraphics;
2451
	if (gdipGraphics != 0) {
2418
	if (gdipGraphics != 0) {
2419
		gdiFillPrepare();
2452
		if (width == height) {
2420
		if (width == height) {
2453
			Gdip.Graphics_FillPie(gdipGraphics, data.gdipBrush, x, y, width, height, -startAngle, -arcAngle);
2421
			Gdip.Graphics_FillPie(gdipGraphics, data.gdipBrush, x, y, width, height, -startAngle, -arcAngle);
2454
		} else {
2422
		} else {
Lines 2458-2463 Link Here
2458
			Gdip.Graphics_FillPie(gdipGraphics, data.gdipBrush, 0, 0, 1, 1, -startAngle, -arcAngle);
2426
			Gdip.Graphics_FillPie(gdipGraphics, data.gdipBrush, 0, 0, 1, 1, -startAngle, -arcAngle);
2459
			Gdip.Graphics_Restore(gdipGraphics, state);
2427
			Gdip.Graphics_Restore(gdipGraphics, state);
2460
		}
2428
		}
2429
		gdiFillRestore();
2461
		return;
2430
		return;
2462
	}
2431
	}
2463
	
2432
	
Lines 2584-2590 Link Here
2584
		int /*long*/ toGpColor = Gdip.Color_new(data.alpha << 24 | rgb);
2553
		int /*long*/ toGpColor = Gdip.Color_new(data.alpha << 24 | rgb);
2585
		if (toGpColor == 0) SWT.error(SWT.ERROR_NO_HANDLES);
2554
		if (toGpColor == 0) SWT.error(SWT.ERROR_NO_HANDLES);
2586
		int /*long*/ brush = Gdip.LinearGradientBrush_new(p1, p2, fromGpColor, toGpColor);
2555
		int /*long*/ brush = Gdip.LinearGradientBrush_new(p1, p2, fromGpColor, toGpColor);
2556
		gdiFillPrepare();
2587
		Gdip.Graphics_FillRectangle(data.gdipGraphics, brush, x, y, width, height);
2557
		Gdip.Graphics_FillRectangle(data.gdipGraphics, brush, x, y, width, height);
2558
		gdiFillRestore();
2588
		Gdip.LinearGradientBrush_delete(brush);
2559
		Gdip.LinearGradientBrush_delete(brush);
2589
		Gdip.Color_delete(fromGpColor);
2560
		Gdip.Color_delete(fromGpColor);
2590
		Gdip.Color_delete(toGpColor);
2561
		Gdip.Color_delete(toGpColor);
Lines 2661-2672 Link Here
2661
 * </ul>
2632
 * </ul>
2662
 *
2633
 *
2663
 * @see #drawOval
2634
 * @see #drawOval
2664
 */	 
2635
 */
2665
public void fillOval (int x, int y, int width, int height) {
2636
public void fillOval (int x, int y, int width, int height) {
2666
	if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
2637
	if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
2667
	checkGC(FILL);
2638
	checkGC(FILL);
2668
	if (data.gdipGraphics != 0) {
2639
	if (data.gdipGraphics != 0) {
2640
		gdiFillPrepare();
2669
		Gdip.Graphics_FillEllipse(data.gdipGraphics, data.gdipBrush, x, y, width, height);
2641
		Gdip.Graphics_FillEllipse(data.gdipGraphics, data.gdipBrush, x, y, width, height);
2642
		gdiFillRestore();
2670
		return;
2643
		return;
2671
	}
2644
	}
2672
	if ((data.style & SWT.MIRRORED) != 0) x--;
2645
	if ((data.style & SWT.MIRRORED) != 0) x--;
Lines 2766-2772 Link Here
2766
public void fillRectangle (int x, int y, int width, int height) {
2739
public void fillRectangle (int x, int y, int width, int height) {
2767
	if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
2740
	if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
2768
	checkGC(FILL);
2741
	checkGC(FILL);
2769
	if (data.gdipGraphics != 0) {
2742
	int gdipGraphics = data.gdipGraphics;
2743
	if (gdipGraphics != 0) {
2770
		if (width < 0) {
2744
		if (width < 0) {
2771
			x = x + width;
2745
			x = x + width;
2772
			width = -width;
2746
			width = -width;
Lines 2775-2781 Link Here
2775
			y = y + height;
2749
			y = y + height;
2776
			height = -height;
2750
			height = -height;
2777
		}
2751
		}
2778
		Gdip.Graphics_FillRectangle(data.gdipGraphics, data.gdipBrush, x, y, width, height);
2752
		gdiFillPrepare();
2753
		Gdip.Graphics_FillRectangle(gdipGraphics, data.gdipBrush, x, y, width, height);
2754
		gdiFillRestore();
2779
		return;
2755
		return;
2780
	}
2756
	}
2781
	int rop2 = 0;
2757
	int rop2 = 0;
Lines 2859-2865 Link Here
2859
		nah = 0 - nah;
2835
		nah = 0 - nah;
2860
2836
2861
	if (naw == 0 || nah == 0) {
2837
	if (naw == 0 || nah == 0) {
2838
		gdiFillPrepare();
2862
		Gdip.Graphics_FillRectangle(data.gdipGraphics, data.gdipBrush, x, y, width, height);
2839
		Gdip.Graphics_FillRectangle(data.gdipGraphics, data.gdipBrush, x, y, width, height);
2840
		gdiFillRestore();
2863
	} else {
2841
	} else {
2864
		int /*long*/ path = Gdip.GraphicsPath_new(Gdip.FillModeAlternate);
2842
		int /*long*/ path = Gdip.GraphicsPath_new(Gdip.FillModeAlternate);
2865
		if (path == 0) SWT.error(SWT.ERROR_NO_HANDLES);
2843
		if (path == 0) SWT.error(SWT.ERROR_NO_HANDLES);
Lines 2882-2888 Link Here
2882
			}
2860
			}
2883
		}
2861
		}
2884
		Gdip.GraphicsPath_CloseFigure(path);
2862
		Gdip.GraphicsPath_CloseFigure(path);
2863
		gdiFillPrepare();
2885
		Gdip.Graphics_FillPath(gdipGraphics, brush, path);
2864
		Gdip.Graphics_FillPath(gdipGraphics, brush, path);
2865
		gdiFillRestore();
2886
		Gdip.GraphicsPath_delete(path);
2866
		Gdip.GraphicsPath_delete(path);
2887
	}
2867
	}
2888
}
2868
}
Lines 2900-2905 Link Here
2900
	}
2880
	}
2901
}
2881
}
2902
2882
2883
void gdiFillRestore() {
2884
	Gdip.Graphics_TranslateTransform(data.gdipGraphics, 0.5f, 0.5f, Gdip.MatrixOrderPrepend);
2885
	if (data.backgroundPattern != null) {
2886
		switch (Gdip.Brush_GetType(data.gdipBrush)) {
2887
			case Gdip.BrushTypeTextureFill:
2888
				Gdip.TextureBrush_TranslateTransform(data.gdipBrush, -0.5f, -0.5f, Gdip.MatrixOrderPrepend);
2889
				break;
2890
			case Gdip.BrushTypeLinearGradient:
2891
				Gdip.LinearGradientBrush_TranslateTransform(data.gdipBrush, -0.5f, -0.5f, Gdip.MatrixOrderPrepend);
2892
		}
2893
	}
2894
}
2895
2896
void gdiFillPrepare() {
2897
	Gdip.Graphics_TranslateTransform(data.gdipGraphics, -0.5f, -0.5f, Gdip.MatrixOrderPrepend);
2898
	if (data.backgroundPattern != null) {
2899
		switch (Gdip.Brush_GetType(data.gdipBrush)) {
2900
			case Gdip.BrushTypeTextureFill:
2901
				Gdip.TextureBrush_TranslateTransform(data.gdipBrush, 0.5f, 0.5f, Gdip.MatrixOrderPrepend);
2902
				break;
2903
			case Gdip.BrushTypeLinearGradient:
2904
				Gdip.LinearGradientBrush_TranslateTransform(data.gdipBrush, 0.5f, 0.5f, Gdip.MatrixOrderPrepend);
2905
				break;
2906
		}
2907
	}
2908
}
2909
2903
/**
2910
/**
2904
 * Returns the <em>advance width</em> of the specified character in
2911
 * Returns the <em>advance width</em> of the specified character in
2905
 * the font which is currently selected into the receiver.
2912
 * the font which is currently selected into the receiver.
Lines 3102-3110 Link Here
3102
	int /*long*/ gdipGraphics = data.gdipGraphics;
3109
	int /*long*/ gdipGraphics = data.gdipGraphics;
3103
	if (gdipGraphics != 0) {
3110
	if (gdipGraphics != 0) {
3104
		Rect rect = new Rect();
3111
		Rect rect = new Rect();
3105
		Gdip.Graphics_SetPixelOffsetMode(gdipGraphics, Gdip.PixelOffsetModeNone);
3106
		Gdip.Graphics_GetVisibleClipBounds(gdipGraphics, rect);
3112
		Gdip.Graphics_GetVisibleClipBounds(gdipGraphics, rect);
3107
		Gdip.Graphics_SetPixelOffsetMode(gdipGraphics, Gdip.PixelOffsetModeHalf);
3108
		return new Rectangle(rect.X, rect.Y, rect.Width, rect.Height);
3113
		return new Rectangle(rect.X, rect.Y, rect.Width, rect.Height);
3109
	}
3114
	}
3110
	RECT rect = new RECT();
3115
	RECT rect = new RECT();
Lines 3136-3144 Link Here
3136
		Gdip.Graphics_GetClip(data.gdipGraphics, rgn);
3141
		Gdip.Graphics_GetClip(data.gdipGraphics, rgn);
3137
		if (Gdip.Region_IsInfinite(rgn, gdipGraphics)) {
3142
		if (Gdip.Region_IsInfinite(rgn, gdipGraphics)) {
3138
			Rect rect = new Rect();
3143
			Rect rect = new Rect();
3139
			Gdip.Graphics_SetPixelOffsetMode(gdipGraphics, Gdip.PixelOffsetModeNone);
3140
			Gdip.Graphics_GetVisibleClipBounds(gdipGraphics, rect);
3144
			Gdip.Graphics_GetVisibleClipBounds(gdipGraphics, rect);
3141
			Gdip.Graphics_SetPixelOffsetMode(gdipGraphics, Gdip.PixelOffsetModeHalf);
3142
			OS.SetRectRgn(region.handle, rect.X, rect.Y, rect.X + rect.Width, rect.Y + rect.Height);
3145
			OS.SetRectRgn(region.handle, rect.X, rect.Y, rect.X + rect.Width, rect.Y + rect.Height);
3143
		} else {
3146
		} else {
3144
			int /*long*/ matrix = Gdip.Matrix_new(1, 0, 0, 1, 0, 0);
3147
			int /*long*/ matrix = Gdip.Matrix_new(1, 0, 0, 1, 0, 0);
Lines 3610-3616 Link Here
3610
	gdipGraphics = data.gdipGraphics = Gdip.Graphics_new(handle);
3613
	gdipGraphics = data.gdipGraphics = Gdip.Graphics_new(handle);
3611
	if (gdipGraphics == 0) SWT.error(SWT.ERROR_NO_HANDLES);
3614
	if (gdipGraphics == 0) SWT.error(SWT.ERROR_NO_HANDLES);
3612
	Gdip.Graphics_SetPageUnit(gdipGraphics, Gdip.UnitPixel);
3615
	Gdip.Graphics_SetPageUnit(gdipGraphics, Gdip.UnitPixel);
3613
	Gdip.Graphics_SetPixelOffsetMode(gdipGraphics, Gdip.PixelOffsetModeHalf);
3616
	Gdip.Graphics_SetPixelOffsetMode(gdipGraphics, Gdip.PixelOffsetModeNone);
3614
	if ((data.style & SWT.MIRRORED) != 0) {
3617
	if ((data.style & SWT.MIRRORED) != 0) {
3615
		int /*long*/ matrix = identity();
3618
		int /*long*/ matrix = identity();
3616
		Gdip.Graphics_SetTransform(gdipGraphics, matrix);
3619
		Gdip.Graphics_SetTransform(gdipGraphics, matrix);
Lines 4287-4293 Link Here
4287
	int mask = 0;
4290
	int mask = 0;
4288
	float lineWidth = attributes.width;
4291
	float lineWidth = attributes.width;
4289
	if (lineWidth != data.lineWidth) {
4292
	if (lineWidth != data.lineWidth) {
4290
		mask |= LINE_WIDTH | DRAW_OFFSET;
4293
		mask |= LINE_WIDTH;
4291
	}
4294
	}
4292
	int lineStyle = attributes.style;
4295
	int lineStyle = attributes.style;
4293
	if (lineStyle != data.lineStyle) {
4296
	if (lineStyle != data.lineStyle) {
Lines 4534-4540 Link Here
4534
	if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
4537
	if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
4535
	if (data.lineWidth == lineWidth) return;
4538
	if (data.lineWidth == lineWidth) return;
4536
	data.lineWidth = lineWidth;
4539
	data.lineWidth = lineWidth;
4537
	data.state &= ~(LINE_WIDTH | DRAW_OFFSET);
4540
	data.state &= ~(LINE_WIDTH);
4538
}
4541
}
4539
4542
4540
/** 
4543
/** 
Lines 4600-4614 Link Here
4600
			textMode = Gdip.TextRenderingHintSystemDefault;
4603
			textMode = Gdip.TextRenderingHintSystemDefault;
4601
			break;
4604
			break;
4602
		case SWT.OFF:
4605
		case SWT.OFF:
4603
			textMode = Gdip.TextRenderingHintSingleBitPerPixelGridFit;
4606
			textMode = Gdip.TextRenderingHintSingleBitPerPixel;
4604
			break;
4607
			break;
4605
		case SWT.ON:
4608
		case SWT.ON:
4606
			int[] type = new int[1];
4609
			int[] type = new int[1];
4607
			OS.SystemParametersInfo(OS.SPI_GETFONTSMOOTHINGTYPE, 0, type, 0);
4610
			OS.SystemParametersInfo(OS.SPI_GETFONTSMOOTHINGTYPE, 0, type, 0);
4608
			if (type[0] == OS.FE_FONTSMOOTHINGCLEARTYPE) {
4611
			if (type[0] == OS.FE_FONTSMOOTHINGCLEARTYPE) {
4609
				textMode = Gdip.TextRenderingHintClearTypeGridFit;
4612
				textMode = Gdip.TextRenderingHintAntiAlias;
4610
			} else {
4613
			} else {
4611
				textMode = Gdip.TextRenderingHintAntiAliasGridFit;
4614
				textMode = Gdip.TextRenderingHintAntiAlias;
4612
			}
4615
			}
4613
			break;
4616
			break;
4614
		default:
4617
		default:
Lines 4655-4661 Link Here
4655
	}
4658
	}
4656
	Gdip.Graphics_SetTransform(data.gdipGraphics, identity);
4659
	Gdip.Graphics_SetTransform(data.gdipGraphics, identity);
4657
	Gdip.Matrix_delete(identity);
4660
	Gdip.Matrix_delete(identity);
4658
	data.state &= ~DRAW_OFFSET;
4659
}
4661
}
4660
4662
4661
/**
4663
/**
(-)Eclipse SWT/win32/org/eclipse/swt/graphics/GCData.java (-1 lines)
Lines 56-62 Link Here
56
	public int /*long*/ gdipFgBrush;
56
	public int /*long*/ gdipFgBrush;
57
	public int /*long*/ gdipBgBrush;
57
	public int /*long*/ gdipBgBrush;
58
	public int /*long*/ gdipFont;
58
	public int /*long*/ gdipFont;
59
	public float gdipXOffset, gdipYOffset;
60
	public int uiState = 0;
59
	public int uiState = 0;
61
	public boolean focusDrawn;
60
	public boolean focusDrawn;
62
}
61
}

Return to bug 242280