Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspingel2010-07-30 19:03:17 -0400
committerspingel2010-07-30 19:03:17 -0400
commita95482f7d83902d5b81d5d66b38dfeda6944654d (patch)
tree1ef2d8827fddb259add974053d19b12712351265
parentd2472afcae41daa0dec791440c255e19910233c6 (diff)
downloadorg.eclipse.mylyn.tasks-a95482f7d83902d5b81d5d66b38dfeda6944654d.tar.gz
org.eclipse.mylyn.tasks-a95482f7d83902d5b81d5d66b38dfeda6944654d.tar.xz
org.eclipse.mylyn.tasks-a95482f7d83902d5b81d5d66b38dfeda6944654d.zip
RESOLVED - bug 321265: [e4] initialization of GradientDrawer causes IllegalArgumentException
https://bugs.eclipse.org/bugs/show_bug.cgi?id=321265
-rw-r--r--org.eclipse.mylyn.tasks.ui/src/org/eclipse/mylyn/internal/tasks/ui/views/GradientDrawer.java16
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) {

Back to the top