summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/cairo-egl-context.c2
-rw-r--r--src/cairo-evas-gl-context.c3
-rw-r--r--src/cairo-gl-composite.c8
-rw-r--r--src/cairo-gl-device.c16
-rw-r--r--src/cairo-gl-gradient.c9
-rw-r--r--src/cairo-gl-private.h2
-rw-r--r--src/cairo-gl-surface.c4
7 files changed, 31 insertions, 13 deletions
diff --git a/src/cairo-egl-context.c b/src/cairo-egl-context.c
index 5b67d4b3c..0a13c6aac 100644
--- a/src/cairo-egl-context.c
+++ b/src/cairo-egl-context.c
@@ -343,7 +343,7 @@ cairo_egl_device_create (EGLDisplay dpy, EGLContext egl)
* This smaller size means that flushing needs to be done more often,
* but it is less demanding of scarce memory on embedded devices.
*/
- ctx->base.vbo_size = 16*1024;
+ ctx->base.vbo_size = 16 * 1024;
eglMakeCurrent (dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
diff --git a/src/cairo-evas-gl-context.c b/src/cairo-evas-gl-context.c
index 3cd4e0e0b..8135edacb 100644
--- a/src/cairo-evas-gl-context.c
+++ b/src/cairo-evas-gl-context.c
@@ -337,6 +337,9 @@ cairo_evas_gl_device_create (Evas_GL *evas_gl,
else
ctx->has_multithread_makecurrent = FALSE;
+ // reset vbo_size
+ ctx->base.vbo_size = 16 * 1024;
+
evas_gl_make_current (ctx->evas_gl, NULL, NULL);
return &ctx->base.base;
}
diff --git a/src/cairo-gl-composite.c b/src/cairo-gl-composite.c
index 57d7ddf31..e8c013758 100644
--- a/src/cairo-gl-composite.c
+++ b/src/cairo-gl-composite.c
@@ -321,8 +321,8 @@ _cairo_gl_context_setup_operand (cairo_gl_context_t *ctx,
static void
_cairo_gl_context_setup_spans (cairo_gl_context_t *ctx,
- cairo_bool_t encode_src_as_attribute,
cairo_bool_t spans_enabled,
+ cairo_bool_t encode_src_as_attribute,
unsigned int vertex_size,
unsigned int vertex_offset)
{
@@ -798,12 +798,10 @@ _cairo_gl_set_operands_and_operator (cairo_gl_composite_t *setup,
if (setup->spans)
vertex_size += sizeof (GLfloat);
- if (setup->src.type != CAIRO_GL_OPERAND_CONSTANT ||
- ! setup->src.constant.encode_as_attribute)
+ if (setup->src.type == CAIRO_GL_OPERAND_CONSTANT)
_cairo_gl_context_setup_spans (ctx,
setup->spans,
- setup->src.type == CAIRO_GL_OPERAND_CONSTANT ||
- ! setup->src.constant.encode_as_attribute,
+ setup->src.constant.encode_as_attribute,
vertex_size,
dst_size + src_size + mask_size);
diff --git a/src/cairo-gl-device.c b/src/cairo-gl-device.c
index 53c76c1de..7069c8312 100644
--- a/src/cairo-gl-device.c
+++ b/src/cairo-gl-device.c
@@ -1109,6 +1109,20 @@ cairo_gl_device_set_thread_aware (cairo_device_t *device,
void _cairo_gl_context_reset (cairo_gl_context_t *ctx)
{
+ cairo_gl_shader_t *shader = ctx->current_shader;
+ GLint current_program;
+
+ /* reset current shader, this is because if cairo shares a same
+ * context other extern libraries or applications, the current
+ * program may well be changed, in this case, we must set cairo
+ * to use cairo program
+ */
+ if (shader) {
+ ctx->dispatch.GetIntegerv (GL_CURRENT_PROGRAM, &current_program);
+ if ((GLint)(ctx->current_shader->program) != current_program)
+ _cairo_gl_set_shader (ctx, shader);
+ }
+
ctx->states_cache.viewport_box.width = 0;
ctx->states_cache.viewport_box.height = 0;
@@ -1131,8 +1145,6 @@ void _cairo_gl_context_reset (cairo_gl_context_t *ctx)
/* FIXME: this is hack to fix mali driver */
ctx->dispatch.Disable (GL_DITHER);
- ctx->current_shader = NULL;
-
ctx->states_cache.bound_vbo = 0;
ctx->states_cache.bound_vao = 0;
ctx->states_cache.bound_ibo = 0;
diff --git a/src/cairo-gl-gradient.c b/src/cairo-gl-gradient.c
index 2f8c725b6..b204b0ba4 100644
--- a/src/cairo-gl-gradient.c
+++ b/src/cairo-gl-gradient.c
@@ -182,8 +182,13 @@ _cairo_gl_gradient_render (const cairo_gl_context_t *ctx,
* the neareset stop to the zeroth pixel centre in order to correctly
* populate the border color. For completeness, do both edges.
*/
- ((uint32_t*)bytes)[0] = color_stop_to_pixel(&stops[0]);
- ((uint32_t*)bytes)[width-1] = color_stop_to_pixel(&stops[n_stops-1]);
+
+ /* This not needed as we have generated pixman pixels by using the
+ * half pixel from left and right border
+ */
+ /* ((uint32_t*)bytes)[0] = color_stop_to_pixel(&stops[0]);
+ * ((uint32_t*)bytes)[width-1] = color_stop_to_pixel(&stops[n_stops-1]);
+ */
return CAIRO_STATUS_SUCCESS;
}
diff --git a/src/cairo-gl-private.h b/src/cairo-gl-private.h
index ad08abd9f..e5a709e97 100644
--- a/src/cairo-gl-private.h
+++ b/src/cairo-gl-private.h
@@ -112,7 +112,7 @@
* but larger means hogging more memory and can cause trouble for drivers
* (especially on embedded devices). Use the CAIRO_GL_VBO_SIZE environment
* variable to set this to a different size. */
-#define CAIRO_GL_VBO_SIZE_DEFAULT (1024*1024)
+#define CAIRO_GL_VBO_SIZE_DEFAULT (256*1024)
#define MIN_IMAGE_CACHE_WIDTH 512
#define MIN_IMAGE_CACHE_HEIGHT 512
diff --git a/src/cairo-gl-surface.c b/src/cairo-gl-surface.c
index a0b053bb0..e156a0a52 100644
--- a/src/cairo-gl-surface.c
+++ b/src/cairo-gl-surface.c
@@ -1575,11 +1575,11 @@ _cairo_gl_surface_map_to_image (void *abstract_surface,
/* If the original surface has not been modified or
* is clear, we can avoid downloading data. */
-/* if (surface->base.is_clear || surface->base.serial == 0) {
+ if (surface->base.is_clear || surface->base.serial == 0) {
status = _cairo_gl_context_release (ctx, status);
return image;
}
-*/
+
/* This is inefficient, as we'd rather just read the thing without making
* it the destination. But then, this is the fallback path, so let's not
* fall back instead.