@@ -36,8 +36,6 @@ public class CTabFolderRenderer {
3636
3737 private Font chevronFont = null ;
3838
39- private static final int [] EMPTY_CORNER = new int [] {0 ,0 };
40-
4139 static final RGB CLOSE_FILL = new RGB (240 , 64 , 64 );
4240
4341 static final int BUTTON_SIZE = 16 ;
@@ -799,33 +797,12 @@ void drawLeftUnselectedBorder(GC gc, Rectangle bounds, int state) {
799797 int y = bounds .y ;
800798 int height = bounds .height ;
801799
802- int [] shape = null ;
800+ gc . setForeground ( parent . getDisplay (). getSystemColor ( BORDER1_COLOR )) ;
803801 if (parent .onBottom ) {
804- int [] left = EMPTY_CORNER ;
805-
806- shape = new int [left .length + 2 ];
807- int index = 0 ;
808- shape [index ++] = x ;
809- shape [index ++] = y - 1 ;
810- for (int i = 0 ; i < left .length / 2 ; i ++) {
811- shape [index ++] = x + left [2 * i ];
812- shape [index ++] = y + height + left [2 * i + 1 ] - 1 ;
813- }
802+ gc .drawLine (x , y - 1 , x , y + height - 1 );
814803 } else {
815- int [] left = EMPTY_CORNER ;
816-
817- shape = new int [left .length + 2 ];
818- int index = 0 ;
819- shape [index ++] = x ;
820- shape [index ++] = y + height ;
821- for (int i = 0 ; i < left .length / 2 ; i ++) {
822- shape [index ++] = x + left [2 * i ];
823- shape [index ++] = y + left [2 * i + 1 ];
824- }
825-
804+ gc .drawLine (x , y + height , x , y );
826805 }
827-
828- drawBorder (gc , shape );
829806 }
830807
831808 void drawMaximize (GC gc , Rectangle maxRect , int maxImageState ) {
@@ -931,44 +908,16 @@ void drawHighlight(GC gc, Rectangle bounds, int state, int rightEdge) {
931908 * Draw the unselected border for the receiver on the right.
932909 */
933910 void drawRightUnselectedBorder (GC gc , Rectangle bounds , int state ) {
934- int x = bounds .x ;
911+ int x = bounds .x + bounds . width - 1 ;
935912 int y = bounds .y ;
936- int width = bounds .width ;
937913 int height = bounds .height ;
938914
939- int [] shape = null ;
940- int startX = x + width - 1 ;
941-
915+ gc .setForeground (parent .getDisplay ().getSystemColor (BORDER1_COLOR ));
942916 if (parent .onBottom ) {
943- int [] right = EMPTY_CORNER ;
944-
945- shape = new int [right .length + 2 ];
946- int index = 0 ;
947-
948- for (int i = 0 ; i < right .length / 2 ; i ++) {
949- shape [index ++] = startX + right [2 * i ];
950- shape [index ++] = y + height + right [2 * i + 1 ] - 1 ;
951- }
952- shape [index ++] = startX ;
953- shape [index ++] = y - 1 ;
917+ gc .drawLine (x , y + height - 1 , x , y - 1 );
954918 } else {
955- int [] right = EMPTY_CORNER ;
956-
957- shape = new int [right .length + 2 ];
958- int index = 0 ;
959-
960- for (int i = 0 ; i < right .length / 2 ; i ++) {
961- shape [index ++] = startX + right [2 * i ];
962- shape [index ++] = y + right [2 * i + 1 ];
963- }
964-
965- shape [index ++] = startX ;
966- shape [index ++] = y + height ;
967-
919+ gc .drawLine (x , y , x , y + height );
968920 }
969-
970- drawBorder (gc , shape );
971-
972921 }
973922
974923 void drawSelected (int itemIndex , GC gc , Rectangle bounds , int state ) {
@@ -1016,52 +965,40 @@ void drawSelected(int itemIndex, GC gc, Rectangle bounds, int state ) {
1016965 }
1017966
1018967 // draw selected tab background and outline
1019- shape = null ;
968+ shape = new int [ 12 ] ;
1020969 if (parent .onBottom ) {
1021- int [] left = EMPTY_CORNER ;
1022- int [] right = EMPTY_CORNER ;
1023- if (borderLeft == 0 && itemIndex == parent .firstIndex ) {
1024- left = new int []{x , y +height };
1025- }
1026- shape = new int [left .length +right .length +8 ];
1027970 int index = 0 ;
1028971 shape [index ++] = x ; // first point repeated here because below we reuse shape to draw outline
1029972 shape [index ++] = y - 1 ;
1030973 shape [index ++] = x ;
1031974 shape [index ++] = y - 1 ;
1032- for (int i = 0 ; i < left .length /2 ; i ++) {
1033- shape [index ++] = x + left [2 *i ];
1034- shape [index ++] = y + height + left [2 *i +1 ] - 1 ;
1035- }
1036- for (int i = 0 ; i < right .length /2 ; i ++) {
1037- shape [index ++] = rightEdge - 1 + right [2 *i ];
1038- shape [index ++] = y + height + right [2 *i +1 ] - 1 ;
975+ shape [index ++] = x ;
976+ shape [index ++] = y + height ;
977+ if (borderLeft == 0 && itemIndex == parent .firstIndex ) {
978+ shape [index - 2 ] += x ;
979+ shape [index - 1 ] += y + height ;
1039980 }
1040981 shape [index ++] = rightEdge - 1 ;
982+ shape [index ++] = y + height - 1 ;
983+ shape [index ++] = rightEdge - 1 ;
1041984 shape [index ++] = y - 1 ;
1042985 shape [index ++] = rightEdge - 1 ;
1043986 shape [index ++] = y - 1 ;
1044987 } else {
1045- int [] left = EMPTY_CORNER ;
1046- int [] right = EMPTY_CORNER ;
1047- if (borderLeft == 0 && itemIndex == parent .firstIndex ) {
1048- left = new int []{x , y };
1049- }
1050- shape = new int [left .length +right .length +8 ];
1051988 int index = 0 ;
1052989 shape [index ++] = x ; // first point repeated here because below we reuse shape to draw outline
1053990 shape [index ++] = y + height + 1 ;
1054991 shape [index ++] = x ;
1055992 shape [index ++] = y + height + 1 ;
1056- for (int i = 0 ; i < left .length /2 ; i ++) {
1057- shape [index ++] = x + left [2 *i ];
1058- shape [index ++] = y + left [2 *i +1 ];
1059- }
1060- for (int i = 0 ; i < right .length /2 ; i ++) {
1061- shape [index ++] = rightEdge - 1 + right [2 *i ];
1062- shape [index ++] = y + right [2 *i +1 ];
993+ shape [index ++] = x ;
994+ shape [index ++] = y ;
995+ if (borderLeft == 0 && itemIndex == parent .firstIndex ) {
996+ shape [index - 2 ] += x ;
997+ shape [index - 1 ] += y ;
1063998 }
1064999 shape [index ++] = rightEdge - 1 ;
1000+ shape [index ++] = y ;
1001+ shape [index ++] = rightEdge - 1 ;
10651002 shape [index ++] = y + height + 1 ;
10661003 shape [index ++] = rightEdge - 1 ;
10671004 shape [index ++] = y + height + 1 ;
@@ -1198,7 +1135,6 @@ private int getLeftTextMargin(CTabItem item) {
11981135
11991136 void drawTabArea (GC gc , Rectangle bounds , int state ) {
12001137 Point size = parent .getSize ();
1201- int [] shape = null ;
12021138 Color borderColor = parent .getDisplay ().getSystemColor (BORDER1_COLOR );
12031139 int tabHeight = parent .tabHeight ;
12041140 int style = parent .getStyle ();
@@ -1218,7 +1154,7 @@ void drawTabArea(GC gc, Rectangle bounds, int state) {
12181154 int y2 = parent .onBottom ? size .y - borderBottom : borderTop ;
12191155 if (borderLeft > 0 && parent .onBottom ) y2 -= 1 ;
12201156
1221- shape = new int [] {x1 , y1 , x1 ,y2 , x2 ,y2 , x2 ,y1 };
1157+ int [] shape = new int [] {x1 , y1 , x1 ,y2 , x2 ,y2 , x2 ,y1 };
12221158
12231159 // If horizontal gradient, show gradient across the whole area
12241160 if (selectedIndex != -1 && parent .selectionGradientColors != null && parent .selectionGradientColors .length > 1 && !parent .selectionGradientVertical ) {
@@ -1242,55 +1178,32 @@ void drawTabArea(GC gc, Rectangle bounds, int state) {
12421178 int y = parent .onBottom ? size .y - borderBottom - tabHeight : borderTop ;
12431179 int width = size .x - borderLeft - borderRight + 1 ;
12441180 int height = tabHeight - 1 ;
1181+ int [] shape = new int [8 ];
12451182 // Draw Tab Header
12461183 if (parent .onBottom ) {
1247- int [] left , right ;
1248- if ((style & SWT .BORDER ) != 0 ) {
1249- left = EMPTY_CORNER ;
1250- right = EMPTY_CORNER ;
1251- } else {
1252- left = EMPTY_CORNER ;
1253- right = EMPTY_CORNER ;
1254- }
1255- shape = new int [left .length + right .length + 4 ];
12561184 int index = 0 ;
12571185 shape [index ++] = x ;
1258- shape [index ++] = y -highlight_header ;
1259- for (int i = 0 ; i < left .length /2 ; i ++) {
1260- shape [index ++] = x +left [2 *i ];
1261- shape [index ++] = y +height +left [2 *i +1 ];
1262- if (borderLeft == 0 ) shape [index -1 ] += 1 ;
1263- }
1264- for (int i = 0 ; i < right .length /2 ; i ++) {
1265- shape [index ++] = x +width +right [2 *i ];
1266- shape [index ++] = y +height +right [2 *i +1 ];
1267- if (borderLeft == 0 ) shape [index -1 ] += 1 ;
1268- }
1269- shape [index ++] = x +width ;
1270- shape [index ++] = y -highlight_header ;
1186+ shape [index ++] = y - highlight_header ;
1187+ shape [index ++] = x ;
1188+ shape [index ++] = y + height ;
1189+ if (borderLeft == 0 )
1190+ shape [index - 1 ] += 1 ;
1191+ shape [index ++] = x + width ;
1192+ shape [index ++] = y + height ;
1193+ if (borderLeft == 0 )
1194+ shape [index - 1 ] += 1 ;
1195+ shape [index ++] = x + width ;
1196+ shape [index ++] = y - highlight_header ;
12711197 } else {
1272- int [] left , right ;
1273- if ((style & SWT .BORDER ) != 0 ) {
1274- left = EMPTY_CORNER ;
1275- right = EMPTY_CORNER ;
1276- } else {
1277- left = EMPTY_CORNER ;
1278- right = EMPTY_CORNER ;
1279- }
1280- shape = new int [left .length + right .length + 4 ];
12811198 int index = 0 ;
12821199 shape [index ++] = x ;
1283- shape [index ++] = y +height +highlight_header + 1 ;
1284- for (int i = 0 ; i < left .length /2 ; i ++) {
1285- shape [index ++] = x +left [2 *i ];
1286- shape [index ++] = y +left [2 *i +1 ];
1287- }
1288- for (int i = 0 ; i < right .length /2 ; i ++) {
1289- shape [index ++] = x +width +right [2 *i ];
1290- shape [index ++] = y +right [2 *i +1 ];
1291- }
1292- shape [index ++] = x +width ;
1293- shape [index ++] = y +height +highlight_header + 1 ;
1200+ shape [index ++] = y + height + highlight_header + 1 ;
1201+ shape [index ++] = x ;
1202+ shape [index ++] = y ;
1203+ shape [index ++] = x + width ;
1204+ shape [index ++] = y ;
1205+ shape [index ++] = x + width ;
1206+ shape [index ++] = y + height + highlight_header + 1 ;
12941207 }
12951208 // Fill in background
12961209 boolean single = parent .single ;
0 commit comments