summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeronika Irvine <veronika>2004-05-27 15:38:00 +0000
committerVeronika Irvine <veronika>2004-05-27 15:38:00 +0000
commit67f8ea583a7420e07c21e339ec92e00d4716ec34 (patch)
tree8b5ba3e32d8a9e161ae7dbac22c982e9a218ecba
parent8a65e1fd2455272593b4de7266f7da4898fabc38 (diff)
downloadeclipse.platform.swt-67f8ea583a7420e07c21e339ec92e00d4716ec34.tar.gz
eclipse.platform.swt-67f8ea583a7420e07c21e339ec92e00d4716ec34.tar.xz
eclipse.platform.swt-67f8ea583a7420e07c21e339ec92e00d4716ec34.zip
low res displays should not anti-alias
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CBanner.java65
1 files changed, 33 insertions, 32 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CBanner.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CBanner.java
index 8f85ac6931..e2d61d04ec 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CBanner.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CBanner.java
@@ -67,7 +67,7 @@ public class CBanner extends Composite {
static final int MIN_LEFT = 10;
static final int MIN_RIGHT = 10;
- static RGB BORDER1 = null;
+ static int BORDER1 = SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW;
/**
@@ -80,7 +80,6 @@ public class CBanner extends Composite {
*/
public CBanner(Composite parent, int style) {
super(parent, checkStyle(style));
- if (BORDER1 == null) BORDER1 = getDisplay().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW).getRGB();
resizeCursor = new Cursor(getDisplay(), SWT.CURSOR_SIZEWE);
Listener listener = new Listener() {
@@ -365,13 +364,12 @@ void onPaint(GC gc) {
// gc.fillRectangle(-10, -10, size.x+20, size.y+20);
// }
Point size = getSize();
+ Color border1 = getDisplay().getSystemColor(BORDER1);
if (bottom != null && (left != null || right != null)) {
- Color border1 = new Color(getDisplay(), BORDER1);
gc.setForeground(border1);
int y = bottom.getBounds().y - BORDER_BOTTOM - BORDER_STRIPE;
gc.drawLine(0, y, size.x, y);
- border1.dispose();
}
if (left == null || right == null) return;
@@ -392,38 +390,41 @@ void onPaint(GC gc) {
Color background = getBackground();
- // Anti- aliasing
- int[] line2 = new int[line1.length];
- index = 0;
- for (int i = 0; i < line1.length/2; i++) {
- line2[index] = line1[index++] - 1;
- line2[index] = line1[index++];
- }
- int[] line3 = new int[line1.length];
- index = 0;
- for (int i = 0; i < line1.length/2; i++) {
- line3[index] = line1[index++] + 1;
- line3[index] = line1[index++];
+ if (getDisplay().getDepth() >= 15) {
+ // Anti- aliasing
+ int[] line2 = new int[line1.length];
+ index = 0;
+ for (int i = 0; i < line1.length/2; i++) {
+ line2[index] = line1[index++] - 1;
+ line2[index] = line1[index++];
+ }
+ int[] line3 = new int[line1.length];
+ index = 0;
+ for (int i = 0; i < line1.length/2; i++) {
+ line3[index] = line1[index++] + 1;
+ line3[index] = line1[index++];
+ }
+ RGB from = border1.getRGB();
+ RGB to = background.getRGB();
+ int red = from.red + 3*(to.red - from.red)/4;
+ int green = from.green + 3*(to.green - from.green)/4;
+ int blue = from.blue + 3*(to.blue - from.blue)/4;
+ Color color = new Color(getDisplay(), red, green, blue);
+ gc.setForeground(color);
+ gc.drawPolyline(line2);
+ gc.drawPolyline(line3);
+ color.dispose();
+
+ // draw tail fading to background
+ int x1 = Math.max(0, curveStart - CURVE_TAIL);
+ gc.setForeground(background);
+ gc.setBackground(border1);
+ gc.fillGradientRectangle(x1, size.y - BORDER_STRIPE, curveStart-x1+1, 1, false);
}
- RGB from = BORDER1;
- RGB to = background.getRGB();
- int red = from.red + 3*(to.red - from.red)/4;
- int green = from.green + 3*(to.green - from.green)/4;
- int blue = from.blue + 3*(to.blue - from.blue)/4;
- Color color = new Color(getDisplay(), red, green, blue);
- gc.setForeground(color);
- gc.drawPolyline(line2);
- gc.drawPolyline(line3);
- color.dispose();
- int x1 = Math.max(0, curveStart - CURVE_TAIL);
- Color border1 = new Color(getDisplay(), BORDER1);
- gc.setForeground(background);
- gc.setBackground(border1);
- gc.fillGradientRectangle(x1, size.y - BORDER_STRIPE, curveStart-x1+1, 1, false);
+ // draw border
gc.setForeground(border1);
gc.drawPolyline(line1);
- border1.dispose();
}
void onResize() {