diff options
Diffstat (limited to 'org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/GradientDrawer.java')
-rw-r--r-- | org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/GradientDrawer.java | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/GradientDrawer.java b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/GradientDrawer.java index 79d01c99d..1035f46f8 100644 --- a/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/GradientDrawer.java +++ b/org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/GradientDrawer.java @@ -184,9 +184,9 @@ public class GradientDrawer { GRADIENT_BOTTOM = .995; } - int red = Math.min(255, (int) (parentBackground.getRed() * GRADIENT_TOP)); - int green = Math.min(255, (int) (parentBackground.getGreen() * GRADIENT_TOP)); - int blue = Math.min(255, (int) (parentBackground.getBlue() * GRADIENT_TOP)); + int red = Math.max(0, Math.min(255, (int) (parentBackground.getRed() * GRADIENT_TOP))); + int green = Math.max(0, Math.min(255, (int) (parentBackground.getGreen() * GRADIENT_TOP))); + int blue = Math.max(0, Math.min(255, (int) (parentBackground.getBlue() * GRADIENT_TOP))); try { categoryGradientStart = new Color(Display.getDefault(), red, green, blue); @@ -195,12 +195,10 @@ public class GradientDrawer { StatusHandler.log(new Status(IStatus.ERROR, TasksUiPlugin.ID_PLUGIN, "Could not set color: " + red //$NON-NLS-1$ + ", " + green + ", " + blue, e)); //$NON-NLS-1$ //$NON-NLS-2$ } - red = Math.max(0, (int) (parentBackground.getRed() / GRADIENT_BOTTOM)); - green = Math.max(0, (int) (parentBackground.getGreen() / GRADIENT_BOTTOM)); - blue = Math.max(0, (int) (parentBackground.getBlue() / GRADIENT_BOTTOM)); - if (red > 255) { - red = 255; - } + red = Math.min(255, Math.max(0, (int) (parentBackground.getRed() / GRADIENT_BOTTOM))); + green = Math.min(255, Math.max(0, (int) (parentBackground.getGreen() / GRADIENT_BOTTOM))); + blue = Math.min(255, Math.max(0, (int) (parentBackground.getBlue() / GRADIENT_BOTTOM))); + try { categoryGradientEnd = new Color(Display.getDefault(), red, green, blue); } catch (Exception e) { |