diff options
author | Benjamin Otte <otte@redhat.com> | 2018-04-23 17:28:55 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2018-04-24 23:16:58 +0200 |
commit | a8656215195ad3403f8eda727a9116194351ac96 (patch) | |
tree | e2ccecb0b6af48dc6c61a950b3c1d6c0d4e96b27 /gsk | |
parent | 48fc18c37b290f1d4ed57dccce152b75b0232f01 (diff) | |
download | gtk+-a8656215195ad3403f8eda727a9116194351ac96.tar.gz |
gdk: Move begin/end_frame() functions
As they require a draw context and the draw context is already bound to
the surface, it makes much more sense and reduces abiguity by moving
these APIs to the draw context.
As a side effect, we simplify GdkSurface APIs to a point where
GdkSurface now does not concern itself with drawing anymore at all,
apart from being the object that creates draw contexts.
Diffstat (limited to 'gsk')
-rw-r--r-- | gsk/gl/gskglrenderer.c | 5 | ||||
-rw-r--r-- | gsk/gskbroadwayrenderer.c | 4 | ||||
-rw-r--r-- | gsk/gskcairorenderer.c | 8 | ||||
-rw-r--r-- | gsk/vulkan/gskvulkanrenderer.c | 9 |
4 files changed, 10 insertions, 16 deletions
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c index e76c1f8eed..2a11cb53a5 100644 --- a/gsk/gl/gskglrenderer.c +++ b/gsk/gl/gskglrenderer.c @@ -2577,8 +2577,7 @@ gsk_gl_renderer_render (GskRenderer *renderer, gdk_surface_get_height (surface) * self->scale_factor }; - gdk_surface_begin_draw_frame (surface, - GDK_DRAW_CONTEXT (self->gl_context), + gdk_draw_context_begin_frame (GDK_DRAW_CONTEXT (self->gl_context), update_area); damage = gdk_draw_context_get_frame_region (GDK_DRAW_CONTEXT (self->gl_context)); @@ -2612,7 +2611,7 @@ gsk_gl_renderer_render (GskRenderer *renderer, gdk_gl_context_make_current (self->gl_context); gsk_gl_renderer_clear_tree (self); - gdk_surface_end_draw_frame (surface); + gdk_draw_context_end_frame (GDK_DRAW_CONTEXT (self->gl_context)); g_clear_pointer (&self->render_region, cairo_region_destroy); } diff --git a/gsk/gskbroadwayrenderer.c b/gsk/gskbroadwayrenderer.c index ee2a45d6dd..0c118859cc 100644 --- a/gsk/gskbroadwayrenderer.c +++ b/gsk/gskbroadwayrenderer.c @@ -681,7 +681,7 @@ gsk_broadway_renderer_render (GskRenderer *self, gdk_surface_get_width (surface), gdk_surface_get_height (surface) }); - gdk_surface_begin_draw_frame (surface, NULL, whole); + gdk_draw_context_begin_frame (NULL, whole); cairo_region_destroy (whole); nodes = g_array_new (FALSE, FALSE, sizeof(guint32)); @@ -691,7 +691,7 @@ gsk_broadway_renderer_render (GskRenderer *self, g_array_unref (nodes); g_ptr_array_unref (node_textures); - gdk_surface_end_draw_frame (surface); + gdk_draw_context_end_frame (NULL); } static void diff --git a/gsk/gskcairorenderer.c b/gsk/gskcairorenderer.c index 22e723fdb9..3d37e838cb 100644 --- a/gsk/gskcairorenderer.c +++ b/gsk/gskcairorenderer.c @@ -108,11 +108,9 @@ gsk_cairo_renderer_render (GskRenderer *renderer, const cairo_region_t *region) { GskCairoRenderer *self = GSK_CAIRO_RENDERER (renderer); - GdkSurface *surface = gsk_renderer_get_surface (renderer); cairo_t *cr; - gdk_surface_begin_draw_frame (surface, - GDK_DRAW_CONTEXT (self->cairo_context), + gdk_draw_context_begin_frame (GDK_DRAW_CONTEXT (self->cairo_context), region); cr = gdk_cairo_context_cairo_create (self->cairo_context); @@ -121,6 +119,8 @@ gsk_cairo_renderer_render (GskRenderer *renderer, #ifdef G_ENABLE_DEBUG if (GSK_RENDERER_DEBUG_CHECK (renderer, GEOMETRY)) { + GdkSurface *surface = gsk_renderer_get_surface (renderer); + cairo_save (cr); cairo_set_operator (cr, CAIRO_OPERATOR_OVER); cairo_rectangle (cr, @@ -136,7 +136,7 @@ gsk_cairo_renderer_render (GskRenderer *renderer, cairo_destroy (cr); - gdk_surface_end_draw_frame (surface); + gdk_draw_context_end_frame (GDK_DRAW_CONTEXT (self->cairo_context)); } static void diff --git a/gsk/vulkan/gskvulkanrenderer.c b/gsk/vulkan/gskvulkanrenderer.c index c80c4abb13..f948027ec3 100644 --- a/gsk/vulkan/gskvulkanrenderer.c +++ b/gsk/vulkan/gskvulkanrenderer.c @@ -217,15 +217,12 @@ gsk_vulkan_renderer_render (GskRenderer *renderer, { GskVulkanRenderer *self = GSK_VULKAN_RENDERER (renderer); GskVulkanRender *render; - GdkSurface *surface; const cairo_region_t *clip; #ifdef G_ENABLE_DEBUG GskProfiler *profiler; gint64 cpu_time; #endif - surface = gsk_renderer_get_surface (renderer); - #ifdef G_ENABLE_DEBUG profiler = gsk_renderer_get_profiler (renderer); gsk_profiler_counter_set (profiler, self->profile_counters.fallback_pixels, 0); @@ -234,9 +231,7 @@ gsk_vulkan_renderer_render (GskRenderer *renderer, gsk_profiler_timer_begin (profiler, self->profile_timers.cpu_time); #endif - gdk_surface_begin_draw_frame (surface, - GDK_DRAW_CONTEXT (self->vulkan), - region); + gdk_draw_context_begin_frame (GDK_DRAW_CONTEXT (self->vulkan), region); render = self->render; clip = gdk_draw_context_get_frame_region (GDK_DRAW_CONTEXT (self->vulkan)); @@ -257,7 +252,7 @@ gsk_vulkan_renderer_render (GskRenderer *renderer, gsk_profiler_push_samples (profiler); #endif - gdk_surface_end_draw_frame (surface); + gdk_draw_context_end_frame (GDK_DRAW_CONTEXT (self->vulkan)); } static void |