diff options
author | Scott Kovatch <skovatch> | 2010-11-05 22:15:15 +0000 |
---|---|---|
committer | Scott Kovatch <skovatch> | 2010-11-05 22:15:15 +0000 |
commit | 5d349ccba41d0f7ef226037e533a9e5997cf8ec1 (patch) | |
tree | dfac5b6eef4985a7839caf4011e8f62fa6d87001 | |
parent | 475e439e4759a6c2dcfaf3351506dbb3f18de1a4 (diff) | |
download | eclipse.platform.swt-5d349ccba41d0f7ef226037e533a9e5997cf8ec1.tar.gz eclipse.platform.swt-5d349ccba41d0f7ef226037e533a9e5997cf8ec1.tar.xz eclipse.platform.swt-5d349ccba41d0f7ef226037e533a9e5997cf8ec1.zip |
329569 - minimize the number of special cases
-rwxr-xr-x | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/graphics/GC.java | 43 |
1 files changed, 8 insertions, 35 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 e756c45311..12ff485c09 100755 --- 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 @@ -288,11 +288,7 @@ NSAutoreleasePool checkGC (int mask) { } else { float /*double*/ [] color = data.foreground; if (data.fg != null) data.fg.release(); - NSColor fg; - if (OS.VERSION < 0x1060) - fg = data.fg = NSColor.colorWithDeviceRed(color[0], color[1], color[2], data.alpha / 255f); - else - fg = data.fg = NSColor.colorWithCalibratedRed(color[0], color[1], color[2], data.alpha / 255f); + NSColor fg = data.fg = NSColor.colorWithCalibratedRed(color[0], color[1], color[2], data.alpha / 255f); fg.retain(); fg.setStroke(); } @@ -304,11 +300,7 @@ NSAutoreleasePool checkGC (int mask) { } else { float /*double*/ [] color = data.foreground; if (data.fg != null) data.fg.release(); - NSColor fg; - if (OS.VERSION < 0x1060) - fg = data.fg = NSColor.colorWithDeviceRed(color[0], color[1], color[2], data.alpha / 255f); - else - fg = data.fg = NSColor.colorWithCalibratedRed(color[0], color[1], color[2], data.alpha / 255f); + NSColor fg = data.fg = NSColor.colorWithCalibratedRed(color[0], color[1], color[2], data.alpha / 255f); fg.retain(); fg.setFill(); } @@ -784,12 +776,7 @@ NSAttributedString createString(String string, int flags, boolean draw) { NSColor fg = data.fg; if (fg == null) { float /*double*/ [] color = data.foreground; - - if (OS.VERSION < 0x1060) - fg = data.fg = NSColor.colorWithDeviceRed(color[0], color[1], color[2], data.alpha / 255f); - else - fg = data.fg = NSColor.colorWithCalibratedRed(color[0], color[1], color[2], data.alpha / 255f); - + fg = data.fg = NSColor.colorWithCalibratedRed(color[0], color[1], color[2], data.alpha / 255f); fg.retain(); } dict.setObject(fg, OS.NSForegroundColorAttributeName); @@ -1697,10 +1684,7 @@ public void drawText (String string, int x, int y, int flags) { NSColor bg = data.bg; if (bg == null) { float /*double*/ [] color = data.background; - if (OS.VERSION < 0x1060) - bg = data.bg = NSColor.colorWithDeviceRed(color[0], color[1], color[2], data.alpha / 255f); - else - bg = data.bg = NSColor.colorWithCalibratedRed(color[0], color[1], color[2], data.alpha / 255f); + bg = data.bg = NSColor.colorWithCalibratedRed(color[0], color[1], color[2], data.alpha / 255f); bg.retain(); } bg.setFill(); @@ -1850,14 +1834,8 @@ public void fillGradientRectangle(int x, int y, int width, int height, boolean v if (fromRGB.equals(toRGB)) { fillRectangle(x, y, width, height); } else { - NSColor startingColor, endingColor; - if (OS.VERSION < 0x1060) { - startingColor = NSColor.colorWithDeviceRed(fromRGB.red / 255f, fromRGB.green / 255f, fromRGB.blue / 255f, data.alpha / 255f); - endingColor = NSColor.colorWithDeviceRed(toRGB.red / 255f, toRGB.green / 255f, toRGB.blue / 255f, data.alpha / 255f); - } else { - startingColor = NSColor.colorWithCalibratedRed(fromRGB.red / 255f, fromRGB.green / 255f, fromRGB.blue / 255f, data.alpha / 255f); - endingColor = NSColor.colorWithCalibratedRed(toRGB.red / 255f, toRGB.green / 255f, toRGB.blue / 255f, data.alpha / 255f); - } + NSColor startingColor = NSColor.colorWithCalibratedRed(fromRGB.red / 255f, fromRGB.green / 255f, fromRGB.blue / 255f, data.alpha / 255f); + NSColor endingColor = NSColor.colorWithCalibratedRed(toRGB.red / 255f, toRGB.green / 255f, toRGB.blue / 255f, data.alpha / 255f); NSGradient gradient = ((NSGradient)new NSGradient().alloc()).initWithStartingColor(startingColor, endingColor); NSRect rect = new NSRect(); rect.x = x; @@ -1932,13 +1910,8 @@ void fillPattern(NSBezierPath path, Pattern pattern) { float /*double*/ difx = end.x - start.x; float /*double*/ dify = end.y - start.y; if (difx == 0 && dify == 0) { - float /*double*/ [] color = pattern.color1; - - if (OS.VERSION < 0x1060) - NSColor.colorWithCalibratedRed(color[0], color[1], color[2], data.alpha / 255f).setFill(); - else - NSColor.colorWithDeviceRed(color[0], color[1], color[2], data.alpha / 255f).setFill(); - + float /*double*/ [] color = pattern.color1; + NSColor.colorWithCalibratedRed(color[0], color[1], color[2], data.alpha / 255f).setFill(); path.fill(); handle.restoreGraphicsState(); return; |