refs bug 285397 - removed code that required unnecessary GC changes.
diff --git a/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/BufferedGraphicsSource.java b/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/BufferedGraphicsSource.java
index 234a67c..ecc7408 100644
--- a/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/BufferedGraphicsSource.java
+++ b/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/BufferedGraphicsSource.java
@@ -11,7 +11,6 @@
package org.eclipse.draw2d;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTError;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Control;
@@ -20,7 +19,9 @@
class BufferedGraphicsSource implements GraphicsSource {
- private Image imageBuffer;
+ // UNSUPPORTED - bypass buffer handling since offscreen rendering is
+ // not possible in RAP
+ // private Image imageBuffer;
private GC imageGC;
private GC controlGC;
private Control control;
@@ -58,14 +59,16 @@
/*
* The imageBuffer may be null if double-buffering was not successful.
*/
- if (imageBuffer != null) {
- imageGC.dispose();
- controlGC.drawImage(getImage(), 0, 0, inUse.width, inUse.height,
- inUse.x, inUse.y, inUse.width, inUse.height);
- imageBuffer.dispose();
- imageBuffer = null;
- imageGC = null;
- }
+ // UNSUPPORTED - bypass buffer handling since offscreen rendering is
+ // not possible in RAP
+ // if (imageBuffer != null) {
+ // imageGC.dispose();
+ // controlGC.drawImage(getImage(), 0, 0, inUse.width, inUse.height,
+ // inUse.x, inUse.y, inUse.width, inUse.height);
+ // imageBuffer.dispose();
+ // imageBuffer = null;
+ // imageGC = null;
+ // }
if (controlGC != null) {
controlGC.dispose();
}
@@ -94,33 +97,35 @@
* will fail. When this happens, do not use double-buffering for
* painting.
*/
- try {
- // UNSUPPORTED - bypass buffer creation since offscreen rendering is
- // not possible in RAP
- // imageBuffer = new Image(null, inUse.width, inUse.height);
- } catch (SWTError noMoreHandles) {
- imageBuffer = null;
- } catch (IllegalArgumentException tooBig) {
- imageBuffer = null;
- }
+ // UNSUPPORTED - bypass buffer creation since offscreen rendering is
+ // not possible in RAP
+ // try {
+ // imageBuffer = new Image(null, inUse.width, inUse.height);
+ // } catch (SWTError noMoreHandles) {
+ // imageBuffer = null;
+ // } catch (IllegalArgumentException tooBig) {
+ // imageBuffer = null;
+ // }
controlGC = new GC(control, control.getStyle()
& (SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT));
Graphics graphics;
- if (imageBuffer != null) {
- imageGC = new GC(imageBuffer, control.getStyle()
- & (SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT));
- imageGC.setBackground(controlGC.getBackground());
- imageGC.setForeground(controlGC.getForeground());
- imageGC.setFont(controlGC.getFont());
- imageGC.setLineStyle(controlGC.getLineStyle());
- imageGC.setLineWidth(controlGC.getLineWidth());
- imageGC.setXORMode(controlGC.getXORMode());
- graphics = new SWTGraphics(imageGC);
- graphics.translate(inUse.getLocation().negate());
- } else {
- graphics = new SWTGraphics(controlGC);
- }
+ // UNSUPPORTED - bypass buffer handling since offscreen rendering is
+ // not possible in RAP
+ // if (imageBuffer != null) {
+ // imageGC = new GC(imageBuffer, control.getStyle()
+ // & (SWT.RIGHT_TO_LEFT | SWT.LEFT_TO_RIGHT));
+ // imageGC.setBackground(controlGC.getBackground());
+ // imageGC.setForeground(controlGC.getForeground());
+ // imageGC.setFont(controlGC.getFont());
+ // imageGC.setLineStyle(controlGC.getLineStyle());
+ // imageGC.setLineWidth(controlGC.getLineWidth());
+ // imageGC.setXORMode(controlGC.getXORMode());
+ // graphics = new SWTGraphics(imageGC);
+ // graphics.translate(inUse.getLocation().negate());
+ // } else {
+ graphics = new SWTGraphics(controlGC);
+ // }
graphics.setClip(inUse);
return graphics;
@@ -133,7 +138,10 @@
* @return the current image buffer
*/
protected Image getImage() {
- return imageBuffer;
+ // UNSUPPORTED - bypass buffer handling since offscreen rendering is
+ // not possible in RAP
+ // return imageBuffer;
+ return null;
}
/**
diff --git a/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/GhostImageFigure.java b/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/GhostImageFigure.java
index 6c05d2a..22755c3 100644
--- a/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/GhostImageFigure.java
+++ b/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/GhostImageFigure.java
@@ -59,7 +59,7 @@
Rectangle sourceFigureRelativePrecisionBounds = new PrecisionRectangle(
source.getBounds().getCopy());
- // Create image using RAP constructors.
+ // Create image using RAP constructors.
Image offscreenImage = new Image(Display.getCurrent(), new ImageData(
sourceFigureRelativePrecisionBounds.width,
sourceFigureRelativePrecisionBounds.height, 32,
@@ -67,7 +67,9 @@
sourceFigureRelativePrecisionBounds.width,
sourceFigureRelativePrecisionBounds.height);
- GC gc = new GC(offscreenImage);
+ // UNSUPPORTED - image constructor not implemented in RAP
+ // GC gc = new GC(offScreenImage);
+ GC gc = new GC(offscreenImage.getDevice());
SWTGraphics swtGraphics = new SWTGraphics(gc);
swtGraphics.translate(-sourceFigureRelativePrecisionBounds.x,
-sourceFigureRelativePrecisionBounds.y);
diff --git a/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/ImageUtilities.java b/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/ImageUtilities.java
index 25a82ef..990fd6e 100644
--- a/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/ImageUtilities.java
+++ b/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/ImageUtilities.java
@@ -55,7 +55,9 @@
FontMetrics metrics = FigureUtilities.getFontMetrics(font);
Dimension strSize = FigureUtilities.getStringExtents(string, font);
Image srcImage = new Image(display, strSize.width, metrics.getAscent());
- GC gc = new GC(srcImage);
+ // UNSUPPORTED - image constructor not implemented in RAP
+ // GC gc = new GC(srcImage);
+ GC gc = new GC(srcImage.getDevice());
gc.setFont(font);
gc.setForeground(foreground);
gc.setBackground(background);
diff --git a/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTGraphics.java b/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTGraphics.java
index b072a58..b518e4c 100644
--- a/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTGraphics.java
+++ b/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/SWTGraphics.java
@@ -314,10 +314,10 @@
gc.setLineCap(lineAttributes.cap);
gc.setLineJoin(lineAttributes.join);
// UNSUPPORTED - api is not implemented in RAP
-// gc.setLineStyle(lineAttributes.style);
-// if (lineAttributes.dash != null) {
-// gc.setLineDash(convertFloatArrayToInt(lineAttributes.dash));
-// }
+ // gc.setLineStyle(lineAttributes.style);
+ // if (lineAttributes.dash != null) {
+ // gc.setLineDash(convertFloatArrayToInt(lineAttributes.dash));
+ // }
}
appliedState.lineAttributes = clone(lineAttributes);
}
@@ -889,25 +889,24 @@
// - FILL_RULE_WHOLE_NUMBER);
// }
- if ((changes & AA_MASK) != 0) {
- gc.setAntialias(((hints & AA_MASK) >> AA_SHIFT)
- - AA_WHOLE_NUMBER);
- }
+ // if ((changes & AA_MASK) != 0) {
+ // gc.setAntialias(((hints & AA_MASK) >> AA_SHIFT)
+ // - AA_WHOLE_NUMBER);
+ // }
- if ((changes & TEXT_AA_MASK) != 0) {
- gc.setTextAntialias(((hints & TEXT_AA_MASK) >> TEXT_AA_SHIFT)
- - AA_WHOLE_NUMBER);
- }
+ // if ((changes & TEXT_AA_MASK) != 0) {
+ // gc.setTextAntialias(((hints & TEXT_AA_MASK) >> TEXT_AA_SHIFT)
+ // - AA_WHOLE_NUMBER);
+ // }
// If advanced was flagged, but none of the conditions which trigger
// advanced
// actually got applied, force advanced graphics on.
- // UNSUPPORTED - api is not implemented in RAP
- // if ((changes & ADVANCED_GRAPHICS_MASK) != 0) {
- // if ((hints & ADVANCED_GRAPHICS_MASK) != 0 && !gc.getAdvanced()) {
- // gc.setAdvanced(true);
- // }
- // }
+ if ((changes & ADVANCED_GRAPHICS_MASK) != 0) {
+ if ((hints & ADVANCED_GRAPHICS_MASK) != 0 && !gc.getAdvanced()) {
+ gc.setAdvanced(true);
+ }
+ }
}
}
diff --git a/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/parts/Thumbnail.java b/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/parts/Thumbnail.java
index 2cd36f4..c27d98b 100644
--- a/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/parts/Thumbnail.java
+++ b/bundles/org.eclipse.draw2d/src/org/eclipse/draw2d/parts/Thumbnail.java
@@ -240,8 +240,10 @@
if (targetSize.isEmpty())
return;
-
- thumbnailGC = new GC(thumbnailImage,
+ // UNSUPPORTED - image constructor not implemented in RAP
+ // thumbnailGC = new GC(thumbnailImage,
+ // sourceFigure.isMirrored() ? SWT.RIGHT_TO_LEFT : SWT.NONE);
+ thumbnailGC = new GC(thumbnailImage.getDevice(),
sourceFigure.isMirrored() ? SWT.RIGHT_TO_LEFT : SWT.NONE);
thumbnailGraphics = new ScaledGraphics(new SWTGraphics(thumbnailGC));
thumbnailGraphics.scale(getScaleX());
@@ -271,11 +273,12 @@
thumbnailImage.dispose();
if (!targetSize.isEmpty()) {
- //Image creation as supported in RAP
+ // UNSUPPORTED - original image constructor not implemented in
+ // RAP
+ // Image creation as supported in RAP
thumbnailImage = new Image(Display.getDefault(), new ImageData(
targetSize.width, targetSize.height, 32,
- new PaletteData(127, 127, 127)), targetSize.width,
- targetSize.height);
+ new PaletteData(127, 127, 127)));
thumbnailImageSize = new Dimension(targetSize);
} else {
thumbnailImage = null;
diff --git a/bundles/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/CachedLabel.java b/bundles/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/CachedLabel.java
index 729c6f9..498e42d 100644
--- a/bundles/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/CachedLabel.java
+++ b/bundles/org.eclipse.zest.core/src/org/eclipse/zest/core/widgets/internal/CachedLabel.java
@@ -198,8 +198,9 @@
// @tag TODO : Dispose of the image properly
//ZestPlugin.getDefault().addImage(cachedImage.toString(), cachedImage);
-
- GC gc = new GC(cachedImage);
+// UNSUPPORTED - image constructor not implemented in RAP
+// GC gc = new GC(cachedImage);
+ GC gc = new GC(cachedImage.getDevice());
Graphics graphics2 = new SWTGraphics(gc);
graphics2.setBackgroundColor(getBackgroundTextColor());