[gtk+/wip/ebassi/gsk-renderer: 32/65] gsk: Use surface-to-texture utility function
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/ebassi/gsk-renderer: 32/65] gsk: Use surface-to-texture utility function
- Date: Fri, 8 Jul 2016 16:00:07 +0000 (UTC)
commit 77566b88e55b382f4cb4d9446b55d9f37bd28869
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Apr 25 11:41:15 2016 +0100
gsk: Use surface-to-texture utility function
Now that we have it.
gsk/gskglrenderer.c | 24 +++---------------------
1 files changed, 3 insertions(+), 21 deletions(-)
---
diff --git a/gsk/gskglrenderer.c b/gsk/gskglrenderer.c
index c6037cf..4a5a03f 100644
--- a/gsk/gskglrenderer.c
+++ b/gsk/gskglrenderer.c
@@ -584,22 +584,13 @@ surface_to_texture (cairo_surface_t *surface,
int mag_filter,
guint *texture_out)
{
- cairo_surface_t *tmp;
guint texture_id;
- cairo_surface_flush (surface);
-
- tmp = cairo_surface_map_to_image (surface, &(cairo_rectangle_int_t) {
- 0, 0,
- clip->size.width,
- clip->size.height
- });
-
glGenTextures (1, &texture_id);
glBindTexture (GL_TEXTURE_2D, texture_id);
- GSK_NOTE (OPENGL, g_print ("Uploading px@[%p] { w:%g, h:%g } to texid:%d\n",
- cairo_image_surface_get_data (tmp),
+ GSK_NOTE (OPENGL, g_print ("Uploading surface[%p] { w:%g, h:%g } to texid:%d\n",
+ surface,
clip->size.width,
clip->size.height,
texture_id));
@@ -609,22 +600,13 @@ surface_to_texture (cairo_surface_t *surface,
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, min_filter);
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, mag_filter);
- glPixelStorei (GL_UNPACK_ALIGNMENT, 4);
- glPixelStorei (GL_UNPACK_ROW_LENGTH, cairo_image_surface_get_stride (tmp) / 4);
- glTexImage2D (GL_TEXTURE_2D, 0, GL_RGBA,
- clip->size.width,
- clip->size.height,
- 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
- cairo_image_surface_get_data (tmp));
- glPixelStorei (GL_UNPACK_ROW_LENGTH, 0);
+ gdk_cairo_surface_upload_to_gl (surface, GL_TEXTURE_2D, clip->size.width, clip->size.height, NULL);
if (min_filter != GL_NEAREST)
glGenerateMipmap (GL_TEXTURE_2D);
GSK_NOTE (OPENGL, g_print ("New texture id %d from surface %p\n", texture_id, surface));
- cairo_surface_unmap_image (surface, tmp);
-
*texture_out = texture_id;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]