summaryrefslogtreecommitdiff
path: root/gtk/gtkhsv.c
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2001-04-20 10:59:48 +0000
committerAlexander Larsson <alexl@src.gnome.org>2001-04-20 10:59:48 +0000
commitca20af0b31a0b9ff24adc9fcca955b0dc49db425 (patch)
tree56965449a09bc25f0898ece0fbbb288384d287bc /gtk/gtkhsv.c
parentbf660df987e2eb2ac2f1f885178e0bbdb7d560b0 (diff)
downloadgtk+-ca20af0b31a0b9ff24adc9fcca955b0dc49db425.tar.gz
API Change. Take GdkColor arguments instead of gdouble *. Leave the old
2001-04-20 Alexander Larsson <alexl@redhat.com> * gtk/gtkcolorsel.[ch]: API Change. Take GdkColor arguments instead of gdouble *. Leave the old gtk_color_selection_set_color for compatibility, but marked deprecated. Do correct rounding when converting RGB <-> HSV. * gtk/gtkcolorseldialog.c: * tests/testgtk.c: Use new GtkColorSelection API. * gtk/gtkhsv.c: Fix problem selecting colors in triangle when Hue is 330. Fix some black dots around the HSB triangle. * gtk/gtkfilesel.c: return FALSE from the focus_in_event handler to fix focus problems.
Diffstat (limited to 'gtk/gtkhsv.c')
-rw-r--r--gtk/gtkhsv.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gtk/gtkhsv.c b/gtk/gtkhsv.c
index cc84b563bf..26f10e63c4 100644
--- a/gtk/gtkhsv.c
+++ b/gtk/gtkhsv.c
@@ -686,8 +686,12 @@ compute_sv (GtkHSV *hsv,
{
if (*v > 1.0)
*v = 1.0;
-
- *s = (y - sy - *v * (vy - sy)) / (*v * (hy - vy));
+
+ if (fabs (hy - vy) < fabs (hx - vx))
+ *s = (x - sx - *v * (vx - sx)) / (*v * (hx - vx));
+ else
+ *s = (y - sy - *v * (vy - sy)) / (*v * (hy - vy));
+
if (*s < 0.0)
*s = 0.0;
else if (*s > 1.0)
@@ -949,7 +953,7 @@ paint_ring (GtkHSV *hsv,
dx = xx + x - center;
dist = dx * dx + dy * dy;
- if (dist < (inner * inner) || dist > (outer * outer))
+ if (dist < ((inner-1) * (inner-1)) || dist > ((outer+1) * (outer+1)))
{
*p++ = 0;
*p++ = 0;