[cairo-commit] cairo/src cairo-pdf-surface.c,1.69,1.70

David Reveman commit at pdx.freedesktop.org
Thu Jan 5 05:06:52 PST 2006


Committed by: davidr

Update of /cvs/cairo/cairo/src
In directory gabe:/tmp/cvs-serv30348/src

Modified Files:
	cairo-pdf-surface.c 
Log Message:
Update gradient code in PDF backend

Index: cairo-pdf-surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo-pdf-surface.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- cairo-pdf-surface.c	16 Dec 2005 11:02:35 -0000	1.69
+++ cairo-pdf-surface.c	5 Jan 2006 13:06:50 -0000	1.70
@@ -971,11 +971,11 @@
     n_stops = pattern->n_stops;
     
     for (i = 0; i < pattern->n_stops; i++) {
-	stops[i].color_char[0] = pattern->stops[i].color.red   * 0xff + 0.5;
-	stops[i].color_char[1] = pattern->stops[i].color.green * 0xff + 0.5;
-	stops[i].color_char[2] = pattern->stops[i].color.blue  * 0xff + 0.5;
-	stops[i].color_char[3] = pattern->stops[i].color.alpha * 0xff + 0.5;
-	stops[i].offset = _cairo_fixed_to_double (pattern->stops[i].offset);
+	stops[i].color_char[0] = pattern->stops[i].color.red   >> 8;
+	stops[i].color_char[1] = pattern->stops[i].color.green >> 8;
+	stops[i].color_char[2] = pattern->stops[i].color.blue  >> 8;
+	stops[i].color_char[3] = pattern->stops[i].color.alpha >> 8;
+	stops[i].offset = _cairo_fixed_to_double (pattern->stops[i].x);
 	stops[i].id = i;
     }
 
@@ -1033,11 +1033,11 @@
     p2u = pattern->base.base.matrix;
     cairo_matrix_invert (&p2u);
 
-    x0 = pattern->point0.x;
-    y0 = pattern->point0.y;
+    x0 = _cairo_fixed_to_double (pattern->gradient.p1.x);
+    y0 = _cairo_fixed_to_double (pattern->gradient.p1.y);
     cairo_matrix_transform_point (&p2u, &x0, &y0);
-    x1 = pattern->point1.x;
-    y1 = pattern->point1.y;
+    x1 = _cairo_fixed_to_double (pattern->gradient.p2.x);
+    y1 = _cairo_fixed_to_double (pattern->gradient.p2.y);
     cairo_matrix_transform_point (&p2u, &x1, &y1);
 
     pattern_id = _cairo_pdf_document_new_object (document);
@@ -1091,13 +1091,13 @@
     p2u = pattern->base.base.matrix;
     cairo_matrix_invert (&p2u);
 
-    x0 = pattern->center0.x;
-    y0 = pattern->center0.y;
-    r0 = pattern->radius0;
+    x0 = _cairo_fixed_to_double (pattern->gradient.inner.x);
+    y0 = _cairo_fixed_to_double (pattern->gradient.inner.y);
+    r0 = _cairo_fixed_to_double (pattern->gradient.inner.radius);
     cairo_matrix_transform_point (&p2u, &x0, &y0);
-    x1 = pattern->center1.x;
-    y1 = pattern->center1.y;
-    r1 = pattern->radius1;
+    x1 = _cairo_fixed_to_double (pattern->gradient.outer.x);
+    y1 = _cairo_fixed_to_double (pattern->gradient.outer.y);
+    r1 = _cairo_fixed_to_double (pattern->gradient.outer.radius);
     cairo_matrix_transform_point (&p2u, &x1, &y1);
 
     /* FIXME: This is surely crack, but how should you scale a radius



More information about the cairo-commit mailing list