offload: No need to pass the offload to the diff

We can just check if the subsurfaces contain content - and if they do,
they will be offloading and we can ignore the diff.

This essentially reverts 48740de71a
This commit is contained in:
Benjamin Otte 2024-02-10 07:34:07 +01:00 committed by Matthias Clasen
parent dac56dd757
commit 30afac9a6b
8 changed files with 124 additions and 158 deletions

View File

@ -42,6 +42,7 @@
#include "gsktransformprivate.h" #include "gsktransformprivate.h"
#include "gdk/gdkrgbaprivate.h" #include "gdk/gdkrgbaprivate.h"
#include "gdk/gdksubsurfaceprivate.h"
/* A note about coordinate systems /* A note about coordinate systems
* *

View File

@ -503,7 +503,7 @@ gsk_renderer_render (GskRenderer *renderer,
} }
else else
{ {
gsk_render_node_diff (priv->prev_node, root, clip, offload); gsk_render_node_diff (priv->prev_node, root, clip);
} }
renderer_class->render (renderer, root, clip); renderer_class->render (renderer, root, clip);

View File

@ -154,9 +154,9 @@ gsk_render_node_real_can_diff (const GskRenderNode *node1,
static void static void
gsk_render_node_real_diff (GskRenderNode *node1, gsk_render_node_real_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
static void static void
@ -505,14 +505,14 @@ rectangle_init_from_graphene (cairo_rectangle_int_t *cairo,
void void
gsk_render_node_diff_impossible (GskRenderNode *node1, gsk_render_node_diff_impossible (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
cairo_rectangle_int_t rect; cairo_rectangle_int_t rect;
rectangle_init_from_graphene (&rect, &node1->bounds); rectangle_init_from_graphene (&rect, &node1->bounds);
cairo_region_union_rectangle (data->region, &rect); cairo_region_union_rectangle (region, &rect);
rectangle_init_from_graphene (&rect, &node2->bounds); rectangle_init_from_graphene (&rect, &node2->bounds);
cairo_region_union_rectangle (data->region, &rect); cairo_region_union_rectangle (region, &rect);
} }
/** /**
@ -520,7 +520,6 @@ gsk_render_node_diff_impossible (GskRenderNode *node1,
* @node1: a `GskRenderNode` * @node1: a `GskRenderNode`
* @node2: the `GskRenderNode` to compare with * @node2: the `GskRenderNode` to compare with
* @region: a `cairo_region_t` to add the differences to * @region: a `cairo_region_t` to add the differences to
* @subsurfaces: (nullable): array to add offload info to
* *
* Compares @node1 and @node2 trying to compute the minimal region of changes. * Compares @node1 and @node2 trying to compute the minimal region of changes.
* *
@ -533,47 +532,30 @@ gsk_render_node_diff_impossible (GskRenderNode *node1,
* *
* Note that the passed in @region may already contain previous results from * Note that the passed in @region may already contain previous results from
* previous node comparisons, so this function call will only add to it. * previous node comparisons, so this function call will only add to it.
*
* If @subsurface_nodes is not `NULL`, then we treat subsurface nodes as
* identical if they refer to the same subsurface and have the same bounds.
* In this case, we collect subsurface nodes we see in @subsurface_nodes,
* for later updating of the attached textures.
*
* If @subsurface_area is not `NULL`, it will collect the full area of all
* subsurface nodes we meet.
*/ */
void void
gsk_render_node_diff (GskRenderNode *node1, gsk_render_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
cairo_region_t *region, cairo_region_t *region)
GskOffload *offload)
{
gsk_render_node_data_diff (node1, node2, &(GskDiffData) { region, offload });
}
void
gsk_render_node_data_diff (GskRenderNode *node1,
GskRenderNode *node2,
GskDiffData *data)
{ {
if (node1 == node2) if (node1 == node2)
return; return;
if (_gsk_render_node_get_node_type (node1) == _gsk_render_node_get_node_type (node2)) if (_gsk_render_node_get_node_type (node1) == _gsk_render_node_get_node_type (node2))
{ {
GSK_RENDER_NODE_GET_CLASS (node1)->diff (node1, node2, data); GSK_RENDER_NODE_GET_CLASS (node1)->diff (node1, node2, region);
} }
else if (_gsk_render_node_get_node_type (node1) == GSK_CONTAINER_NODE) else if (_gsk_render_node_get_node_type (node1) == GSK_CONTAINER_NODE)
{ {
gsk_container_node_diff_with (node1, node2, data); gsk_container_node_diff_with (node1, node2, region);
} }
else if (_gsk_render_node_get_node_type (node2) == GSK_CONTAINER_NODE) else if (_gsk_render_node_get_node_type (node2) == GSK_CONTAINER_NODE)
{ {
gsk_container_node_diff_with (node2, node1, data); gsk_container_node_diff_with (node2, node1, region);
} }
else else
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
} }

View File

@ -31,7 +31,6 @@
#include "gskroundedrectprivate.h" #include "gskroundedrectprivate.h"
#include "gskstrokeprivate.h" #include "gskstrokeprivate.h"
#include "gsktransformprivate.h" #include "gsktransformprivate.h"
#include "gskoffloadprivate.h"
#include "gdk/gdkmemoryformatprivate.h" #include "gdk/gdkmemoryformatprivate.h"
#include "gdk/gdkprivate.h" #include "gdk/gdkprivate.h"
@ -167,7 +166,7 @@ gsk_color_node_draw (GskRenderNode *node,
static void static void
gsk_color_node_diff (GskRenderNode *node1, gsk_color_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskColorNode *self1 = (GskColorNode *) node1; GskColorNode *self1 = (GskColorNode *) node1;
GskColorNode *self2 = (GskColorNode *) node2; GskColorNode *self2 = (GskColorNode *) node2;
@ -176,7 +175,7 @@ gsk_color_node_diff (GskRenderNode *node1,
gdk_rgba_equal (&self1->color, &self2->color)) gdk_rgba_equal (&self1->color, &self2->color))
return; return;
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
static void static void
@ -323,7 +322,7 @@ gsk_linear_gradient_node_draw (GskRenderNode *node,
static void static void
gsk_linear_gradient_node_diff (GskRenderNode *node1, gsk_linear_gradient_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskLinearGradientNode *self1 = (GskLinearGradientNode *) node1; GskLinearGradientNode *self1 = (GskLinearGradientNode *) node1;
GskLinearGradientNode *self2 = (GskLinearGradientNode *) node2; GskLinearGradientNode *self2 = (GskLinearGradientNode *) node2;
@ -343,14 +342,14 @@ gsk_linear_gradient_node_diff (GskRenderNode *node1,
gdk_rgba_equal (&stop1->color, &stop2->color)) gdk_rgba_equal (&stop1->color, &stop2->color))
continue; continue;
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
return; return;
} }
return; return;
} }
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
static void static void
@ -652,7 +651,7 @@ gsk_radial_gradient_node_draw (GskRenderNode *node,
static void static void
gsk_radial_gradient_node_diff (GskRenderNode *node1, gsk_radial_gradient_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskRadialGradientNode *self1 = (GskRadialGradientNode *) node1; GskRadialGradientNode *self1 = (GskRadialGradientNode *) node1;
GskRadialGradientNode *self2 = (GskRadialGradientNode *) node2; GskRadialGradientNode *self2 = (GskRadialGradientNode *) node2;
@ -675,14 +674,14 @@ gsk_radial_gradient_node_diff (GskRenderNode *node1,
gdk_rgba_equal (&stop1->color, &stop2->color)) gdk_rgba_equal (&stop1->color, &stop2->color))
continue; continue;
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
return; return;
} }
return; return;
} }
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
static void static void
@ -1143,7 +1142,7 @@ gsk_conic_gradient_node_draw (GskRenderNode *node,
static void static void
gsk_conic_gradient_node_diff (GskRenderNode *node1, gsk_conic_gradient_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskConicGradientNode *self1 = (GskConicGradientNode *) node1; GskConicGradientNode *self1 = (GskConicGradientNode *) node1;
GskConicGradientNode *self2 = (GskConicGradientNode *) node2; GskConicGradientNode *self2 = (GskConicGradientNode *) node2;
@ -1153,7 +1152,7 @@ gsk_conic_gradient_node_diff (GskRenderNode *node1,
self1->rotation != self2->rotation || self1->rotation != self2->rotation ||
self1->n_stops != self2->n_stops) self1->n_stops != self2->n_stops)
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
return; return;
} }
@ -1165,7 +1164,7 @@ gsk_conic_gradient_node_diff (GskRenderNode *node1,
if (stop1->offset != stop2->offset || if (stop1->offset != stop2->offset ||
!gdk_rgba_equal (&stop1->color, &stop2->color)) !gdk_rgba_equal (&stop1->color, &stop2->color))
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
return; return;
} }
} }
@ -1495,7 +1494,7 @@ gsk_border_node_draw (GskRenderNode *node,
static void static void
gsk_border_node_diff (GskRenderNode *node1, gsk_border_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskBorderNode *self1 = (GskBorderNode *) node1; GskBorderNode *self1 = (GskBorderNode *) node1;
GskBorderNode *self2 = (GskBorderNode *) node2; GskBorderNode *self2 = (GskBorderNode *) node2;
@ -1512,7 +1511,7 @@ gsk_border_node_diff (GskRenderNode *node1,
/* Different uniformity -> diff impossible */ /* Different uniformity -> diff impossible */
if (uniform1 ^ uniform2) if (uniform1 ^ uniform2)
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
return; return;
} }
@ -1527,7 +1526,7 @@ gsk_border_node_diff (GskRenderNode *node1,
gsk_rounded_rect_equal (&self1->outline, &self2->outline)) gsk_rounded_rect_equal (&self1->outline, &self2->outline))
return; return;
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
static void static void
@ -1786,7 +1785,7 @@ gsk_texture_node_draw (GskRenderNode *node,
static void static void
gsk_texture_node_diff (GskRenderNode *node1, gsk_texture_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskTextureNode *self1 = (GskTextureNode *) node1; GskTextureNode *self1 = (GskTextureNode *) node1;
GskTextureNode *self2 = (GskTextureNode *) node2; GskTextureNode *self2 = (GskTextureNode *) node2;
@ -1796,7 +1795,7 @@ gsk_texture_node_diff (GskRenderNode *node1,
gdk_texture_get_width (self1->texture) != gdk_texture_get_width (self2->texture) || gdk_texture_get_width (self1->texture) != gdk_texture_get_width (self2->texture) ||
gdk_texture_get_height (self1->texture) != gdk_texture_get_height (self2->texture)) gdk_texture_get_height (self1->texture) != gdk_texture_get_height (self2->texture))
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
return; return;
} }
@ -1805,7 +1804,7 @@ gsk_texture_node_diff (GskRenderNode *node1,
sub = cairo_region_create (); sub = cairo_region_create ();
gdk_texture_diff (self1->texture, self2->texture, sub); gdk_texture_diff (self1->texture, self2->texture, sub);
region_union_region_affine (data->region, region_union_region_affine (region,
sub, sub,
node1->bounds.size.width / gdk_texture_get_width (self1->texture), node1->bounds.size.width / gdk_texture_get_width (self1->texture),
node1->bounds.size.height / gdk_texture_get_height (self1->texture), node1->bounds.size.height / gdk_texture_get_height (self1->texture),
@ -1972,7 +1971,7 @@ gsk_texture_scale_node_draw (GskRenderNode *node,
static void static void
gsk_texture_scale_node_diff (GskRenderNode *node1, gsk_texture_scale_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskTextureScaleNode *self1 = (GskTextureScaleNode *) node1; GskTextureScaleNode *self1 = (GskTextureScaleNode *) node1;
GskTextureScaleNode *self2 = (GskTextureScaleNode *) node2; GskTextureScaleNode *self2 = (GskTextureScaleNode *) node2;
@ -1983,7 +1982,7 @@ gsk_texture_scale_node_diff (GskRenderNode *node1,
gdk_texture_get_width (self1->texture) != gdk_texture_get_width (self2->texture) || gdk_texture_get_width (self1->texture) != gdk_texture_get_width (self2->texture) ||
gdk_texture_get_height (self1->texture) != gdk_texture_get_height (self2->texture)) gdk_texture_get_height (self1->texture) != gdk_texture_get_height (self2->texture))
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
return; return;
} }
@ -1992,7 +1991,7 @@ gsk_texture_scale_node_diff (GskRenderNode *node1,
sub = cairo_region_create (); sub = cairo_region_create ();
gdk_texture_diff (self1->texture, self2->texture, sub); gdk_texture_diff (self1->texture, self2->texture, sub);
region_union_region_affine (data->region, region_union_region_affine (region,
sub, sub,
node1->bounds.size.width / gdk_texture_get_width (self1->texture), node1->bounds.size.width / gdk_texture_get_width (self1->texture),
node1->bounds.size.height / gdk_texture_get_height (self1->texture), node1->bounds.size.height / gdk_texture_get_height (self1->texture),
@ -2495,7 +2494,7 @@ gsk_inset_shadow_node_draw (GskRenderNode *node,
static void static void
gsk_inset_shadow_node_diff (GskRenderNode *node1, gsk_inset_shadow_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskInsetShadowNode *self1 = (GskInsetShadowNode *) node1; GskInsetShadowNode *self1 = (GskInsetShadowNode *) node1;
GskInsetShadowNode *self2 = (GskInsetShadowNode *) node2; GskInsetShadowNode *self2 = (GskInsetShadowNode *) node2;
@ -2508,7 +2507,7 @@ gsk_inset_shadow_node_diff (GskRenderNode *node1,
self1->blur_radius == self2->blur_radius) self1->blur_radius == self2->blur_radius)
return; return;
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
static void static void
@ -2808,7 +2807,7 @@ gsk_outset_shadow_node_draw (GskRenderNode *node,
static void static void
gsk_outset_shadow_node_diff (GskRenderNode *node1, gsk_outset_shadow_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskOutsetShadowNode *self1 = (GskOutsetShadowNode *) node1; GskOutsetShadowNode *self1 = (GskOutsetShadowNode *) node1;
GskOutsetShadowNode *self2 = (GskOutsetShadowNode *) node2; GskOutsetShadowNode *self2 = (GskOutsetShadowNode *) node2;
@ -2821,7 +2820,7 @@ gsk_outset_shadow_node_diff (GskRenderNode *node1,
self1->blur_radius == self2->blur_radius) self1->blur_radius == self2->blur_radius)
return; return;
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
static void static void
@ -3188,10 +3187,8 @@ gsk_container_node_compare_func (gconstpointer elem1, gconstpointer elem2, gpoin
static GskDiffResult static GskDiffResult
gsk_container_node_keep_func (gconstpointer elem1, gconstpointer elem2, gpointer data) gsk_container_node_keep_func (gconstpointer elem1, gconstpointer elem2, gpointer data)
{ {
GskDiffData *gd = data; gsk_render_node_diff ((GskRenderNode *) elem1, (GskRenderNode *) elem2, data);
if (cairo_region_num_rectangles (data) > MAX_RECTS_IN_DIFF)
gsk_render_node_data_diff ((GskRenderNode *) elem1, (GskRenderNode *) elem2, gd);
if (cairo_region_num_rectangles (gd->region) > MAX_RECTS_IN_DIFF)
return GSK_DIFF_ABORTED; return GSK_DIFF_ABORTED;
return GSK_DIFF_OK; return GSK_DIFF_OK;
@ -3201,12 +3198,12 @@ static GskDiffResult
gsk_container_node_change_func (gconstpointer elem, gsize idx, gpointer data) gsk_container_node_change_func (gconstpointer elem, gsize idx, gpointer data)
{ {
const GskRenderNode *node = elem; const GskRenderNode *node = elem;
GskDiffData *gd = data; cairo_region_t *region = data;
cairo_rectangle_int_t rect; cairo_rectangle_int_t rect;
gsk_rect_to_cairo_grow (&node->bounds, &rect); gsk_rect_to_cairo_grow (&node->bounds, &rect);
cairo_region_union_rectangle (gd->region, &rect); cairo_region_union_rectangle (region, &rect);
if (cairo_region_num_rectangles (gd->region) > MAX_RECTS_IN_DIFF) if (cairo_region_num_rectangles (region) > MAX_RECTS_IN_DIFF)
return GSK_DIFF_ABORTED; return GSK_DIFF_ABORTED;
return GSK_DIFF_OK; return GSK_DIFF_OK;
@ -3234,18 +3231,18 @@ gsk_render_node_diff_multiple (GskRenderNode **nodes1,
gsize n_nodes1, gsize n_nodes1,
GskRenderNode **nodes2, GskRenderNode **nodes2,
gsize n_nodes2, gsize n_nodes2,
GskDiffData *data) cairo_region_t *region)
{ {
return gsk_diff ((gconstpointer *) nodes1, n_nodes1, return gsk_diff ((gconstpointer *) nodes1, n_nodes1,
(gconstpointer *) nodes2, n_nodes2, (gconstpointer *) nodes2, n_nodes2,
gsk_container_node_get_diff_settings (), gsk_container_node_get_diff_settings (),
data) == GSK_DIFF_OK; region) == GSK_DIFF_OK;
} }
void void
gsk_container_node_diff_with (GskRenderNode *container, gsk_container_node_diff_with (GskRenderNode *container,
GskRenderNode *other, GskRenderNode *other,
GskDiffData *data) cairo_region_t *region)
{ {
GskContainerNode *self = (GskContainerNode *) container; GskContainerNode *self = (GskContainerNode *) container;
@ -3253,16 +3250,16 @@ gsk_container_node_diff_with (GskRenderNode *container,
self->n_children, self->n_children,
&other, &other,
1, 1,
data)) region))
return; return;
gsk_render_node_diff_impossible (container, other, data); gsk_render_node_diff_impossible (container, other, region);
} }
static void static void
gsk_container_node_diff (GskRenderNode *node1, gsk_container_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskContainerNode *self1 = (GskContainerNode *) node1; GskContainerNode *self1 = (GskContainerNode *) node1;
GskContainerNode *self2 = (GskContainerNode *) node2; GskContainerNode *self2 = (GskContainerNode *) node2;
@ -3271,10 +3268,10 @@ gsk_container_node_diff (GskRenderNode *node1,
self1->n_children, self1->n_children,
self2->children, self2->children,
self2->n_children, self2->n_children,
data)) region))
return; return;
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
static void static void
@ -3491,14 +3488,14 @@ gsk_transform_node_can_diff (const GskRenderNode *node1,
static void static void
gsk_transform_node_diff (GskRenderNode *node1, gsk_transform_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskTransformNode *self1 = (GskTransformNode *) node1; GskTransformNode *self1 = (GskTransformNode *) node1;
GskTransformNode *self2 = (GskTransformNode *) node2; GskTransformNode *self2 = (GskTransformNode *) node2;
if (!gsk_transform_equal (self1->transform, self2->transform)) if (!gsk_transform_equal (self1->transform, self2->transform))
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
return; return;
} }
@ -3508,7 +3505,7 @@ gsk_transform_node_diff (GskRenderNode *node1,
switch (gsk_transform_get_category (self1->transform)) switch (gsk_transform_get_category (self1->transform))
{ {
case GSK_TRANSFORM_CATEGORY_IDENTITY: case GSK_TRANSFORM_CATEGORY_IDENTITY:
gsk_render_node_data_diff (self1->child, self2->child, data); gsk_render_node_diff (self1->child, self2->child, region);
break; break;
case GSK_TRANSFORM_CATEGORY_2D_TRANSLATE: case GSK_TRANSFORM_CATEGORY_2D_TRANSLATE:
@ -3517,7 +3514,7 @@ gsk_transform_node_diff (GskRenderNode *node1,
float dx, dy; float dx, dy;
gsk_transform_to_translate (self1->transform, &dx, &dy); gsk_transform_to_translate (self1->transform, &dx, &dy);
sub = cairo_region_create (); sub = cairo_region_create ();
gsk_render_node_data_diff (self1->child, self2->child, &(GskDiffData) {sub, data->offload }); gsk_render_node_diff (self1->child, self2->child, sub);
cairo_region_translate (sub, floorf (dx), floorf (dy)); cairo_region_translate (sub, floorf (dx), floorf (dy));
if (floorf (dx) != dx) if (floorf (dx) != dx)
{ {
@ -3533,7 +3530,7 @@ gsk_transform_node_diff (GskRenderNode *node1,
cairo_region_union (sub, tmp); cairo_region_union (sub, tmp);
cairo_region_destroy (tmp); cairo_region_destroy (tmp);
} }
cairo_region_union (data->region, sub); cairo_region_union (region, sub);
cairo_region_destroy (sub); cairo_region_destroy (sub);
} }
break; break;
@ -3544,8 +3541,8 @@ gsk_transform_node_diff (GskRenderNode *node1,
float scale_x, scale_y, dx, dy; float scale_x, scale_y, dx, dy;
gsk_transform_to_affine (self1->transform, &scale_x, &scale_y, &dx, &dy); gsk_transform_to_affine (self1->transform, &scale_x, &scale_y, &dx, &dy);
sub = cairo_region_create (); sub = cairo_region_create ();
gsk_render_node_data_diff (self1->child, self2->child, &(GskDiffData) { sub, data->offload }); gsk_render_node_diff (self1->child, self2->child, sub);
region_union_region_affine (data->region, sub, scale_x, scale_y, dx, dy); region_union_region_affine (region, sub, scale_x, scale_y, dx, dy);
cairo_region_destroy (sub); cairo_region_destroy (sub);
} }
break; break;
@ -3555,7 +3552,7 @@ gsk_transform_node_diff (GskRenderNode *node1,
case GSK_TRANSFORM_CATEGORY_3D: case GSK_TRANSFORM_CATEGORY_3D:
case GSK_TRANSFORM_CATEGORY_2D: case GSK_TRANSFORM_CATEGORY_2D:
default: default:
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
break; break;
} }
} }
@ -3709,15 +3706,15 @@ gsk_opacity_node_draw (GskRenderNode *node,
static void static void
gsk_opacity_node_diff (GskRenderNode *node1, gsk_opacity_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskOpacityNode *self1 = (GskOpacityNode *) node1; GskOpacityNode *self1 = (GskOpacityNode *) node1;
GskOpacityNode *self2 = (GskOpacityNode *) node2; GskOpacityNode *self2 = (GskOpacityNode *) node2;
if (self1->opacity == self2->opacity) if (self1->opacity == self2->opacity)
gsk_render_node_data_diff (self1->child, self2->child, data); gsk_render_node_diff (self1->child, self2->child, region);
else else
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
static void static void
@ -3923,7 +3920,7 @@ gsk_color_matrix_node_draw (GskRenderNode *node,
static void static void
gsk_color_matrix_node_diff (GskRenderNode *node1, gsk_color_matrix_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskColorMatrixNode *self1 = (GskColorMatrixNode *) node1; GskColorMatrixNode *self1 = (GskColorMatrixNode *) node1;
GskColorMatrixNode *self2 = (GskColorMatrixNode *) node2; GskColorMatrixNode *self2 = (GskColorMatrixNode *) node2;
@ -3934,11 +3931,11 @@ gsk_color_matrix_node_diff (GskRenderNode *node1,
if (!graphene_matrix_equal_fast (&self1->color_matrix, &self2->color_matrix)) if (!graphene_matrix_equal_fast (&self1->color_matrix, &self2->color_matrix))
goto nope; goto nope;
gsk_render_node_data_diff (self1->child, self2->child, data); gsk_render_node_diff (self1->child, self2->child, region);
return; return;
nope: nope:
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
return; return;
} }
@ -4217,7 +4214,7 @@ gsk_repeat_node_draw (GskRenderNode *node,
static void static void
gsk_repeat_node_diff (GskRenderNode *node1, gsk_repeat_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskRepeatNode *self1 = (GskRepeatNode *) node1; GskRepeatNode *self1 = (GskRepeatNode *) node1;
GskRepeatNode *self2 = (GskRepeatNode *) node2; GskRepeatNode *self2 = (GskRepeatNode *) node2;
@ -4228,7 +4225,7 @@ gsk_repeat_node_diff (GskRenderNode *node1,
cairo_region_t *sub; cairo_region_t *sub;
sub = cairo_region_create(); sub = cairo_region_create();
gsk_render_node_data_diff (self1->child, self2->child, &(GskDiffData) {sub, data->offload }); gsk_render_node_diff (self1->child, self2->child, sub);
if (cairo_region_is_empty (sub)) if (cairo_region_is_empty (sub))
{ {
cairo_region_destroy (sub); cairo_region_destroy (sub);
@ -4237,7 +4234,7 @@ gsk_repeat_node_diff (GskRenderNode *node1,
cairo_region_destroy (sub); cairo_region_destroy (sub);
} }
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
static void static void
@ -4372,7 +4369,7 @@ gsk_clip_node_draw (GskRenderNode *node,
static void static void
gsk_clip_node_diff (GskRenderNode *node1, gsk_clip_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskClipNode *self1 = (GskClipNode *) node1; GskClipNode *self1 = (GskClipNode *) node1;
GskClipNode *self2 = (GskClipNode *) node2; GskClipNode *self2 = (GskClipNode *) node2;
@ -4383,15 +4380,15 @@ gsk_clip_node_diff (GskRenderNode *node1,
cairo_rectangle_int_t clip_rect; cairo_rectangle_int_t clip_rect;
sub = cairo_region_create(); sub = cairo_region_create();
gsk_render_node_data_diff (self1->child, self2->child, &(GskDiffData) {sub, data->offload }); gsk_render_node_diff (self1->child, self2->child, sub);
gsk_rect_to_cairo_grow (&self1->clip, &clip_rect); gsk_rect_to_cairo_grow (&self1->clip, &clip_rect);
cairo_region_intersect_rectangle (sub, &clip_rect); cairo_region_intersect_rectangle (sub, &clip_rect);
cairo_region_union (data->region, sub); cairo_region_union (region, sub);
cairo_region_destroy (sub); cairo_region_destroy (sub);
} }
else else
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
} }
@ -4520,7 +4517,7 @@ gsk_rounded_clip_node_draw (GskRenderNode *node,
static void static void
gsk_rounded_clip_node_diff (GskRenderNode *node1, gsk_rounded_clip_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskRoundedClipNode *self1 = (GskRoundedClipNode *) node1; GskRoundedClipNode *self1 = (GskRoundedClipNode *) node1;
GskRoundedClipNode *self2 = (GskRoundedClipNode *) node2; GskRoundedClipNode *self2 = (GskRoundedClipNode *) node2;
@ -4531,15 +4528,15 @@ gsk_rounded_clip_node_diff (GskRenderNode *node1,
cairo_rectangle_int_t clip_rect; cairo_rectangle_int_t clip_rect;
sub = cairo_region_create(); sub = cairo_region_create();
gsk_render_node_data_diff (self1->child, self2->child, &(GskDiffData) { sub, data->offload }); gsk_render_node_diff (self1->child, self2->child, sub);
gsk_rect_to_cairo_grow (&self1->clip.bounds, &clip_rect); gsk_rect_to_cairo_grow (&self1->clip.bounds, &clip_rect);
cairo_region_intersect_rectangle (sub, &clip_rect); cairo_region_intersect_rectangle (sub, &clip_rect);
cairo_region_union (data->region, sub); cairo_region_union (region, sub);
cairo_region_destroy (sub); cairo_region_destroy (sub);
} }
else else
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
} }
@ -4690,7 +4687,7 @@ gsk_fill_node_draw (GskRenderNode *node,
static void static void
gsk_fill_node_diff (GskRenderNode *node1, gsk_fill_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskFillNode *self1 = (GskFillNode *) node1; GskFillNode *self1 = (GskFillNode *) node1;
GskFillNode *self2 = (GskFillNode *) node2; GskFillNode *self2 = (GskFillNode *) node2;
@ -4701,15 +4698,15 @@ gsk_fill_node_diff (GskRenderNode *node1,
cairo_rectangle_int_t clip_rect; cairo_rectangle_int_t clip_rect;
sub = cairo_region_create(); sub = cairo_region_create();
gsk_render_node_data_diff (self1->child, self2->child, &(GskDiffData) { sub, data->offload }); gsk_render_node_diff (self1->child, self2->child, sub);
gsk_rect_to_cairo_grow (&node1->bounds, &clip_rect); gsk_rect_to_cairo_grow (&node1->bounds, &clip_rect);
cairo_region_intersect_rectangle (sub, &clip_rect); cairo_region_intersect_rectangle (sub, &clip_rect);
cairo_region_union (data->region, sub); cairo_region_union (region, sub);
cairo_region_destroy (sub); cairo_region_destroy (sub);
} }
else else
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
} }
@ -4893,7 +4890,7 @@ gsk_stroke_node_draw (GskRenderNode *node,
static void static void
gsk_stroke_node_diff (GskRenderNode *node1, gsk_stroke_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskStrokeNode *self1 = (GskStrokeNode *) node1; GskStrokeNode *self1 = (GskStrokeNode *) node1;
GskStrokeNode *self2 = (GskStrokeNode *) node2; GskStrokeNode *self2 = (GskStrokeNode *) node2;
@ -4905,15 +4902,15 @@ gsk_stroke_node_diff (GskRenderNode *node1,
cairo_rectangle_int_t clip_rect; cairo_rectangle_int_t clip_rect;
sub = cairo_region_create(); sub = cairo_region_create();
gsk_render_node_data_diff (self1->child, self2->child, &(GskDiffData) { sub, data->offload }); gsk_render_node_diff (self1->child, self2->child, sub);
gsk_rect_to_cairo_grow (&node1->bounds, &clip_rect); gsk_rect_to_cairo_grow (&node1->bounds, &clip_rect);
cairo_region_intersect_rectangle (sub, &clip_rect); cairo_region_intersect_rectangle (sub, &clip_rect);
cairo_region_union (data->region, sub); cairo_region_union (region, sub);
cairo_region_destroy (sub); cairo_region_destroy (sub);
} }
else else
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
} }
@ -5110,7 +5107,7 @@ gsk_shadow_node_draw (GskRenderNode *node,
static void static void
gsk_shadow_node_diff (GskRenderNode *node1, gsk_shadow_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskShadowNode *self1 = (GskShadowNode *) node1; GskShadowNode *self1 = (GskShadowNode *) node1;
GskShadowNode *self2 = (GskShadowNode *) node2; GskShadowNode *self2 = (GskShadowNode *) node2;
@ -5121,7 +5118,7 @@ gsk_shadow_node_diff (GskRenderNode *node1,
if (self1->n_shadows != self2->n_shadows) if (self1->n_shadows != self2->n_shadows)
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
return; return;
} }
@ -5136,7 +5133,7 @@ gsk_shadow_node_diff (GskRenderNode *node1,
shadow1->dy != shadow2->dy || shadow1->dy != shadow2->dy ||
shadow1->radius != shadow2->radius) shadow1->radius != shadow2->radius)
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
return; return;
} }
@ -5148,7 +5145,7 @@ gsk_shadow_node_diff (GskRenderNode *node1,
} }
sub = cairo_region_create (); sub = cairo_region_create ();
gsk_render_node_data_diff (self1->child, self2->child, &(GskDiffData) { sub, data->offload }); gsk_render_node_diff (self1->child, self2->child, sub);
n = cairo_region_num_rectangles (sub); n = cairo_region_num_rectangles (sub);
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
@ -5158,7 +5155,7 @@ gsk_shadow_node_diff (GskRenderNode *node1,
rect.y -= top; rect.y -= top;
rect.width += left + right; rect.width += left + right;
rect.height += top + bottom; rect.height += top + bottom;
cairo_region_union_rectangle (data->region, &rect); cairo_region_union_rectangle (region, &rect);
} }
cairo_region_destroy (sub); cairo_region_destroy (sub);
} }
@ -5386,19 +5383,19 @@ gsk_blend_node_draw (GskRenderNode *node,
static void static void
gsk_blend_node_diff (GskRenderNode *node1, gsk_blend_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskBlendNode *self1 = (GskBlendNode *) node1; GskBlendNode *self1 = (GskBlendNode *) node1;
GskBlendNode *self2 = (GskBlendNode *) node2; GskBlendNode *self2 = (GskBlendNode *) node2;
if (self1->blend_mode == self2->blend_mode) if (self1->blend_mode == self2->blend_mode)
{ {
gsk_render_node_data_diff (self1->top, self2->top, data); gsk_render_node_diff (self1->top, self2->top, region);
gsk_render_node_data_diff (self1->bottom, self2->bottom, data); gsk_render_node_diff (self1->bottom, self2->bottom, region);
} }
else else
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
} }
@ -5556,19 +5553,19 @@ gsk_cross_fade_node_draw (GskRenderNode *node,
static void static void
gsk_cross_fade_node_diff (GskRenderNode *node1, gsk_cross_fade_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskCrossFadeNode *self1 = (GskCrossFadeNode *) node1; GskCrossFadeNode *self1 = (GskCrossFadeNode *) node1;
GskCrossFadeNode *self2 = (GskCrossFadeNode *) node2; GskCrossFadeNode *self2 = (GskCrossFadeNode *) node2;
if (self1->progress == self2->progress) if (self1->progress == self2->progress)
{ {
gsk_render_node_data_diff (self1->start, self2->start, data); gsk_render_node_diff (self1->start, self2->start, region);
gsk_render_node_data_diff (self1->end, self2->end, data); gsk_render_node_diff (self1->end, self2->end, region);
return; return;
} }
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
static void static void
@ -5729,7 +5726,7 @@ gsk_text_node_draw (GskRenderNode *node,
static void static void
gsk_text_node_diff (GskRenderNode *node1, gsk_text_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskTextNode *self1 = (GskTextNode *) node1; GskTextNode *self1 = (GskTextNode *) node1;
GskTextNode *self2 = (GskTextNode *) node2; GskTextNode *self2 = (GskTextNode *) node2;
@ -5754,14 +5751,14 @@ gsk_text_node_diff (GskRenderNode *node1,
info1->attr.is_color == info2->attr.is_color) info1->attr.is_color == info2->attr.is_color)
continue; continue;
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
return; return;
} }
return; return;
} }
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
static void static void
@ -6175,7 +6172,7 @@ gsk_blur_node_draw (GskRenderNode *node,
static void static void
gsk_blur_node_diff (GskRenderNode *node1, gsk_blur_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskBlurNode *self1 = (GskBlurNode *) node1; GskBlurNode *self1 = (GskBlurNode *) node1;
GskBlurNode *self2 = (GskBlurNode *) node2; GskBlurNode *self2 = (GskBlurNode *) node2;
@ -6188,7 +6185,7 @@ gsk_blur_node_diff (GskRenderNode *node1,
clip_radius = ceil (gsk_cairo_blur_compute_pixels (self1->radius / 2.0)); clip_radius = ceil (gsk_cairo_blur_compute_pixels (self1->radius / 2.0));
sub = cairo_region_create (); sub = cairo_region_create ();
gsk_render_node_data_diff (self1->child, self2->child, &(GskDiffData) {sub, data->offload }); gsk_render_node_diff (self1->child, self2->child, sub);
n = cairo_region_num_rectangles (sub); n = cairo_region_num_rectangles (sub);
for (i = 0; i < n; i++) for (i = 0; i < n; i++)
@ -6198,13 +6195,13 @@ gsk_blur_node_diff (GskRenderNode *node1,
rect.y -= clip_radius; rect.y -= clip_radius;
rect.width += 2 * clip_radius; rect.width += 2 * clip_radius;
rect.height += 2 * clip_radius; rect.height += 2 * clip_radius;
cairo_region_union_rectangle (data->region, &rect); cairo_region_union_rectangle (region, &rect);
} }
cairo_region_destroy (sub); cairo_region_destroy (sub);
} }
else else
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
} }
@ -6420,19 +6417,19 @@ gsk_mask_node_draw (GskRenderNode *node,
static void static void
gsk_mask_node_diff (GskRenderNode *node1, gsk_mask_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskMaskNode *self1 = (GskMaskNode *) node1; GskMaskNode *self1 = (GskMaskNode *) node1;
GskMaskNode *self2 = (GskMaskNode *) node2; GskMaskNode *self2 = (GskMaskNode *) node2;
if (self1->mask_mode != self2->mask_mode) if (self1->mask_mode != self2->mask_mode)
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
return; return;
} }
gsk_render_node_data_diff (self1->source, self2->source, data); gsk_render_node_diff (self1->source, self2->source, region);
gsk_render_node_data_diff (self1->mask, self2->mask, data); gsk_render_node_diff (self1->mask, self2->mask, region);
} }
static void static void
@ -6598,12 +6595,12 @@ gsk_debug_node_can_diff (const GskRenderNode *node1,
static void static void
gsk_debug_node_diff (GskRenderNode *node1, gsk_debug_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskDebugNode *self1 = (GskDebugNode *) node1; GskDebugNode *self1 = (GskDebugNode *) node1;
GskDebugNode *self2 = (GskDebugNode *) node2; GskDebugNode *self2 = (GskDebugNode *) node2;
gsk_render_node_data_diff (self1->child, self2->child, data); gsk_render_node_diff (self1->child, self2->child, region);
} }
static void static void
@ -6734,7 +6731,7 @@ gsk_gl_shader_node_draw (GskRenderNode *node,
static void static void
gsk_gl_shader_node_diff (GskRenderNode *node1, gsk_gl_shader_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskGLShaderNode *self1 = (GskGLShaderNode *) node1; GskGLShaderNode *self1 = (GskGLShaderNode *) node1;
GskGLShaderNode *self2 = (GskGLShaderNode *) node2; GskGLShaderNode *self2 = (GskGLShaderNode *) node2;
@ -6746,14 +6743,14 @@ gsk_gl_shader_node_diff (GskRenderNode *node1,
{ {
cairo_region_t *child_region = cairo_region_create(); cairo_region_t *child_region = cairo_region_create();
for (guint i = 0; i < self1->n_children; i++) for (guint i = 0; i < self1->n_children; i++)
gsk_render_node_data_diff (self1->children[i], self2->children[i], &(GskDiffData) {child_region, data->offload }); gsk_render_node_diff (self1->children[i], self2->children[i], child_region);
if (!cairo_region_is_empty (child_region)) if (!cairo_region_is_empty (child_region))
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
cairo_region_destroy (child_region); cairo_region_destroy (child_region);
} }
else else
{ {
gsk_render_node_diff_impossible (node1, node2, data); gsk_render_node_diff_impossible (node1, node2, region);
} }
} }
@ -6959,19 +6956,12 @@ gsk_subsurface_node_can_diff (const GskRenderNode *node1,
static void static void
gsk_subsurface_node_diff (GskRenderNode *node1, gsk_subsurface_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data) cairo_region_t *region)
{ {
GskSubsurfaceNode *self1 = (GskSubsurfaceNode *) node1; GskSubsurfaceNode *self1 = (GskSubsurfaceNode *) node1;
GskSubsurfaceNode *self2 = (GskSubsurfaceNode *) node2; GskSubsurfaceNode *self2 = (GskSubsurfaceNode *) node2;
gboolean is_offloaded1, is_offloaded2; gboolean is_offloaded1, is_offloaded2;
if (!data->offload)
{
/* offloading not supported, so we know the children will be drawn */
gsk_render_node_data_diff (self1->child, self2->child, data);
return;
}
is_offloaded1 = self1->subsurface && gdk_subsurface_get_texture (self1->subsurface) != NULL; is_offloaded1 = self1->subsurface && gdk_subsurface_get_texture (self1->subsurface) != NULL;
is_offloaded2 = self2->subsurface && gdk_subsurface_get_texture (self2->subsurface) != NULL; is_offloaded2 = self2->subsurface && gdk_subsurface_get_texture (self2->subsurface) != NULL;
@ -6982,21 +6972,21 @@ gsk_subsurface_node_diff (GskRenderNode *node1,
else if (!is_offloaded1 && !is_offloaded2) else if (!is_offloaded1 && !is_offloaded2)
{ {
/* neither is offloaded, diff the children */ /* neither is offloaded, diff the children */
gsk_render_node_data_diff (self1->child, self2->child, data); gsk_render_node_diff (self1->child, self2->child, region);
} }
else if (!is_offloaded1) else if (!is_offloaded1)
{ {
/* The first one isn't offloaded, take its contents */ /* The first one isn't offloaded, take its contents */
cairo_rectangle_int_t rect; cairo_rectangle_int_t rect;
gsk_rect_to_cairo_grow (&node1->bounds, &rect); gsk_rect_to_cairo_grow (&node1->bounds, &rect);
cairo_region_union_rectangle (data->region, &rect); cairo_region_union_rectangle (region, &rect);
} }
else if (!is_offloaded2) else if (!is_offloaded2)
{ {
/* The second one isn't offloaded, take its contents */ /* The second one isn't offloaded, take its contents */
cairo_rectangle_int_t rect; cairo_rectangle_int_t rect;
gsk_rect_to_cairo_grow (&node2->bounds, &rect); gsk_rect_to_cairo_grow (&node2->bounds, &rect);
cairo_region_union_rectangle (data->region, &rect); cairo_region_union_rectangle (region, &rect);
} }
} }

View File

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "gskrendernode.h" #include "gskrendernode.h"
#include "gskoffloadprivate.h"
#include <cairo.h> #include <cairo.h>
#include "gdk/gdkmemoryformatprivate.h" #include "gdk/gdkmemoryformatprivate.h"
@ -37,12 +36,6 @@ struct _GskRenderNode
guint offscreen_for_opacity : 1; guint offscreen_for_opacity : 1;
}; };
typedef struct
{
cairo_region_t *region;
GskOffload *offload;
} GskDiffData;
struct _GskRenderNodeClass struct _GskRenderNodeClass
{ {
GTypeClass parent_class; GTypeClass parent_class;
@ -56,7 +49,7 @@ struct _GskRenderNodeClass
const GskRenderNode *node2); const GskRenderNode *node2);
void (* diff) (GskRenderNode *node1, void (* diff) (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data); cairo_region_t *region);
}; };
void gsk_render_node_init_types (void); void gsk_render_node_init_types (void);
@ -73,17 +66,16 @@ gboolean gsk_render_node_can_diff (const GskRenderNode
const GskRenderNode *node2) G_GNUC_PURE; const GskRenderNode *node2) G_GNUC_PURE;
void gsk_render_node_diff (GskRenderNode *node1, void gsk_render_node_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
cairo_region_t *region, cairo_region_t *region);
GskOffload *offload);
void gsk_render_node_data_diff (GskRenderNode *node1, void gsk_render_node_data_diff (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data); cairo_region_t *region);
void gsk_render_node_diff_impossible (GskRenderNode *node1, void gsk_render_node_diff_impossible (GskRenderNode *node1,
GskRenderNode *node2, GskRenderNode *node2,
GskDiffData *data); cairo_region_t *region);
void gsk_container_node_diff_with (GskRenderNode *container, void gsk_container_node_diff_with (GskRenderNode *container,
GskRenderNode *other, GskRenderNode *other,
GskDiffData *data); cairo_region_t *region);
void gsk_render_node_draw_fallback (GskRenderNode *node, void gsk_render_node_draw_fallback (GskRenderNode *node,
cairo_t *cr); cairo_t *cr);

View File

@ -19,6 +19,7 @@
#include "gtksnapshot.h" #include "gtksnapshot.h"
#include "gdk/gdksubsurfaceprivate.h"
#include "gsk/gskrendernodeprivate.h" #include "gsk/gskrendernodeprivate.h"
G_BEGIN_DECLS G_BEGIN_DECLS

View File

@ -183,7 +183,7 @@ gtk_updates_overlay_snapshot (GtkInspectorOverlay *overlay,
cairo_region_t *diff; cairo_region_t *diff;
diff = cairo_region_create (); diff = cairo_region_create ();
gsk_render_node_diff (updates->last, node, diff, NULL); gsk_render_node_diff (updates->last, node, diff);
if (cairo_region_is_empty (diff)) if (cairo_region_is_empty (diff))
cairo_region_destroy (diff); cairo_region_destroy (diff);
else else

View File

@ -455,7 +455,7 @@ parse_node_file (GFile *file, const char *generate)
g_clear_pointer (&diff, g_bytes_unref); g_clear_pointer (&diff, g_bytes_unref);
g_clear_pointer (&reference_file, g_free); g_clear_pointer (&reference_file, g_free);
gsk_render_node_diff (node, node2, clip, offload); gsk_render_node_diff (node, node2, clip);
if (g_strcmp0 (generate, "diff") == 0) if (g_strcmp0 (generate, "diff") == 0)
{ {