summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2020-05-26 20:35:13 -0400
committerMatthias Clasen <mclasen@redhat.com>2020-05-26 20:43:47 -0400
commit45f162fc50ccc007e6fa634cbe4da1496ada352f (patch)
treeb126b14516b149e910b4d8326764f297cf797f13
parenta20291f23559191c67235255b816b933fc4dbaae (diff)
downloadgtk+-45f162fc50ccc007e6fa634cbe4da1496ada352f.tar.gz
gdk: Remove an unused texture api
gdk_gl_texture_from_surface wasn't used anywhere, so lets drop it.
-rw-r--r--gdk/gdkgl.c121
-rw-r--r--gdk/gdkinternals.h2
2 files changed, 0 insertions, 123 deletions
diff --git a/gdk/gdkgl.c b/gdk/gdkgl.c
index 1e24e77687..dcaae81f3b 100644
--- a/gdk/gdkgl.c
+++ b/gdk/gdkgl.c
@@ -437,127 +437,6 @@ out:
cairo_region_destroy (clip_region);
}
-/* This is always called with the paint context current */
-void
-gdk_gl_texture_from_surface (cairo_surface_t *cairo_surface,
- cairo_region_t *region)
-{
- GdkGLContext *paint_context;
- cairo_surface_t *image;
- double device_x_offset, device_y_offset;
- cairo_rectangle_int_t rect, e;
- int n_rects, i;
- GdkSurface *surface;
- int unscaled_surface_height;
- unsigned int texture_id;
- int surface_scale;
- double sx, sy;
- float umax, vmax;
- gboolean use_texture_rectangle;
- guint target;
-
- paint_context = gdk_gl_context_get_current ();
-
-#ifdef G_ENABLE_DEBUG
- if (paint_context != NULL)
- {
- GdkDisplay *display = gdk_draw_context_get_display (GDK_DRAW_CONTEXT (paint_context));
-
- if (GDK_DISPLAY_DEBUG_CHECK (display, GL_SOFTWARE) == 0)
- return;
- }
-#endif
-
- if (paint_context != NULL &&
- GDK_GL_CONTEXT_GET_CLASS (paint_context)->texture_from_surface &&
- GDK_GL_CONTEXT_GET_CLASS (paint_context)->texture_from_surface (paint_context, cairo_surface, region))
- return;
-
- /* Software fallback */
- use_texture_rectangle = gdk_gl_context_use_texture_rectangle (paint_context);
-
- surface = gdk_gl_context_get_surface (paint_context);
- surface_scale = gdk_surface_get_scale_factor (surface);
- gdk_surface_get_unscaled_size (surface, NULL, &unscaled_surface_height);
-
- sx = sy = 1;
- cairo_surface_get_device_scale (cairo_surface, &sx, &sy);
- cairo_surface_get_device_offset (cairo_surface, &device_x_offset, &device_y_offset);
-
- glGenTextures (1, &texture_id);
- if (use_texture_rectangle)
- target = GL_TEXTURE_RECTANGLE_ARB;
- else
- target = GL_TEXTURE_2D;
-
- glBindTexture (target, texture_id);
- glEnable (GL_SCISSOR_TEST);
-
- glTexParameteri (target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameteri (target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glTexParameteri (target, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
- glTexParameteri (target, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
-
- n_rects = cairo_region_num_rectangles (region);
-
-#define FLIP_Y(_y) (unscaled_surface_height - (_y))
-
- for (i = 0; i < n_rects; i++)
- {
- cairo_region_get_rectangle (region, i, &rect);
-
- glScissor (rect.x * surface_scale, FLIP_Y ((rect.y + rect.height) * surface_scale),
- rect.width * surface_scale, rect.height * surface_scale);
-
- e = rect;
- e.x *= sx;
- e.y *= sy;
- e.x += (int)device_x_offset;
- e.y += (int)device_y_offset;
- e.width *= sx;
- e.height *= sy;
- image = cairo_surface_map_to_image (cairo_surface, &e);
-
- gdk_gl_context_upload_texture (paint_context,
- cairo_image_surface_get_data (image),
- e.width,
- e.height,
- cairo_image_surface_get_stride (image),
- target);
-
- cairo_surface_unmap_image (cairo_surface, image);
-
- if (use_texture_rectangle)
- {
- umax = rect.width * sx;
- vmax = rect.height * sy;
- }
- else
- {
- umax = 1.0;
- vmax = 1.0;
- }
-
- {
- GdkTexturedQuad quad = {
- rect.x * surface_scale, FLIP_Y(rect.y * surface_scale),
- (rect.x + rect.width) * surface_scale, FLIP_Y((rect.y + rect.height) * surface_scale),
- 0, 0,
- umax, vmax,
- };
-
- /* We don't want to combine the quads here, because they have different textures.
- * And we don't want to upload the unused source areas to make it one texture. */
- gdk_gl_texture_quads (paint_context, target, 1, &quad, TRUE);
- }
- }
-
-#undef FLIP_Y
-
- glDisable (GL_SCISSOR_TEST);
- glDeleteTextures (1, &texture_id);
-}
-
/**
* gdk_cairo_surface_upload_to_gl:
* @surface: a Cairo surface
diff --git a/gdk/gdkinternals.h b/gdk/gdkinternals.h
index 6a7821b70d..e30872edc6 100644
--- a/gdk/gdkinternals.h
+++ b/gdk/gdkinternals.h
@@ -127,8 +127,6 @@ void _gdk_event_queue_flush (GdkDisplay *display);
gboolean _gdk_cairo_surface_extents (cairo_surface_t *surface,
GdkRectangle *extents);
-void gdk_gl_texture_from_surface (cairo_surface_t *surface,
- cairo_region_t *region);
typedef struct {
float x1, y1, x2, y2;