[seed: 3/5] Some fixes to canvas color parsing
- From: Robert Carr <racarr src gnome org>
- To: svn-commits-list gnome org
- Subject: [seed: 3/5] Some fixes to canvas color parsing
- Date: Tue, 24 Mar 2009 23:06:01 -0400 (EDT)
commit 5aca0971f9842b7f45c3fd61054823750f095586
Author: Robert Carr <racarr mireia (none)>
Date: Wed Mar 18 16:28:28 2009 -0400
Some fixes to canvas color parsing
---
libseed/seed-engine.c | 4 +++-
modules/canvas/seed-canvas.c | 15 +++++++++------
2 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/libseed/seed-engine.c b/libseed/seed-engine.c
index 20bf2f1..d46ac7c 100644
--- a/libseed/seed-engine.c
+++ b/libseed/seed-engine.c
@@ -1293,7 +1293,9 @@ JSClassDefinition struct_constructor_def = {
void
seed_create_function (JSContextRef ctx,
- gchar * name, gpointer func, JSObjectRef obj)
+ gchar * name,
+ gpointer func,
+ JSObjectRef obj)
{
JSObjectRef oref;
diff --git a/modules/canvas/seed-canvas.c b/modules/canvas/seed-canvas.c
index 1519a72..c9d9de4 100644
--- a/modules/canvas/seed-canvas.c
+++ b/modules/canvas/seed-canvas.c
@@ -229,10 +229,10 @@ seed_canvas_parse_color (SeedCanvasColor *color,
{
case 'a':
{
- gint r, g, b;
+ gdouble r, g, b;
gfloat a;
- sscanf (spec, "rgba(%d,%d,%d,%f)", &r, &g, &b, &a);
+ sscanf (spec, "rgba(%lf,%lf,%lf,%f)", &r, &g, &b, &a);
color->r = r/255.0;
color->g = g/255.0;
@@ -243,13 +243,14 @@ seed_canvas_parse_color (SeedCanvasColor *color,
}
case '(':
{
- gint r, g, b;
+ gdouble r, g, b;
- sscanf (spec, "rgb(%d,%d,%d)", &r, &g, &b);
+ sscanf (spec, "rgb(%lf,%lf,%lf)", &r, &g, &b);
color->r = r / 255.0;
color->g = g / 255.0;
color->b = b / 255.0;
+ color->a = 1.0;
return;
}
@@ -266,7 +267,8 @@ gboolean
seed_canvas_update_stroke_style (SeedContext ctx,
SeedObject this_object,
SeedString property_name,
- SeedValue value, SeedException * e)
+ SeedValue value,
+ SeedException * e)
{
SeedCanvasStyle *style;
GET_CR;
@@ -714,7 +716,8 @@ seed_canvas_stroke (SeedContext ctx,
{
GET_CR;
- seed_canvas_apply_stroke_style ((SeedCanvasStyle *)priv->styles->data, cr);
+ seed_canvas_apply_stroke_style ((SeedCanvasStyle *)priv->styles->data,
+ cr);
cairo_stroke (cr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]