[gtk/wip/chergert/glproto] improve damage rect calculation
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/glproto] improve damage rect calculation
- Date: Fri, 19 Feb 2021 01:57:22 +0000 (UTC)
commit b769e586ae1b2830982fc2da8f2cd6808a4ffd59
Author: Christian Hergert <chergert redhat com>
Date: Thu Feb 18 17:55:24 2021 -0800
improve damage rect calculation
this appears to also be off in the gl renderer, in that it was comparing
damage w/ scale factor applied to one without. This fixes that so we can
fix our calculation when doing animated popovers.
gsk/next/gskglrenderer.c | 20 ++++++++------------
1 file changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/gsk/next/gskglrenderer.c b/gsk/next/gskglrenderer.c
index 6d9fa3fc13..b49e3c75f7 100644
--- a/gsk/next/gskglrenderer.c
+++ b/gsk/next/gskglrenderer.c
@@ -150,25 +150,21 @@ get_render_region (GdkSurface *surface,
const cairo_region_t *damage;
GdkRectangle whole_surface;
GdkRectangle extents;
- float scale_factor;
g_assert (GDK_IS_SURFACE (surface));
g_assert (GDK_IS_GL_CONTEXT (context));
- scale_factor = gdk_surface_get_scale_factor (surface);
-
whole_surface.x = 0;
whole_surface.y = 0;
- whole_surface.width = gdk_surface_get_width (surface) * scale_factor;
- whole_surface.height = gdk_surface_get_height (surface) * scale_factor;
+ whole_surface.width = gdk_surface_get_width (surface);
+ whole_surface.height = gdk_surface_get_height (surface);
+ /* Damage does not have scale factor applied. so we can compare
+ * it to whole surface which also doesn'th have scale factor applied.
+ */
damage = gdk_draw_context_get_frame_region (GDK_DRAW_CONTEXT (context));
- /* NULL means everything in this case, and ensures that we
- * don't setup any complicated clips for full scene redraw.
- */
- if (damage == NULL ||
- cairo_region_contains_rectangle (damage, &whole_surface) == CAIRO_REGION_OVERLAP_IN)
+ if (cairo_region_contains_rectangle (damage, &whole_surface) == CAIRO_REGION_OVERLAP_IN)
return NULL;
/* If the extents match the full-scene, do the same as above */
@@ -176,7 +172,7 @@ get_render_region (GdkSurface *surface,
if (gdk_rectangle_equal (&extents, &whole_surface))
return NULL;
- /* Draw clipped to the bounding-box of the region */
+ /* Draw clipped to the bounding-box of the region. */
return cairo_region_create_rectangle (&extents);
}
@@ -206,7 +202,7 @@ gsk_next_renderer_render (GskRenderer *renderer,
gdk_gl_context_make_current (self->context);
gdk_draw_context_begin_frame (GDK_DRAW_CONTEXT (self->context), update_area);
- /* Must be called *after* gdk_draw_context_begin_frame() */
+ /* Must be called *AFTER* gdk_draw_context_begin_frame() */
render_region = get_render_region (surface, self->context);
gsk_next_driver_begin_frame (self->driver, self->command_queue);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]