@@ -559,11 +559,7 @@ void destroy() {
559559 * </ul>
560560 */
561561public void draw (GC gc , int x , int y ) {
562- drawInPixels (gc , x , y );
563- }
564-
565- void drawInPixels (GC gc , int x , int y ) {
566- drawInPixels (gc , x , y , -1 , -1 , null , null );
562+ drawInPixels (gc , x , y , -1 , -1 , null , null , 0 );
567563}
568564
569565/**
@@ -587,9 +583,6 @@ void drawInPixels(GC gc, int x, int y) {
587583 */
588584public void draw (GC gc , int x , int y , int selectionStart , int selectionEnd , Color selectionForeground , Color selectionBackground ) {
589585 checkLayout ();
590- drawInPixels (gc , x , y , selectionStart , selectionEnd , selectionForeground , selectionBackground );
591- }
592- void drawInPixels (GC gc , int x , int y , int selectionStart , int selectionEnd , Color selectionForeground , Color selectionBackground ) {
593586 drawInPixels (gc , x , y , selectionStart , selectionEnd , selectionForeground , selectionBackground , 0 );
594587}
595588
@@ -681,7 +674,7 @@ void drawInPixels(GC gc, int x, int y, int selectionStart, int selectionEnd, Col
681674 if (ascentInPoints != -1 && descentInPoints != -1 ) {
682675 height = Math .max (height , ascentInPoints + descentInPoints );
683676 }
684- height += getSpacingInPixels ( );
677+ height += OS . PANGO_PIXELS ( OS . pango_layout_get_spacing ( layout ) );
685678 int width = (flags & SWT .FULL_SELECTION ) != 0 ? 0x7fff : height / 3 ;
686679 Cairo .cairo_rectangle (cairo , lineX , lineY , width , height );
687680 Cairo .cairo_fill (cairo );
@@ -712,7 +705,7 @@ void drawInPixels(GC gc, int x, int y, int selectionStart, int selectionEnd, Col
712705 selectionEnd = translateOffset (selectionEnd );
713706 if (selectionForeground == null ) selectionForeground = device .getSystemColor (SWT .COLOR_LIST_SELECTION_TEXT );
714707 if (selectionBackground == null ) selectionBackground = device .getSystemColor (SWT .COLOR_LIST_SELECTION );
715- int yExtent = extent ? getSpacingInPixels ( ) : 0 ;
708+ int yExtent = extent ? OS . PANGO_PIXELS ( OS . pango_layout_get_spacing ( layout ) ) : 0 ;
716709 boolean fullSelection = selectionStart == 0 && selectionEnd == length - 1 ;
717710 if (fullSelection ) {
718711 long ptr = OS .pango_layout_get_text (layout );
@@ -911,11 +904,7 @@ public int getAscent () {
911904 * @see #getLineBounds(int)
912905 */
913906public Rectangle getBounds () {
914- int spacingInPixels = getSpacingInPixels ();
915- return getBoundsInPixels (spacingInPixels );
916- }
917-
918- Rectangle getBoundsInPixels (int spacingInPixels ) {
907+ int spacingInPixels = OS .PANGO_PIXELS (OS .pango_layout_get_spacing (layout ));
919908 checkLayout ();
920909 computeRuns ();
921910 int [] w = new int [1 ], h = new int [1 ];
@@ -946,11 +935,6 @@ Rectangle getBoundsInPixels(int spacingInPixels) {
946935 * </ul>
947936 */
948937public Rectangle getBounds (int start , int end ) {
949- checkLayout ();
950- return getBoundsInPixels (start , end );
951- }
952-
953- Rectangle getBoundsInPixels (int start , int end ) {
954938 checkLayout ();
955939 computeRuns ();
956940 int length = text .length ();
@@ -1053,10 +1037,6 @@ public Font getFont () {
10531037*/
10541038public int getIndent () {
10551039 checkLayout ();
1056- return getIndentInPixels ();
1057- }
1058-
1059- int getIndentInPixels () {
10601040 return indent ;
10611041}
10621042
@@ -1135,10 +1115,6 @@ public int getLevel(int offset) {
11351115 */
11361116public Rectangle getLineBounds (int lineIndex ) {
11371117 checkLayout ();
1138- return getLineBoundsInPixels (lineIndex );
1139- }
1140-
1141- Rectangle getLineBoundsInPixels (int lineIndex ) {
11421118 computeRuns ();
11431119 int lineCount = OS .pango_layout_get_line_count (layout );
11441120 if (!(0 <= lineIndex && lineIndex < lineCount )) SWT .error (SWT .ERROR_INVALID_RANGE );
@@ -1314,10 +1290,6 @@ public int[] getLineOffsets() {
13141290 */
13151291public Point getLocation (int offset , boolean trailing ) {
13161292 checkLayout ();
1317- return getLocationInPixels (offset , trailing );
1318- }
1319-
1320- Point getLocationInPixels (int offset , boolean trailing ) {
13211293 computeRuns ();
13221294 int length = text .length ();
13231295 if (!(0 <= offset && offset <= length )) SWT .error (SWT .ERROR_INVALID_RANGE );
@@ -1452,8 +1424,7 @@ int _getOffset (int offset, int movement, boolean forward) {
14521424 * @see #getLocation(int, boolean)
14531425 */
14541426public int getOffset (Point point , int [] trailing ) {
1455- checkLayout ();
1456- return getOffsetInPixels (point .x , point .y , trailing );
1427+ return getOffset (point .x , point .y , trailing );
14571428}
14581429
14591430/**
@@ -1481,10 +1452,6 @@ public int getOffset(Point point, int[] trailing) {
14811452 */
14821453public int getOffset (int x , int y , int [] trailing ) {
14831454 checkLayout ();
1484- return getOffsetInPixels (x , y , trailing );
1485- }
1486-
1487- int getOffsetInPixels (int x , int y , int [] trailing ) {
14881455 computeRuns ();
14891456 if (trailing != null && trailing .length < 1 ) SWT .error (SWT .ERROR_INVALID_ARGUMENT );
14901457 x -= Math .min (indent , wrapIndent );
@@ -1674,10 +1641,6 @@ String getSegmentsText() {
16741641 */
16751642public int getSpacing () {
16761643 checkLayout ();
1677- return getSpacingInPixels ();
1678- }
1679-
1680- int getSpacingInPixels () {
16811644 return OS .PANGO_PIXELS (OS .pango_layout_get_spacing (layout ));
16821645}
16831646
@@ -1823,10 +1786,6 @@ public int getTextDirection () {
18231786 */
18241787public int getWidth () {
18251788 checkLayout ();
1826- return getWidthInPixels ();
1827- }
1828-
1829- int getWidthInPixels () {
18301789 return wrapWidth ;
18311790}
18321791
@@ -1843,9 +1802,6 @@ int getWidthInPixels () {
18431802*/
18441803public int getWrapIndent () {
18451804 checkLayout ();
1846- return getWrapIndentInPixels ();
1847- }
1848- int getWrapIndentInPixels () {
18491805 return wrapIndent ;
18501806}
18511807
@@ -2031,11 +1987,6 @@ public void setFont (Font font) {
20311987 */
20321988public void setIndent (int indent ) {
20331989 checkLayout ();
2034- setIndentInPixels (indent );
2035- }
2036-
2037- void setIndentInPixels (int indent ) {
2038- checkLayout ();
20391990 if (indent < 0 ) return ;
20401991 if (this .indent == indent ) return ;
20411992 this .indent = indent ;
@@ -2104,10 +2055,6 @@ public void setOrientation(int orientation) {
21042055public void setSpacing (int spacing ) {
21052056 checkLayout ();
21062057 if (spacing < 0 ) SWT .error (SWT .ERROR_INVALID_ARGUMENT );
2107- setSpacingInPixels (spacing );
2108- }
2109-
2110- void setSpacingInPixels (int spacing ) {
21112058 OS .pango_layout_set_spacing (layout , spacing * OS .PANGO_SCALE );
21122059}
21132060
@@ -2327,10 +2274,6 @@ public void setStyle (TextStyle style, int start, int end) {
23272274public void setTabs (int [] tabs ) {
23282275 checkLayout ();
23292276 if (this .tabs == null && tabs == null ) return ;
2330- setTabsInPixels (tabs );
2331- }
2332-
2333- void setTabsInPixels (int [] tabs ) {
23342277 if (Arrays .equals (this .tabs , tabs )) return ;
23352278 this .tabs = tabs ;
23362279 if (tabs == null ) {
@@ -2423,10 +2366,6 @@ public void setTextDirection (int textDirection) {
24232366public void setWidth (int width ) {
24242367 checkLayout ();
24252368 if (width < -1 || width == 0 ) SWT .error (SWT .ERROR_INVALID_ARGUMENT );
2426- setWidthInPixels (width );
2427- }
2428-
2429- void setWidthInPixels (int width ) {
24302369 if (wrapWidth == width ) return ;
24312370 freeRuns ();
24322371 wrapWidth = width ;
@@ -2461,10 +2400,6 @@ void setWidth () {
24612400public void setWrapIndent (int wrapIndent ) {
24622401 checkLayout ();
24632402 if (wrapIndent < 0 ) return ;
2464- setWrapIndentInPixels (wrapIndent );
2465- }
2466-
2467- void setWrapIndentInPixels (int wrapIndent ) {
24682403 if (this .wrapIndent == wrapIndent ) return ;
24692404 this .wrapIndent = wrapIndent ;
24702405 OS .pango_layout_set_indent (layout , (indent - wrapIndent ) * OS .PANGO_SCALE );
0 commit comments