[gtk/wip/chergert/gdk-macos-gl-renderer] gl: remove unused texture_from_surface API
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/gdk-macos-gl-renderer] gl: remove unused texture_from_surface API
- Date: Wed, 28 Oct 2020 23:49:01 +0000 (UTC)
commit 277df49aa10e5ddc14c9f1c3704852c062340b5a
Author: Christian Hergert <chergert redhat com>
Date: Wed Oct 28 16:49:55 2020 -0700
gl: remove unused texture_from_surface API
This is not used anywhere and only exists within the X11 backend. It
can be removed now.
gdk/gdkglcontextprivate.h | 4 --
gdk/x11/gdkglcontext-x11.c | 124 ---------------------------------------------
2 files changed, 128 deletions(-)
---
diff --git a/gdk/gdkglcontextprivate.h b/gdk/gdkglcontextprivate.h
index e785fbc63d..07310eebfa 100644
--- a/gdk/gdkglcontextprivate.h
+++ b/gdk/gdkglcontextprivate.h
@@ -49,10 +49,6 @@ struct _GdkGLContextClass
GError **error);
cairo_region_t * (* get_damage) (GdkGLContext *context);
-
- gboolean (* texture_from_surface) (GdkGLContext *context,
- cairo_surface_t *surface,
- cairo_region_t *region);
};
typedef struct {
diff --git a/gdk/x11/gdkglcontext-x11.c b/gdk/x11/gdkglcontext-x11.c
index ec0bb2f454..89c75959f7 100644
--- a/gdk/x11/gdkglcontext-x11.c
+++ b/gdk/x11/gdkglcontext-x11.c
@@ -387,129 +387,6 @@ glx_pixmap_get (cairo_surface_t *surface, guint texture_target)
return glx_pixmap;
}
-static gboolean
-gdk_x11_gl_context_texture_from_surface (GdkGLContext *paint_context,
- cairo_surface_t *cairo_surface,
- cairo_region_t *region)
-{
- GdkGLXPixmap *glx_pixmap;
- double device_x_offset, device_y_offset;
- cairo_rectangle_int_t rect;
- int n_rects, i;
- GdkSurface *surface;
- int unscaled_surface_height;
- int surface_scale;
- unsigned int texture_id;
- gboolean use_texture_rectangle;
- guint target;
- double sx, sy;
- float uscale, vscale;
- GdkTexturedQuad *quads;
- GdkX11Display *display_x11;
-
- display_x11 = GDK_X11_DISPLAY (gdk_gl_context_get_display (paint_context));
- if (!display_x11->has_glx_texture_from_pixmap)
- return FALSE;
-
- if (cairo_surface_get_type (cairo_surface) != CAIRO_SURFACE_TYPE_XLIB)
- return FALSE;
-
- use_texture_rectangle = gdk_gl_context_use_texture_rectangle (paint_context);
- if (use_texture_rectangle)
- target = GL_TEXTURE_RECTANGLE_ARB;
- else
- target = GL_TEXTURE_2D;
-
- glx_pixmap = glx_pixmap_get (cairo_surface, target);
- if (glx_pixmap == NULL)
- return FALSE;
-
- GDK_DISPLAY_NOTE (GDK_DISPLAY (display_x11), OPENGL, g_message ("Using GLX_EXT_texture_from_pixmap to draw
surface"));
-
- 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);
-
- /* Ensure all the X stuff are synced before we read it back via texture-from-pixmap */
- glXWaitX();
-
- glGenTextures (1, &texture_id);
- glBindTexture (target, texture_id);
-
- 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);
-
- glXBindTexImageEXT (glx_pixmap->display, glx_pixmap->drawable,
- GLX_FRONT_LEFT_EXT, NULL);
-
- glEnable (GL_SCISSOR_TEST);
-
- n_rects = cairo_region_num_rectangles (region);
- quads = g_new (GdkTexturedQuad, n_rects);
-
-#define FLIP_Y(_y) (unscaled_surface_height - (_y))
-
- cairo_region_get_extents (region, &rect);
- glScissor (rect.x * surface_scale, FLIP_Y((rect.y + rect.height) * surface_scale),
- rect.width * surface_scale, rect.height * surface_scale);
-
- for (i = 0; i < n_rects; i++)
- {
- int src_x, src_y, src_height, src_width;
-
- cairo_region_get_rectangle (region, i, &rect);
-
- src_x = rect.x * sx + device_x_offset;
- src_y = rect.y * sy + device_y_offset;
- src_width = rect.width * sx;
- src_height = rect.height * sy;
-
- if (use_texture_rectangle)
- {
- uscale = 1.0;
- vscale = 1.0;
- }
- else
- {
- uscale = 1.0 / cairo_xlib_surface_get_width (cairo_surface);
- vscale = 1.0 / cairo_xlib_surface_get_height (cairo_surface);
- }
-
- {
- 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),
- uscale * src_x, vscale * src_y,
- uscale * (src_x + src_width), vscale * (src_y + src_height),
- };
-
- quads[i] = quad;
- }
- }
-
-#undef FLIP_Y
-
- gdk_gl_texture_quads (paint_context, target, n_rects, quads, FALSE);
- g_free (quads);
-
- glDisable (GL_SCISSOR_TEST);
-
- glXReleaseTexImageEXT (glx_pixmap->display, glx_pixmap->drawable,
- GLX_FRONT_LEFT_EXT);
-
- glDeleteTextures (1, &texture_id);
-
- glx_pixmap_destroy(glx_pixmap);
-
- return TRUE;
-}
-
static XVisualInfo *
find_xvisinfo_for_fbconfig (GdkDisplay *display,
GLXFBConfig config)
@@ -972,7 +849,6 @@ gdk_x11_gl_context_class_init (GdkX11GLContextClass *klass)
context_class->realize = gdk_x11_gl_context_realize;
context_class->get_damage = gdk_x11_gl_context_get_damage;
- context_class->texture_from_surface = gdk_x11_gl_context_texture_from_surface;
draw_context_class->end_frame = gdk_x11_gl_context_end_frame;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]