summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSilenio Quarti <silenio_quarti@ca.ibm.com>2012-06-20 16:35:23 -0400
committerSilenio Quarti <silenio_quarti@ca.ibm.com>2012-06-20 16:35:23 -0400
commitde39ec30a29f6ea7488b95a176a7772391db46ae (patch)
tree40f73c9df6a68ff88761d5977e26bb83667242d6
parent9f0158bef8032723965c0f2d6bd242bfefac7d03 (diff)
downloadeclipse.platform.swt-de39ec30a29f6ea7488b95a176a7772391db46ae.tar.gz
eclipse.platform.swt-de39ec30a29f6ea7488b95a176a7772391db46ae.tar.xz
eclipse.platform.swt-de39ec30a29f6ea7488b95a176a7772391db46ae.zip
drawText does not respect background pattern
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java21
1 files changed, 14 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java
index 9c64c31ece..451e4074c3 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java
@@ -1691,14 +1691,21 @@ public void drawText (String string, int x, int y, int flags) {
NSRect rect = data.layoutManager.usedRectForTextContainer(data.textContainer);
rect.x = x;
rect.y = y;
- NSColor bg = data.bg;
- if (bg == null) {
- float /*double*/ [] color = data.background;
- bg = data.bg = NSColor.colorWithDeviceRed(color[0], color[1], color[2], data.alpha / 255f);
- bg.retain();
+ Pattern pattern = data.backgroundPattern;
+ if (pattern != null) setPatternPhase(pattern);
+ if (pattern != null && pattern.gradient != null) {
+ NSBezierPath path = NSBezierPath.bezierPathWithRect(rect);
+ fillPattern(path, pattern);
+ } else {
+ NSColor bg = data.bg;
+ if (bg == null) {
+ float /*double*/ [] color = data.background;
+ bg = data.bg = NSColor.colorWithDeviceRed(color[0], color[1], color[2], data.alpha / 255f);
+ bg.retain();
+ }
+ bg.setFill();
+ NSBezierPath.fillRect(rect);
}
- bg.setFill();
- NSBezierPath.fillRect(rect);
}
data.layoutManager.drawGlyphsForGlyphRange(range, pt);
handle.restoreGraphicsState();