mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
gsk: Prepare subsurface offload
Use a GskOffloadInfo to update subsurfaces (and collect info about them). Pass that info to both the diff and the render vfuncs.
This commit is contained in:
parent
48740de71a
commit
b7c2528ad1
@ -919,7 +919,8 @@ gsk_broadway_renderer_add_node (GskRenderer *renderer,
|
||||
static void
|
||||
gsk_broadway_renderer_render (GskRenderer *renderer,
|
||||
GskRenderNode *root,
|
||||
const cairo_region_t *update_area)
|
||||
const cairo_region_t *update_area,
|
||||
GskOffload *offload)
|
||||
{
|
||||
GskBroadwayRenderer *self = GSK_BROADWAY_RENDERER (renderer);
|
||||
|
||||
|
@ -272,7 +272,8 @@ update_area_requires_clear (GdkSurface *surface,
|
||||
static void
|
||||
gsk_gl_renderer_render (GskRenderer *renderer,
|
||||
GskRenderNode *root,
|
||||
const cairo_region_t *update_area)
|
||||
const cairo_region_t *update_area,
|
||||
GskOffload *offload)
|
||||
{
|
||||
GskGLRenderer *self = (GskGLRenderer *)renderer;
|
||||
cairo_region_t *render_region;
|
||||
|
@ -152,7 +152,8 @@ gsk_cairo_renderer_render_texture (GskRenderer *renderer,
|
||||
static void
|
||||
gsk_cairo_renderer_render (GskRenderer *renderer,
|
||||
GskRenderNode *root,
|
||||
const cairo_region_t *region)
|
||||
const cairo_region_t *region,
|
||||
GskOffload *offload)
|
||||
{
|
||||
GskCairoRenderer *self = GSK_CAIRO_RENDERER (renderer);
|
||||
cairo_t *cr;
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "gl/gskglrenderer.h"
|
||||
#include "gskprofilerprivate.h"
|
||||
#include "gskrendernodeprivate.h"
|
||||
#include "gskoffloadprivate.h"
|
||||
|
||||
#include "gskenumtypes.h"
|
||||
|
||||
@ -128,7 +129,8 @@ gsk_renderer_real_render_texture (GskRenderer *self,
|
||||
static void
|
||||
gsk_renderer_real_render (GskRenderer *self,
|
||||
GskRenderNode *root,
|
||||
const cairo_region_t *region)
|
||||
const cairo_region_t *region,
|
||||
GskOffload *offload)
|
||||
{
|
||||
GSK_RENDERER_WARN_NOT_IMPLEMENTED_METHOD (self, render);
|
||||
}
|
||||
@ -424,6 +426,7 @@ gsk_renderer_render (GskRenderer *renderer,
|
||||
{
|
||||
GskRendererPrivate *priv = gsk_renderer_get_instance_private (renderer);
|
||||
cairo_region_t *clip;
|
||||
GskOffload *offload = NULL;
|
||||
|
||||
g_return_if_fail (GSK_IS_RENDERER (renderer));
|
||||
g_return_if_fail (priv->is_realized);
|
||||
@ -433,6 +436,11 @@ gsk_renderer_render (GskRenderer *renderer,
|
||||
if (priv->surface == NULL)
|
||||
return;
|
||||
|
||||
priv->root_node = gsk_render_node_ref (root);
|
||||
|
||||
if (!GSK_RENDERER_DEBUG_CHECK (renderer, OFFLOAD_DISABLE))
|
||||
offload = gsk_offload_new (priv->surface, root);
|
||||
|
||||
if (region == NULL || priv->prev_node == NULL || GSK_RENDERER_DEBUG_CHECK (renderer, FULL_REDRAW))
|
||||
{
|
||||
clip = cairo_region_create_rectangle (&(GdkRectangle) {
|
||||
@ -444,18 +452,11 @@ gsk_renderer_render (GskRenderer *renderer,
|
||||
else
|
||||
{
|
||||
clip = cairo_region_copy (region);
|
||||
gsk_render_node_diff (priv->prev_node, root, clip, NULL);
|
||||
|
||||
if (cairo_region_is_empty (clip))
|
||||
{
|
||||
cairo_region_destroy (clip);
|
||||
return;
|
||||
}
|
||||
gsk_render_node_diff (priv->prev_node, root, clip, offload);
|
||||
}
|
||||
|
||||
priv->root_node = gsk_render_node_ref (root);
|
||||
|
||||
GSK_RENDERER_GET_CLASS (renderer)->render (renderer, root, clip);
|
||||
GSK_RENDERER_GET_CLASS (renderer)->render (renderer, root, clip, offload);
|
||||
|
||||
if (GSK_RENDERER_DEBUG_CHECK (renderer, RENDERER))
|
||||
{
|
||||
@ -474,6 +475,7 @@ gsk_renderer_render (GskRenderer *renderer,
|
||||
|
||||
g_clear_pointer (&priv->prev_node, gsk_render_node_unref);
|
||||
cairo_region_destroy (clip);
|
||||
gsk_offload_free (offload);
|
||||
priv->prev_node = priv->root_node;
|
||||
priv->root_node = NULL;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "gskrenderer.h"
|
||||
#include "gskprofilerprivate.h"
|
||||
#include "gskdebugprivate.h"
|
||||
#include "gskoffloadprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -47,7 +48,8 @@ struct _GskRendererClass
|
||||
const graphene_rect_t *viewport);
|
||||
void (* render) (GskRenderer *renderer,
|
||||
GskRenderNode *root,
|
||||
const cairo_region_t *invalid);
|
||||
const cairo_region_t *invalid,
|
||||
GskOffload *offload);
|
||||
};
|
||||
|
||||
GskProfiler * gsk_renderer_get_profiler (GskRenderer *renderer);
|
||||
|
@ -349,7 +349,8 @@ gsk_vulkan_renderer_render_texture (GskRenderer *renderer,
|
||||
static void
|
||||
gsk_vulkan_renderer_render (GskRenderer *renderer,
|
||||
GskRenderNode *root,
|
||||
const cairo_region_t *region)
|
||||
const cairo_region_t *region,
|
||||
GskOffload *offload)
|
||||
{
|
||||
GskVulkanRenderer *self = GSK_VULKAN_RENDERER (renderer);
|
||||
GskVulkanRender *render;
|
||||
|
Loading…
Reference in New Issue
Block a user