[cairo] [patch] gl: generate correct gradient color texture

Henry (Yu) Song - SISA hsong at sisa.samsung.com
Tue Jul 10 07:49:14 PDT 2012


From: Henry (Yu) Song - SISA
Sent: Monday, July 09, 2012 9:51 AM
To: cairo at cairographics.org
Subject: [patch] gl: generate correct gradient color texture

commit 1454858833d290efbf49db9359065e227b4f8674
Author: Henry Song <henry.song at samsung.com>
Date:   Mon Jul 9 09:49:13 2012 -0700

    gl: pixman generates gradient color at the center of pixel.  We need to
    adjust such accordingly in GL when generate gradient texture

diff --git a/src/cairo-gl-gradient.c b/src/cairo-gl-gradient.c
index 5ac172f..ffb5468 100644
--- a/src/cairo-gl-gradient.c
+++ b/src/cairo-gl-gradient.c
@@ -124,9 +124,9 @@ _cairo_gl_gradient_render (const cairo_gl_context_t    *ctx,
        pixman_stops[i].color.alpha = stops[i].color.alpha_short;
     }

-    p1.x = 0;
+    p1.x = _cairo_fixed_16_16_from_double (0.5);
     p1.y = 0;
-    p2.x = width << 16;
+    p2.x = _cairo_fixed_16_16_from_double (width - 0.5);
     p2.y = 0;

     gradient = pixman_image_create_linear_gradient (&p1, &p2,


More information about the cairo mailing list