[gtk/wip/chergert/macos-iosurface] remove failed double damage test
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/macos-iosurface] remove failed double damage test
- Date: Wed, 9 Feb 2022 15:16:42 +0000 (UTC)
commit b3628657455d8285eecc94aaf9f1d53c55376983
Author: Christian Hergert <christian hergert me>
Date: Wed Feb 9 07:16:35 2022 -0800
remove failed double damage test
gdk/macos/gdkmacoscairocontext.c | 30 ++++++++++++++++++------------
1 file changed, 18 insertions(+), 12 deletions(-)
---
diff --git a/gdk/macos/gdkmacoscairocontext.c b/gdk/macos/gdkmacoscairocontext.c
index adb5a5994e..32c4cab30d 100644
--- a/gdk/macos/gdkmacoscairocontext.c
+++ b/gdk/macos/gdkmacoscairocontext.c
@@ -73,7 +73,6 @@ _gdk_macos_cairo_context_cairo_create (GdkCairoContext *cairo_context)
guint height;
guint stride;
gboolean opaque;
- double x, y, x2, y2;
g_assert (GDK_IS_MACOS_CAIRO_CONTEXT (self));
@@ -92,7 +91,7 @@ _gdk_macos_cairo_context_cairo_create (GdkCairoContext *cairo_context)
base_address = IOSurfaceGetBaseAddress (io_surface);
image_surface = cairo_image_surface_create_for_data (base_address,
- opaque ? CAIRO_FORMAT_RGB24 : CAIRO_FORMAT_ARGB32,
+ CAIRO_FORMAT_ARGB32,
width, height, stride);
cairo_surface_set_device_scale (image_surface, scale, scale);
@@ -104,9 +103,10 @@ _gdk_macos_cairo_context_cairo_create (GdkCairoContext *cairo_context)
/* TODO: Copy from other image back to this one */
- cr = cairo_create (image_surface);
+ if (!(cr = cairo_create (image_surface)))
+ goto failure;
- if (cr != NULL && damage != NULL)
+ if (damage != NULL)
{
gdk_cairo_region (cr, damage);
cairo_clip (cr);
@@ -115,11 +115,22 @@ _gdk_macos_cairo_context_cairo_create (GdkCairoContext *cairo_context)
if (!opaque)
{
cairo_region_t *transparent;
+ cairo_rectangle_int_t r;
cairo_save (cr);
- cairo_clip_extents (cr, &x, &y, &x2, &y2);
- transparent = cairo_region_create_rectangle (&(cairo_rectangle_int_t) { x, y, x2-x, y2-y });
+ if (damage != NULL)
+ {
+ cairo_region_get_extents (damage, &r);
+ }
+ else
+ {
+ r.x = r.y = 0;
+ r.width = width / scale;
+ r.height = height / scale;
+ }
+
+ transparent = cairo_region_create_rectangle (&r);
if (surface->opaque_region)
cairo_region_subtract (transparent, surface->opaque_region);
@@ -132,6 +143,7 @@ _gdk_macos_cairo_context_cairo_create (GdkCairoContext *cairo_context)
cairo_restore (cr);
}
+failure:
cairo_surface_destroy (image_surface);
return cr;
@@ -143,9 +155,7 @@ _gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
cairo_region_t *region)
{
GdkMacosCairoContext *self = (GdkMacosCairoContext *)draw_context;
- const cairo_region_t *front_damage;
GdkMacosBuffer *back;
- GdkMacosBuffer *front;
GdkSurface *surface;
g_assert (GDK_IS_MACOS_CAIRO_CONTEXT (self));
@@ -155,10 +165,6 @@ _gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
surface = gdk_draw_context_get_surface (draw_context);
back = _gdk_macos_surface_get_back_buffer (GDK_MACOS_SURFACE (surface));
- front = _gdk_macos_surface_get_back_buffer (GDK_MACOS_SURFACE (surface));
-
- if ((front_damage = _gdk_macos_buffer_get_damage (front)))
- cairo_region_union (region, front_damage);
_gdk_macos_buffer_set_damage (back, cairo_region_copy (region));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]