@@ -33,16 +33,6 @@ public class CTabFolderRenderer {
3333 protected CTabFolder parent ;
3434
3535 Color fillColor ;
36- /* Selected item appearance */
37- /* Colors for anti-aliasing */
38- Color selectedOuterColor = null ;
39- Color selectedInnerColor = null ;
40- Color tabAreaColor = null ;
41- /*
42- * Border color that was used in computing the cached anti-alias Colors.
43- * We have to recompute the colors if the border color changes
44- */
45- Color lastBorderColor = null ;
4636
4737 private Font chevronFont = null ;
4838
@@ -163,9 +153,6 @@ protected CTabFolderRenderer(CTabFolder parent) {
163153 this .parent = parent ;
164154 }
165155
166- void antialias (int [] shape , Color innerColor , Color outerColor , GC gc ){
167- }
168-
169156 /**
170157 * Returns the preferred size of a part.
171158 * <p>
@@ -255,14 +242,9 @@ protected Point computeSize (int part, int state, GC gc, int wHint, int hHint) {
255242 int minChars = parent .minChars ;
256243 text = minChars == 0 ? null : item .getText ();
257244 if (text != null && text .length () > minChars ) {
258- if (useEllipses ()) {
259- int end = minChars < ELLIPSIS .length () + 1 ? minChars : minChars - ELLIPSIS .length ();
260- text = text .substring (0 , end );
261- if (minChars > ELLIPSIS .length () + 1 ) text += ELLIPSIS ;
262- } else {
263- int end = minChars ;
264- text = text .substring (0 , end );
265- }
245+ int end = minChars < ELLIPSIS .length () + 1 ? minChars : minChars - ELLIPSIS .length ();
246+ text = text .substring (0 , end );
247+ if (minChars > ELLIPSIS .length () + 1 ) text += ELLIPSIS ;
266248 }
267249 } else {
268250 text = item .getText ();
@@ -404,48 +386,6 @@ protected Rectangle computeTrim (int part, int state, int x, int y, int width, i
404386 return new Rectangle (x , y , width , height );
405387 }
406388
407- void createAntialiasColors () {
408- disposeAntialiasColors ();
409- lastBorderColor = parent .getDisplay ().getSystemColor (BORDER1_COLOR );
410- RGB lineRGB = lastBorderColor .getRGB ();
411- /* compute the selected color */
412- RGB innerRGB = parent .selectionBackground .getRGB ();
413- if (parent .selectionBgImage != null ||
414- (parent .selectionGradientColors != null && parent .selectionGradientColors .length > 1 )) {
415- innerRGB = null ;
416- }
417- RGB outerRGB = parent .getBackground ().getRGB ();
418- if (parent .gradientColors != null && parent .gradientColors .length > 1 ) {
419- outerRGB = null ;
420- }
421- if (outerRGB != null ) {
422- RGB from = lineRGB ;
423- RGB to = outerRGB ;
424- int red = from .red + 2 *(to .red - from .red )/3 ;
425- int green = from .green + 2 *(to .green - from .green )/3 ;
426- int blue = from .blue + 2 *(to .blue - from .blue )/3 ;
427- selectedOuterColor = new Color (red , green , blue );
428- }
429- if (innerRGB != null ) {
430- RGB from = lineRGB ;
431- RGB to = innerRGB ;
432- int red = from .red + 2 *(to .red - from .red )/3 ;
433- int green = from .green + 2 *(to .green - from .green )/3 ;
434- int blue = from .blue + 2 *(to .blue - from .blue )/3 ;
435- selectedInnerColor = new Color (red , green , blue );
436- }
437- /* compute the tabArea color */
438- outerRGB = parent .getParent ().getBackground ().getRGB ();
439- if (outerRGB != null ) {
440- RGB from = lineRGB ;
441- RGB to = outerRGB ;
442- int red = from .red + 2 *(to .red - from .red )/3 ;
443- int green = from .green + 2 *(to .green - from .green )/3 ;
444- int blue = from .blue + 2 *(to .blue - from .blue )/3 ;
445- tabAreaColor = new Color (red , green , blue );
446- }
447- }
448-
449389 /**
450390 * Dispose of any operating system resources associated with
451391 * the renderer. Called by the CTabFolder parent upon receiving
@@ -454,8 +394,6 @@ void createAntialiasColors() {
454394 * @since 3.6
455395 */
456396 protected void dispose () {
457- disposeAntialiasColors ();
458-
459397 fillColor = null ;
460398
461399 if (chevronFont != null ) {
@@ -464,10 +402,6 @@ protected void dispose() {
464402 }
465403 }
466404
467- void disposeAntialiasColors () {
468- tabAreaColor = selectedInnerColor = selectedOuterColor = null ;
469- }
470-
471405 /**
472406 * Draw a specified <code>part</code> of the CTabFolder using the provided <code>bounds</code> and <code>GC</code>.
473407 * <p>The valid CTabFolder <code>part</code> constants are:
@@ -1188,8 +1122,6 @@ void drawSelected(int itemIndex, GC gc, Rectangle bounds, int state ) {
11881122 if (shape [2 *i + 1 ] == y + height + 1 ) shape [2 *i + 1 ] -= 1 ;
11891123 }
11901124 Color borderColor = parent .getDisplay ().getSystemColor (BORDER1_COLOR );
1191- if (! borderColor .equals (lastBorderColor )) createAntialiasColors ();
1192- antialias (shape , selectedInnerColor , selectedOuterColor , gc );
11931125 gc .setForeground (borderColor );
11941126 gc .drawPolyline (shape );
11951127
@@ -1384,8 +1316,6 @@ void drawTabArea(GC gc, Rectangle bounds, int state) {
13841316
13851317 // Draw border line
13861318 if (borderLeft > 0 ) {
1387- if (! borderColor .equals (lastBorderColor )) createAntialiasColors ();
1388- antialias (shape , null , tabAreaColor , gc );
13891319 gc .setForeground (borderColor );
13901320 gc .drawPolyline (shape );
13911321 }
@@ -1495,9 +1425,7 @@ void resetChevronFont() {
14951425 }
14961426
14971427 String shortenText (GC gc , String text , int width ) {
1498- return useEllipses ()
1499- ? shortenText (gc , text , width , ELLIPSIS )
1500- : shortenText (gc , text , width , "" ); //$NON-NLS-1$
1428+ return shortenText (gc , text , width , ELLIPSIS );
15011429 }
15021430
15031431 String shortenText (GC gc , String text , int width , String ellipses ) {
@@ -1519,11 +1447,4 @@ String shortenText(GC gc, String text, int width, String ellipses) {
15191447 return end == 0 ? text .substring (0 , 1 ) : text + ellipses ;
15201448 }
15211449
1522- /*
1523- * Return whether to use ellipses or just truncate labels
1524- */
1525- boolean useEllipses () {
1526- return true ;
1527- }
1528-
15291450}
0 commit comments