<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">From 18e714f260f18e6ae13979a289b6f7892d7f82c2 Mon Sep 17 00:00:00 2001<br>
From: Henry Song <henry.song@samsung.com><br>
Date: Mon, 5 Nov 2012 13:16:18 -0800<br>
Subject: [PATCH] gl: add tex_width in cairo_gl_gradient_t structure, there is<br>
no need to set cache_entry.size to be tex_width, this makes<br>
it unlikely overflows gradient cache<br>
<br>
---<br>
src/cairo-gl-gradient-private.h | 1 +<br>
src/cairo-gl-gradient.c | 3 ++-<br>
src/cairo-gl-operand.c | 2 +-<br>
3 files changed, 4 insertions(+), 2 deletions(-)<br>
<br>
diff --git a/src/cairo-gl-gradient-private.h b/src/cairo-gl-gradient-private.h<br>
index 77f9bbd..c76c7b2 100644<br>
--- a/src/cairo-gl-gradient-private.h<br>
+++ b/src/cairo-gl-gradient-private.h<br>
@@ -69,6 +69,7 @@ typedef struct _cairo_gl_gradient {<br>
cairo_reference_count_t ref_count;<br>
cairo_device_t *device; /* NB: we don't hold a reference */<br>
GLuint tex;<br>
+ int tex_width;<br>
unsigned int n_stops;<br>
const cairo_gradient_stop_t *stops;<br>
cairo_gradient_stop_t stops_embedded[1];<br>
diff --git a/src/cairo-gl-gradient.c b/src/cairo-gl-gradient.c<br>
index 1c1f972..3ceb3ed 100644<br>
--- a/src/cairo-gl-gradient.c<br>
+++ b/src/cairo-gl-gradient.c<br>
@@ -258,7 +258,8 @@ _cairo_gl_gradient_create (cairo_gl_context_t *ctx,<br>
<br>
CAIRO_REFERENCE_COUNT_INIT (&gradient->ref_count, 2);<br>
gradient->cache_entry.hash = hash;<br>
- gradient->cache_entry.size = tex_width;<br>
+ gradient->cache_entry.size = sizeof (cairo_gl_gradient_t *);<br>
+ gradient->tex_width = tex_width;<br>
gradient->device = &ctx->base;<br>
gradient->n_stops = n_stops;<br>
gradient->stops = gradient->stops_embedded;<br>
diff --git a/src/cairo-gl-operand.c b/src/cairo-gl-operand.c<br>
index ee6c08e..e9191aa 100644<br>
--- a/src/cairo-gl-operand.c<br>
+++ b/src/cairo-gl-operand.c<br>
@@ -686,7 +686,7 @@ _cairo_gl_operand_bind_to_shader (cairo_gl_context_t *ctx,<br>
height = operand->texture.surface->height;<br>
}<br>
else {<br>
- width = operand->gradient.gradient->cache_entry.size,<br>
+ width = operand->gradient.gradient->tex_width,<br>
height = 1;<br>
}<br>
strcpy (custom_part, "_texdims");<br>
-- <br>
1.7.9.5<br>
<br>
</div>
</body>
</html>