Skip to content

Commit 6a28744

Browse files
committed
[Gtk] Remove useless *InPixel methods
Most of the time these have just added one more not public method that the public one simply calls.
1 parent 0bf7819 commit 6a28744

File tree

1 file changed

+8
-117
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics

1 file changed

+8
-117
lines changed

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

Lines changed: 8 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -467,9 +467,6 @@ public void copyArea(Image image, int x, int y) {
467467
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
468468
if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
469469
if (image.type != SWT.BITMAP || image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
470-
copyAreaInPixels(image, x, y);
471-
}
472-
void copyAreaInPixels(Image image, int x, int y) {
473470
long cairo = Cairo.cairo_create(image.surface);
474471
if (cairo == 0) SWT.error(SWT.ERROR_NO_HANDLES);
475472
Cairo.cairo_translate(cairo, -x, -y);
@@ -505,13 +502,9 @@ void copyAreaInPixels(Image image, int x, int y) {
505502
* </ul>
506503
*/
507504
public void copyArea(int srcX, int srcY, int width, int height, int destX, int destY) {
508-
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
509-
copyAreaInPixels(srcX, srcY, width, height, destX, destY);
505+
copyArea(srcX, srcY, width, height, destX, destY, true);
510506
}
511507

512-
void copyAreaInPixels(int srcX, int srcY, int width, int height, int destX, int destY) {
513-
copyAreaInPixels(srcX, srcY, width, height, destX, destY, true);
514-
}
515508
/**
516509
* Copies a rectangular area of the receiver at the source
517510
* position onto the receiver at the destination position.
@@ -532,9 +525,6 @@ void copyAreaInPixels(int srcX, int srcY, int width, int height, int destX, int
532525
*/
533526
public void copyArea(int srcX, int srcY, int width, int height, int destX, int destY, boolean paint) {
534527
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
535-
copyAreaInPixels(srcX, srcY, width, height, destX, destY, paint);
536-
}
537-
void copyAreaInPixels(int srcX, int srcY, int width, int height, int destX, int destY, boolean paint) {
538528
if (width <= 0 || height <= 0) return;
539529
int deltaX = destX - srcX, deltaY = destY - srcY;
540530
if (deltaX == 0 && deltaY == 0) return;
@@ -721,9 +711,6 @@ void destroy() {
721711
*/
722712
public void drawArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
723713
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
724-
drawArcInPixels(x, y, width, height, startAngle, arcAngle);
725-
}
726-
void drawArcInPixels(int x, int y, int width, int height, int startAngle, int arcAngle) {
727714
checkGC(DRAW);
728715
if (width < 0) {
729716
x = x + width;
@@ -775,9 +762,6 @@ void drawArcInPixels(int x, int y, int width, int height, int startAngle, int ar
775762
*/
776763
public void drawFocus(int x, int y, int width, int height) {
777764
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
778-
drawFocusInPixels(x, y, width, height);
779-
}
780-
void drawFocusInPixels(int x, int y, int width, int height) {
781765
long cairo = data.cairo;
782766
checkGC(FOREGROUND);
783767
long context = GTK.gtk_widget_get_style_context(data.device.shellHandle);
@@ -807,9 +791,6 @@ public void drawImage(Image image, int x, int y) {
807791
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
808792
if (image == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
809793
if (image.isDisposed()) SWT.error(SWT.ERROR_INVALID_ARGUMENT);
810-
drawImageInPixels(image, x, y);
811-
}
812-
void drawImageInPixels(Image image, int x, int y) {
813794
drawImage(image, 0, 0, -1, -1, x, y, -1, -1, true);
814795
}
815796

@@ -986,9 +967,6 @@ void drawImage(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight,
986967
*/
987968
public void drawLine(int x1, int y1, int x2, int y2) {
988969
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
989-
drawLineInPixels(x1, y1, x2, y2);
990-
}
991-
void drawLineInPixels(int x1, int y1, int x2, int y2) {
992970
checkGC(DRAW);
993971
long cairo = data.cairo;
994972
double xOffset = data.cairoXoffset, yOffset = data.cairoYoffset;
@@ -1023,9 +1001,6 @@ void drawLineInPixels(int x1, int y1, int x2, int y2) {
10231001
*/
10241002
public void drawOval(int x, int y, int width, int height) {
10251003
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
1026-
drawOvalInPixels(x, y, width, height);
1027-
}
1028-
void drawOvalInPixels(int x, int y, int width, int height) {
10291004
checkGC(DRAW);
10301005
if (width < 0) {
10311006
x = x + width;
@@ -1109,9 +1084,6 @@ public void drawPath(Path path) {
11091084
*/
11101085
public void drawPoint (int x, int y) {
11111086
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
1112-
drawPointInPixels(x, y);
1113-
}
1114-
void drawPointInPixels (int x, int y) {
11151087
checkGC(DRAW);
11161088
long cairo = data.cairo;
11171089
Cairo.cairo_rectangle(cairo, x, y, 1, 1);
@@ -1138,10 +1110,6 @@ void drawPointInPixels (int x, int y) {
11381110
public void drawPolygon(int[] pointArray) {
11391111
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
11401112
if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
1141-
int [] scaledPointArray = pointArray;
1142-
drawPolygonInPixels(scaledPointArray);
1143-
}
1144-
void drawPolygonInPixels(int[] pointArray) {
11451113
checkGC(DRAW);
11461114
long cairo = data.cairo;
11471115
drawPolyline(cairo, pointArray, data.cairoXoffset, data.cairoYoffset, true);
@@ -1168,10 +1136,6 @@ void drawPolygonInPixels(int[] pointArray) {
11681136
public void drawPolyline(int[] pointArray) {
11691137
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
11701138
if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
1171-
int [] scaledPointArray = pointArray;
1172-
drawPolylineInPixels(scaledPointArray);
1173-
}
1174-
void drawPolylineInPixels(int[] pointArray) {
11751139
checkGC(DRAW);
11761140
long cairo = data.cairo;
11771141
drawPolyline(cairo, pointArray, data.cairoXoffset, data.cairoYoffset, false);
@@ -1205,9 +1169,6 @@ void drawPolyline(long cairo, int[] pointArray, double xOffset, double yOffset,
12051169
*/
12061170
public void drawRectangle(int x, int y, int width, int height) {
12071171
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
1208-
drawRectangleInPixels(x, y, width, height);
1209-
}
1210-
void drawRectangleInPixels(int x, int y, int width, int height) {
12111172
checkGC(DRAW);
12121173
if (width < 0) {
12131174
x = x + width;
@@ -1241,7 +1202,7 @@ void drawRectangleInPixels(int x, int y, int width, int height) {
12411202
*/
12421203
public void drawRectangle(Rectangle rect) {
12431204
if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
1244-
drawRectangleInPixels(rect.x, rect.y, rect.width, rect.height);
1205+
drawRectangle(rect.x, rect.y, rect.width, rect.height);
12451206
}
12461207
/**
12471208
* Draws the outline of the round-cornered rectangle specified by
@@ -1266,9 +1227,6 @@ public void drawRectangle(Rectangle rect) {
12661227
*/
12671228
public void drawRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) {
12681229
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
1269-
drawRoundRectangleInPixels(x, y, width, height, arcWidth, arcHeight);
1270-
}
1271-
void drawRoundRectangleInPixels(int x, int y, int width, int height, int arcWidth, int arcHeight) {
12721230
checkGC(DRAW);
12731231
int nx = x;
12741232
int ny = y;
@@ -1337,9 +1295,6 @@ public void drawString (String string, int x, int y) {
13371295
drawString (string, x, y, false);
13381296
}
13391297

1340-
void drawStringInPixels (String string, int x, int y) {
1341-
drawStringInPixels(string, x, y, false);
1342-
}
13431298
/**
13441299
* Draws the given string, using the receiver's current font and
13451300
* foreground color. No tab expansion or carriage return processing
@@ -1368,13 +1323,7 @@ void drawStringInPixels (String string, int x, int y) {
13681323
* </ul>
13691324
*/
13701325
public void drawString(String string, int x, int y, boolean isTransparent) {
1371-
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
1372-
if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
1373-
drawStringInPixels(string, x, y, isTransparent);
1374-
}
1375-
1376-
void drawStringInPixels(String string, int x, int y, boolean isTransparent) {
1377-
drawTextInPixels(string, x, y, isTransparent ? SWT.DRAW_TRANSPARENT : 0);
1326+
drawText(string, x, y, isTransparent ? SWT.DRAW_TRANSPARENT : 0);
13781327
}
13791328

13801329
/**
@@ -1402,9 +1351,6 @@ void drawStringInPixels(String string, int x, int y, boolean isTransparent) {
14021351
public void drawText(String string, int x, int y) {
14031352
drawText(string, x, y, SWT.DRAW_DELIMITER | SWT.DRAW_TAB);
14041353
}
1405-
void drawTextInPixels(String string, int x, int y) {
1406-
drawTextInPixels(string, x, y, SWT.DRAW_DELIMITER | SWT.DRAW_TAB);
1407-
}
14081354

14091355
/**
14101356
* Draws the given string, using the receiver's current font and
@@ -1431,12 +1377,9 @@ void drawTextInPixels(String string, int x, int y) {
14311377
* </ul>
14321378
*/
14331379
public void drawText(String string, int x, int y, boolean isTransparent) {
1434-
drawTextInPixels(string, x, y, isTransparent);
1435-
}
1436-
void drawTextInPixels(String string, int x, int y, boolean isTransparent) {
14371380
int flags = SWT.DRAW_DELIMITER | SWT.DRAW_TAB;
14381381
if (isTransparent) flags |= SWT.DRAW_TRANSPARENT;
1439-
drawTextInPixels(string, x, y, flags);
1382+
drawText(string, x, y, flags);
14401383
}
14411384

14421385
/**
@@ -1479,9 +1422,6 @@ void drawTextInPixels(String string, int x, int y, boolean isTransparent) {
14791422
* </ul>
14801423
*/
14811424
public void drawText (String string, int x, int y, int flags) {
1482-
drawTextInPixels(string, x, y, flags);
1483-
}
1484-
void drawTextInPixels (String string, int x, int y, int flags) {
14851425
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
14861426
if (string == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
14871427
if (string.length() == 0) return;
@@ -1564,9 +1504,6 @@ public boolean equals(Object object) {
15641504
*/
15651505
public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
15661506
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
1567-
fillArcInPixels(x, y, width, height, startAngle, arcAngle);
1568-
}
1569-
void fillArcInPixels(int x, int y, int width, int height, int startAngle, int arcAngle) {
15701507
checkGC(FILL);
15711508
if (width < 0) {
15721509
x = x + width;
@@ -1622,10 +1559,6 @@ void fillArcInPixels(int x, int y, int width, int height, int startAngle, int ar
16221559
*/
16231560
public void fillGradientRectangle(int x, int y, int width, int height, boolean vertical) {
16241561
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
1625-
fillGradientRectangleInPixels(x, y, width, height, vertical);
1626-
}
1627-
1628-
void fillGradientRectangleInPixels(int x, int y, int width, int height, boolean vertical) {
16291562
if ((width == 0) || (height == 0)) return;
16301563

16311564
/* Rewrite this to use GdkPixbuf */
@@ -1666,7 +1599,7 @@ void fillGradientRectangleInPixels(int x, int y, int width, int height, boolean
16661599
}
16671600

16681601
if (fromRGB.equals(toRGB)) {
1669-
fillRectangleInPixels(x, y, width, height);
1602+
fillRectangle(x, y, width, height);
16701603
return;
16711604
}
16721605

@@ -1705,9 +1638,6 @@ void fillGradientRectangleInPixels(int x, int y, int width, int height, boolean
17051638
*/
17061639
public void fillOval(int x, int y, int width, int height) {
17071640
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
1708-
fillOvalInPixels(x, y, width, height);
1709-
}
1710-
void fillOvalInPixels(int x, int y, int width, int height) {
17111641
checkGC(FILL);
17121642
if (width < 0) {
17131643
x = x + width;
@@ -1789,10 +1719,6 @@ public void fillPath (Path path) {
17891719
public void fillPolygon(int[] pointArray) {
17901720
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
17911721
if (pointArray == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
1792-
int [] scaledPointArray = pointArray;
1793-
fillPolygonInPixels(scaledPointArray);
1794-
}
1795-
void fillPolygonInPixels(int[] pointArray) {
17961722
checkGC(FILL);
17971723
long cairo = data.cairo;
17981724
drawPolyline(cairo, pointArray, 0, 0, true);
@@ -1816,9 +1742,6 @@ void fillPolygonInPixels(int[] pointArray) {
18161742
*/
18171743
public void fillRectangle(int x, int y, int width, int height) {
18181744
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
1819-
fillRectangleInPixels(x, y, width, height);
1820-
}
1821-
void fillRectangleInPixels(int x, int y, int width, int height) {
18221745
checkGC(FILL);
18231746
if (width < 0) {
18241747
x = x + width;
@@ -1853,9 +1776,8 @@ void fillRectangleInPixels(int x, int y, int width, int height) {
18531776
* @see #drawRectangle(int, int, int, int)
18541777
*/
18551778
public void fillRectangle(Rectangle rect) {
1856-
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
18571779
if (rect == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
1858-
fillRectangleInPixels(rect.x, rect.y, rect.width, rect.height);
1780+
fillRectangle(rect.x, rect.y, rect.width, rect.height);
18591781
}
18601782

18611783
/**
@@ -1877,9 +1799,6 @@ public void fillRectangle(Rectangle rect) {
18771799
*/
18781800
public void fillRoundRectangle(int x, int y, int width, int height, int arcWidth, int arcHeight) {
18791801
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
1880-
fillRoundRectangleInPixels(x, y, width, height, arcWidth, arcHeight);
1881-
}
1882-
void fillRoundRectangleInPixels(int x, int y, int width, int height, int arcWidth, int arcHeight) {
18831802
checkGC(FILL);
18841803
int nx = x;
18851804
int ny = y;
@@ -2100,9 +2019,6 @@ public int getCharWidth(char ch) {
21002019
*/
21012020
public Rectangle getClipping() {
21022021
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
2103-
return getClippingInPixels();
2104-
}
2105-
Rectangle getClippingInPixels() {
21062022
/* Calculate visible bounds in device space */
21072023
int x = 0, y = 0, width = 0, height = 0;
21082024
int[] w = new int[1], h = new int[1];
@@ -2377,11 +2293,6 @@ public int getInterpolation() {
23772293
*/
23782294
public LineAttributes getLineAttributes() {
23792295
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
2380-
LineAttributes attributes = getLineAttributesInPixels();
2381-
attributes.width = attributes.width;
2382-
return attributes;
2383-
}
2384-
LineAttributes getLineAttributesInPixels() {
23852296
float[] dashes = null;
23862297
if (data.lineDashes != null) {
23872298
dashes = new float[data.lineDashes.length];
@@ -2479,9 +2390,6 @@ public int getLineStyle() {
24792390
*/
24802391
public int getLineWidth() {
24812392
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
2482-
return getLineWidthInPixels();
2483-
}
2484-
int getLineWidthInPixels() {
24852393
return (int)data.lineWidth;
24862394
}
24872395

@@ -3138,9 +3046,6 @@ void setClipping(long clipRgn) {
31383046
*/
31393047
public void setClipping(int x, int y, int width, int height) {
31403048
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
3141-
setClippingInPixels(x, y, width, height);
3142-
}
3143-
void setClippingInPixels(int x, int y, int width, int height) {
31443049
if (width < 0) {
31453050
x = x + width;
31463051
width = -width;
@@ -3216,13 +3121,10 @@ public void setClipping(Path path) {
32163121
*/
32173122
public void setClipping(Rectangle rect) {
32183123
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
3219-
setClippingInPixels(rect);
3220-
}
3221-
void setClippingInPixels(Rectangle rect) {
32223124
if (rect == null) {
32233125
resetClipping();
32243126
} else {
3225-
setClippingInPixels(rect.x, rect.y, rect.width, rect.height);
3127+
setClipping(rect.x, rect.y, rect.width, rect.height);
32263128
}
32273129
}
32283130

@@ -3441,10 +3343,6 @@ public void setInterpolation(int interpolation) {
34413343
public void setLineAttributes(LineAttributes attributes) {
34423344
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
34433345
if (attributes == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
3444-
attributes.width = attributes.width;
3445-
setLineAttributesInPixels(attributes);
3446-
}
3447-
void setLineAttributesInPixels(LineAttributes attributes) {
34483346
int mask = 0;
34493347
float lineWidth = attributes.width;
34503348
if (lineWidth != data.lineWidth) {
@@ -3695,9 +3593,6 @@ public void setLineStyle(int lineStyle) {
36953593
*/
36963594
public void setLineWidth(int lineWidth) {
36973595
if (handle == 0) SWT.error(SWT.ERROR_GRAPHIC_DISPOSED);
3698-
setLineWidthInPixels(lineWidth);
3699-
}
3700-
void setLineWidthInPixels(int lineWidth) {
37013596
if (data.lineWidth == lineWidth) return;
37023597
data.lineWidth = lineWidth;
37033598
data.state &= ~(LINE_WIDTH | DRAW_OFFSET);
@@ -3879,7 +3774,7 @@ public void setXORMode(boolean xor) {
38793774
* </ul>
38803775
*/
38813776
public Point stringExtent(String string) {
3882-
return stringExtentInPixels(string);
3777+
return textExtentInPixels(string, 0);
38833778
}
38843779
Point stringExtentInPixels(String string) {
38853780
return textExtentInPixels(string, 0);
@@ -3905,10 +3800,6 @@ Point stringExtentInPixels(String string) {
39053800
* </ul>
39063801
*/
39073802
public Point textExtent(String string) {
3908-
return textExtentInPixels(string);
3909-
}
3910-
3911-
Point textExtentInPixels(String string) {
39123803
return textExtentInPixels(string, SWT.DRAW_DELIMITER | SWT.DRAW_TAB);
39133804
}
39143805

0 commit comments

Comments
 (0)