@@ -107,9 +107,9 @@ public FontMetrics getFixedLineMetrics(Device device) {
107107 }
108108
109109 FontMetrics result = new FontMetrics ();
110- result .ascentInPoints = DPIUtil . autoScaleDown ( device , lineMetricsInPixels .ascentInPoints ) ;
111- result .descentInPoints = DPIUtil . autoScaleDown ( device , lineMetricsInPixels .descentInPoints ) ;
112- result .averageCharWidthInPoints = DPIUtil . autoScaleDown ( device , lineMetricsInPixels .averageCharWidthInPoints ) ;
110+ result .ascentInPoints = lineMetricsInPixels .ascentInPoints ;
111+ result .descentInPoints = lineMetricsInPixels .descentInPoints ;
112+ result .averageCharWidthInPoints =lineMetricsInPixels .averageCharWidthInPoints ;
113113
114114 return result ;
115115 }
@@ -121,9 +121,9 @@ public void setFixedLineMetrics(Device device, FontMetrics metrics) {
121121 }
122122
123123 FontMetrics result = new FontMetrics ();
124- result .ascentInPoints = DPIUtil . autoScaleUp ( device , metrics .ascentInPoints ) ;
125- result .descentInPoints = DPIUtil . autoScaleUp ( device , metrics .descentInPoints ) ;
126- result .averageCharWidthInPoints = DPIUtil . autoScaleUp ( device , metrics .averageCharWidthInPoints ) ;
124+ result .ascentInPoints = metrics .ascentInPoints ;
125+ result .descentInPoints = metrics .descentInPoints ;
126+ result .averageCharWidthInPoints = metrics .averageCharWidthInPoints ;
127127
128128 lineMetricsInPixels = result ;
129129 }
@@ -296,8 +296,8 @@ void computeRuns () {
296296 boolean useMinAscentDescent = !metricsAdapter .isFixedMetrics () && (ascentInPoints != -1 || descentInPoints != -1 );
297297 if (useMinAscentDescent && segementsLength > 0 ) {
298298 PangoRectangle rect = new PangoRectangle ();
299- if (ascentInPoints != -1 ) rect .y = -(DPIUtil . autoScaleUp ( getDevice (), ascentInPoints ) * OS .PANGO_SCALE );
300- rect .height = DPIUtil . autoScaleUp ( getDevice (), ( Math .max (0 , ascentInPoints ) + Math .max (0 , descentInPoints ) )) * OS .PANGO_SCALE ;
299+ if (ascentInPoints != -1 ) rect .y = -(ascentInPoints * OS .PANGO_SCALE );
300+ rect .height = ( Math .max (0 , ascentInPoints ) + Math .max (0 , descentInPoints )) * OS .PANGO_SCALE ;
301301 int lineCount = OS .pango_layout_get_line_count (layout );
302302 chars = new char [segementsLength + lineCount * 2 ];
303303 lineOffsets = new int [lineCount ];
@@ -481,9 +481,9 @@ void computeRuns () {
481481 GlyphMetrics metrics = style .metrics ;
482482 if (metrics != null ) {
483483 PangoRectangle rect = new PangoRectangle ();
484- rect .y = -(DPIUtil . autoScaleUp ( getDevice (), metrics .ascent ) * OS .PANGO_SCALE );
485- rect .height = DPIUtil . autoScaleUp ( getDevice (), ( metrics .ascent + metrics .descent ) ) * OS .PANGO_SCALE ;
486- rect .width = DPIUtil . autoScaleUp ( getDevice (), metrics .width ) * OS .PANGO_SCALE ;
484+ rect .y = -(metrics .ascent * OS .PANGO_SCALE );
485+ rect .height = ( metrics .ascent + metrics .descent ) * OS .PANGO_SCALE ;
486+ rect .width = metrics .width * OS .PANGO_SCALE ;
487487 long attr = OS .pango_attr_shape_new (rect , rect );
488488 OS .memmove (attribute , attr , PangoAttribute .sizeof );
489489 attribute .start_index = byteStart ;
@@ -494,7 +494,7 @@ void computeRuns () {
494494 }
495495 int rise = style .rise ;
496496 if (rise != 0 ) {
497- long attr = OS .pango_attr_rise_new (DPIUtil . autoScaleUp ( getDevice (), rise ) * OS .PANGO_SCALE );
497+ long attr = OS .pango_attr_rise_new (rise * OS .PANGO_SCALE );
498498 OS .memmove (attribute , attr , PangoAttribute .sizeof );
499499 attribute .start_index = byteStart ;
500500 attribute .end_index = byteEnd ;
@@ -559,8 +559,6 @@ void destroy() {
559559 * </ul>
560560 */
561561public void draw (GC gc , int x , int y ) {
562- x = DPIUtil .autoScaleUp (getDevice (), x );
563- y = DPIUtil .autoScaleUp (getDevice (), y );
564562 drawInPixels (gc , x , y );
565563}
566564
@@ -589,8 +587,6 @@ void drawInPixels(GC gc, int x, int y) {
589587 */
590588public void draw (GC gc , int x , int y , int selectionStart , int selectionEnd , Color selectionForeground , Color selectionBackground ) {
591589 checkLayout ();
592- x = DPIUtil .autoScaleUp (getDevice (), x );
593- y = DPIUtil .autoScaleUp (getDevice (), y );
594590 drawInPixels (gc , x , y , selectionStart , selectionEnd , selectionForeground , selectionBackground );
595591}
596592void drawInPixels (GC gc , int x , int y , int selectionStart , int selectionEnd , Color selectionForeground , Color selectionBackground ) {
@@ -626,8 +622,6 @@ void drawInPixels(GC gc, int x, int y, int selectionStart, int selectionEnd, Col
626622 */
627623public void draw (GC gc , int x , int y , int selectionStart , int selectionEnd , Color selectionForeground , Color selectionBackground , int flags ) {
628624 checkLayout ();
629- x = DPIUtil .autoScaleUp (getDevice (), x );
630- y = DPIUtil .autoScaleUp (getDevice (), y );
631625 drawInPixels (gc , x , y , selectionStart , selectionEnd , selectionForeground , selectionBackground , flags );
632626}
633627void drawInPixels (GC gc , int x , int y , int selectionStart , int selectionEnd , Color selectionForeground , Color selectionBackground , int flags ) {
@@ -685,7 +679,7 @@ void drawInPixels(GC gc, int x, int y, int selectionStart, int selectionEnd, Col
685679 int lineY = y + OS .PANGO_PIXELS (rect .y );
686680 int height = OS .PANGO_PIXELS (rect .height );
687681 if (ascentInPoints != -1 && descentInPoints != -1 ) {
688- height = Math .max (height , DPIUtil . autoScaleUp ( getDevice (), ascentInPoints + descentInPoints ) );
682+ height = Math .max (height , ascentInPoints + descentInPoints );
689683 }
690684 height += getSpacingInPixels ();
691685 int width = (flags & SWT .FULL_SELECTION ) != 0 ? 0x7fff : height / 3 ;
@@ -918,7 +912,7 @@ public int getAscent () {
918912 */
919913public Rectangle getBounds () {
920914 int spacingInPixels = getSpacingInPixels ();
921- return DPIUtil . autoScaleDown ( getDevice (), getBoundsInPixels (spacingInPixels ) );
915+ return getBoundsInPixels (spacingInPixels );
922916}
923917
924918Rectangle getBoundsInPixels (int spacingInPixels ) {
@@ -931,7 +925,7 @@ Rectangle getBoundsInPixels(int spacingInPixels) {
931925 int width = OS .PANGO_PIXELS (w [0 ]);
932926 int height = OS .PANGO_PIXELS (h [0 ]);
933927 if (ascentInPoints != -1 && descentInPoints != -1 ) {
934- height = Math .max (height , DPIUtil . autoScaleUp ( getDevice (), ascentInPoints + descentInPoints ) );
928+ height = Math .max (height , ascentInPoints + descentInPoints );
935929 }
936930 height += spacingInPixels ;
937931 return new Rectangle (0 , 0 , width , height + getScaledVerticalIndent ());
@@ -953,7 +947,7 @@ Rectangle getBoundsInPixels(int spacingInPixels) {
953947 */
954948public Rectangle getBounds (int start , int end ) {
955949 checkLayout ();
956- return DPIUtil . autoScaleDown ( getDevice (), getBoundsInPixels (start , end ) );
950+ return getBoundsInPixels (start , end );
957951}
958952
959953Rectangle getBoundsInPixels (int start , int end ) {
@@ -1059,7 +1053,7 @@ public Font getFont () {
10591053*/
10601054public int getIndent () {
10611055 checkLayout ();
1062- return DPIUtil . autoScaleDown ( getDevice (), getIndentInPixels () );
1056+ return getIndentInPixels ();
10631057}
10641058
10651059int getIndentInPixels () {
@@ -1141,7 +1135,7 @@ public int getLevel(int offset) {
11411135 */
11421136public Rectangle getLineBounds (int lineIndex ) {
11431137 checkLayout ();
1144- return DPIUtil . autoScaleDown ( getDevice (), getLineBoundsInPixels (lineIndex ) );
1138+ return getLineBoundsInPixels (lineIndex );
11451139}
11461140
11471141Rectangle getLineBoundsInPixels (int lineIndex ) {
@@ -1166,7 +1160,7 @@ private Rectangle getLineBoundsInPixels(int lineIndex, long iter) {
11661160 int width = OS .PANGO_PIXELS (rect .width );
11671161 int height = OS .PANGO_PIXELS (rect .height );
11681162 if (ascentInPoints != -1 && descentInPoints != -1 ) {
1169- height = Math .max (height , DPIUtil . autoScaleUp ( getDevice (), ascentInPoints + descentInPoints ) );
1163+ height = Math .max (height , ascentInPoints + descentInPoints );
11701164 }
11711165 x += Math .min (indent , wrapIndent );
11721166 return new Rectangle (x , y , width , height );
@@ -1255,14 +1249,14 @@ public FontMetrics getLineMetrics (int lineIndex) {
12551249 long metrics = OS .pango_context_get_metrics (context , font , lang );
12561250 int ascent = OS .pango_font_metrics_get_ascent (metrics );
12571251 int descent = OS .pango_font_metrics_get_descent (metrics );
1258- ascentInPoints = DPIUtil . autoScaleDown ( getDevice (), OS .PANGO_PIXELS (ascent ) );
1259- heightInPoints = DPIUtil . autoScaleDown ( getDevice (), OS .PANGO_PIXELS (ascent + descent ) );
1252+ ascentInPoints = OS .PANGO_PIXELS (ascent );
1253+ heightInPoints = OS .PANGO_PIXELS (ascent + descent );
12601254 OS .pango_font_metrics_unref (metrics );
12611255 } else {
12621256 PangoRectangle rect = new PangoRectangle ();
12631257 metricsAdapter .pango_layout_line_get_extents (OS .pango_layout_get_line (layout , lineIndex ), null , rect );
1264- ascentInPoints = DPIUtil . autoScaleDown ( getDevice (), OS .PANGO_PIXELS (-rect .y ) );
1265- heightInPoints = DPIUtil . autoScaleDown ( getDevice (), OS .PANGO_PIXELS (rect .height ) );
1258+ ascentInPoints = OS .PANGO_PIXELS (-rect .y );
1259+ heightInPoints = OS .PANGO_PIXELS (rect .height );
12661260 }
12671261 heightInPoints = Math .max (this .ascentInPoints + this .descentInPoints , heightInPoints );
12681262 ascentInPoints = Math .max (this .ascentInPoints , ascentInPoints );
@@ -1320,7 +1314,7 @@ public int[] getLineOffsets() {
13201314 */
13211315public Point getLocation (int offset , boolean trailing ) {
13221316 checkLayout ();
1323- return DPIUtil . autoScaleDown ( getDevice (), getLocationInPixels (offset , trailing ) );
1317+ return getLocationInPixels (offset , trailing );
13241318}
13251319
13261320Point getLocationInPixels (int offset , boolean trailing ) {
@@ -1459,7 +1453,7 @@ int _getOffset (int offset, int movement, boolean forward) {
14591453 */
14601454public int getOffset (Point point , int [] trailing ) {
14611455 checkLayout ();
1462- return getOffsetInPixels (DPIUtil . autoScaleUp ( getDevice (), point ) , trailing );
1456+ return getOffsetInPixels (point , trailing );
14631457}
14641458
14651459int getOffsetInPixels (Point point , int [] trailing ) {
@@ -1685,7 +1679,7 @@ String getSegmentsText() {
16851679 */
16861680public int getSpacing () {
16871681 checkLayout ();
1688- return DPIUtil . autoScaleDown ( getDevice (), getSpacingInPixels () );
1682+ return getSpacingInPixels ();
16891683}
16901684
16911685int getSpacingInPixels () {
@@ -1717,7 +1711,7 @@ private int getScaledVerticalIndent() {
17171711 if (verticalIndentInPoints == 0 ) {
17181712 return verticalIndentInPoints ;
17191713 }
1720- return DPIUtil . autoScaleUp ( getDevice (), verticalIndentInPoints ) ;
1714+ return verticalIndentInPoints ;
17211715}
17221716
17231717/**
@@ -1787,7 +1781,7 @@ public TextStyle[] getStyles () {
17871781 */
17881782public int [] getTabs () {
17891783 checkLayout ();
1790- return DPIUtil . autoScaleDown ( getDevice (), getTabsInPixels () );
1784+ return getTabsInPixels ();
17911785}
17921786
17931787int [] getTabsInPixels () {
@@ -1834,7 +1828,7 @@ public int getTextDirection () {
18341828 */
18351829public int getWidth () {
18361830 checkLayout ();
1837- return DPIUtil . autoScaleDown ( getDevice (), getWidthInPixels () );
1831+ return getWidthInPixels ();
18381832}
18391833
18401834int getWidthInPixels () {
@@ -1854,7 +1848,7 @@ int getWidthInPixels () {
18541848*/
18551849public int getWrapIndent () {
18561850 checkLayout ();
1857- return DPIUtil . autoScaleDown ( getDevice (), getWrapIndentInPixels () );
1851+ return getWrapIndentInPixels ();
18581852}
18591853int getWrapIndentInPixels () {
18601854 return wrapIndent ;
@@ -2042,7 +2036,7 @@ public void setFont (Font font) {
20422036 */
20432037public void setIndent (int indent ) {
20442038 checkLayout ();
2045- setIndentInPixels (DPIUtil . autoScaleUp ( getDevice (), indent ) );
2039+ setIndentInPixels (indent );
20462040}
20472041
20482042void setIndentInPixels (int indent ) {
@@ -2115,7 +2109,7 @@ public void setOrientation(int orientation) {
21152109public void setSpacing (int spacing ) {
21162110 checkLayout ();
21172111 if (spacing < 0 ) SWT .error (SWT .ERROR_INVALID_ARGUMENT );
2118- setSpacingInPixels (DPIUtil . autoScaleUp ( getDevice (), spacing ) );
2112+ setSpacingInPixels (spacing );
21192113}
21202114
21212115void setSpacingInPixels (int spacing ) {
@@ -2338,7 +2332,7 @@ public void setStyle (TextStyle style, int start, int end) {
23382332public void setTabs (int [] tabs ) {
23392333 checkLayout ();
23402334 if (this .tabs == null && tabs == null ) return ;
2341- setTabsInPixels (DPIUtil . autoScaleUp ( getDevice (), tabs ) );
2335+ setTabsInPixels (tabs );
23422336}
23432337
23442338void setTabsInPixels (int [] tabs ) {
@@ -2434,7 +2428,7 @@ public void setTextDirection (int textDirection) {
24342428public void setWidth (int width ) {
24352429 checkLayout ();
24362430 if (width < -1 || width == 0 ) SWT .error (SWT .ERROR_INVALID_ARGUMENT );
2437- setWidthInPixels (DPIUtil . autoScaleUp ( getDevice (), width ) );
2431+ setWidthInPixels (width );
24382432}
24392433
24402434void setWidthInPixels (int width ) {
@@ -2472,7 +2466,7 @@ void setWidth () {
24722466public void setWrapIndent (int wrapIndent ) {
24732467 checkLayout ();
24742468 if (wrapIndent < 0 ) return ;
2475- setWrapIndentInPixels (DPIUtil . autoScaleUp ( getDevice (), wrapIndent ) );
2469+ setWrapIndentInPixels (wrapIndent );
24762470}
24772471
24782472void setWrapIndentInPixels (int wrapIndent ) {
0 commit comments