mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-12 05:20:17 +00:00
offload: Some renaming
Rename things to be more in line with the subsurface api.
This commit is contained in:
parent
c97bbfdfb1
commit
4aac64edf0
@ -83,8 +83,8 @@ find_texture_transform (GskTransform *transform)
|
|||||||
static GdkTexture *
|
static GdkTexture *
|
||||||
find_texture_to_attach (GskOffload *self,
|
find_texture_to_attach (GskOffload *self,
|
||||||
const GskRenderNode *subsurface_node,
|
const GskRenderNode *subsurface_node,
|
||||||
graphene_rect_t *out_bounds,
|
graphene_rect_t *out_texture_rect,
|
||||||
graphene_rect_t *out_clip,
|
graphene_rect_t *out_source_rect,
|
||||||
gboolean *has_background,
|
gboolean *has_background,
|
||||||
GdkTextureTransform *out_texture_transform)
|
GdkTextureTransform *out_texture_transform)
|
||||||
{
|
{
|
||||||
@ -186,7 +186,7 @@ find_texture_to_attach (GskOffload *self,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gsk_transform_transform_bounds (transform, &node->bounds, out_bounds);
|
gsk_transform_transform_bounds (transform, &node->bounds, out_texture_rect);
|
||||||
clip = *c;
|
clip = *c;
|
||||||
has_clip = TRUE;
|
has_clip = TRUE;
|
||||||
}
|
}
|
||||||
@ -210,18 +210,18 @@ find_texture_to_attach (GskOffload *self,
|
|||||||
|
|
||||||
gsk_rect_intersection (&node->bounds, &clip, &clip);
|
gsk_rect_intersection (&node->bounds, &clip, &clip);
|
||||||
|
|
||||||
out_clip->origin.x = (clip.origin.x - dx) * sx;
|
out_source_rect->origin.x = (clip.origin.x - dx) * sx;
|
||||||
out_clip->origin.y = (clip.origin.y - dy) * sy;
|
out_source_rect->origin.y = (clip.origin.y - dy) * sy;
|
||||||
out_clip->size.width = clip.size.width * sx;
|
out_source_rect->size.width = clip.size.width * sx;
|
||||||
out_clip->size.height = clip.size.height * sy;
|
out_source_rect->size.height = clip.size.height * sy;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gsk_transform_transform_bounds (transform, &node->bounds, out_bounds);
|
gsk_transform_transform_bounds (transform, &node->bounds, out_texture_rect);
|
||||||
out_clip->origin.x = 0;
|
out_source_rect->origin.x = 0;
|
||||||
out_clip->origin.y = 0;
|
out_source_rect->origin.y = 0;
|
||||||
out_clip->size.width = gdk_texture_get_width (texture);
|
out_source_rect->size.width = gdk_texture_get_width (texture);
|
||||||
out_clip->size.height = gdk_texture_get_height (texture);
|
out_source_rect->size.height = gdk_texture_get_height (texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = texture;
|
ret = texture;
|
||||||
@ -479,8 +479,8 @@ visit_node (GskOffload *self,
|
|||||||
|
|
||||||
if (info->can_raise)
|
if (info->can_raise)
|
||||||
{
|
{
|
||||||
if (gsk_rect_intersects (&transformed_bounds, &info->dest) ||
|
if (gsk_rect_intersects (&transformed_bounds, &info->texture_rect) ||
|
||||||
gsk_rect_intersects (&transformed_bounds, &info->bg))
|
gsk_rect_intersects (&transformed_bounds, &info->background_rect))
|
||||||
{
|
{
|
||||||
GskRenderNodeType type = GSK_RENDER_NODE_TYPE (node);
|
GskRenderNodeType type = GSK_RENDER_NODE_TYPE (node);
|
||||||
|
|
||||||
@ -653,17 +653,14 @@ complex_clip:
|
|||||||
{
|
{
|
||||||
gboolean has_background;
|
gboolean has_background;
|
||||||
|
|
||||||
info->texture = find_texture_to_attach (self, node, &info->dest, &info->source, &has_background, &info->transform);
|
info->texture = find_texture_to_attach (self, node, &info->texture_rect, &info->source_rect, &has_background, &info->transform);
|
||||||
if (info->texture)
|
if (info->texture)
|
||||||
{
|
{
|
||||||
info->can_offload = TRUE;
|
info->can_offload = TRUE;
|
||||||
info->can_raise = TRUE;
|
info->can_raise = TRUE;
|
||||||
transform_bounds (self, &info->dest, &info->dest);
|
transform_bounds (self, &info->texture_rect, &info->texture_rect);
|
||||||
if (has_background)
|
info->has_background = has_background;
|
||||||
transform_bounds (self, &node->bounds, &info->bg);
|
transform_bounds (self, &node->bounds, &info->background_rect);
|
||||||
else
|
|
||||||
graphene_rect_init (&info->bg, 0, 0, 0, 0);
|
|
||||||
|
|
||||||
info->place_above = self->last_info ? self->last_info->subsurface : NULL;
|
info->place_above = self->last_info ? self->last_info->subsurface : NULL;
|
||||||
self->last_info = info;
|
self->last_info = info;
|
||||||
}
|
}
|
||||||
@ -703,9 +700,12 @@ gsk_offload_new (GdkSurface *surface,
|
|||||||
for (gsize i = 0; i < self->n_subsurfaces; i++)
|
for (gsize i = 0; i < self->n_subsurfaces; i++)
|
||||||
{
|
{
|
||||||
GskOffloadInfo *info = &self->subsurfaces[i];
|
GskOffloadInfo *info = &self->subsurfaces[i];
|
||||||
|
graphene_rect_t rect;
|
||||||
|
|
||||||
info->subsurface = gdk_surface_get_subsurface (self->surface, i);
|
info->subsurface = gdk_surface_get_subsurface (self->surface, i);
|
||||||
info->was_offloaded = gdk_subsurface_get_texture (info->subsurface) != NULL;
|
info->was_offloaded = gdk_subsurface_get_texture (info->subsurface) != NULL;
|
||||||
info->was_above = gdk_subsurface_is_above_parent (info->subsurface);
|
info->was_above = gdk_subsurface_is_above_parent (info->subsurface);
|
||||||
|
info->had_background = gdk_subsurface_get_background_rect (info->subsurface, &rect);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self->n_subsurfaces > 0)
|
if (self->n_subsurfaces > 0)
|
||||||
@ -732,18 +732,18 @@ gsk_offload_new (GdkSurface *surface,
|
|||||||
if (info->can_raise)
|
if (info->can_raise)
|
||||||
info->is_offloaded = gdk_subsurface_attach (info->subsurface,
|
info->is_offloaded = gdk_subsurface_attach (info->subsurface,
|
||||||
info->texture,
|
info->texture,
|
||||||
&info->source,
|
&info->source_rect,
|
||||||
&info->dest,
|
&info->texture_rect,
|
||||||
info->transform,
|
info->transform,
|
||||||
&info->bg,
|
info->has_background ? &info->background_rect : NULL,
|
||||||
TRUE, NULL);
|
TRUE, NULL);
|
||||||
else
|
else
|
||||||
info->is_offloaded = gdk_subsurface_attach (info->subsurface,
|
info->is_offloaded = gdk_subsurface_attach (info->subsurface,
|
||||||
info->texture,
|
info->texture,
|
||||||
&info->source,
|
&info->source_rect,
|
||||||
&info->dest,
|
&info->texture_rect,
|
||||||
info->transform,
|
info->transform,
|
||||||
&info->bg,
|
info->has_background ? &info->background_rect : NULL,
|
||||||
info->place_above != NULL,
|
info->place_above != NULL,
|
||||||
info->place_above);
|
info->place_above);
|
||||||
}
|
}
|
||||||
|
@ -31,10 +31,10 @@ typedef struct
|
|||||||
GdkSubsurface *subsurface;
|
GdkSubsurface *subsurface;
|
||||||
GdkTexture *texture;
|
GdkTexture *texture;
|
||||||
GdkSubsurface *place_above;
|
GdkSubsurface *place_above;
|
||||||
graphene_rect_t dest;
|
graphene_rect_t texture_rect;
|
||||||
graphene_rect_t source;
|
graphene_rect_t source_rect;
|
||||||
GdkTextureTransform transform;
|
GdkTextureTransform transform;
|
||||||
graphene_rect_t bg;
|
graphene_rect_t background_rect;
|
||||||
|
|
||||||
guint was_offloaded : 1;
|
guint was_offloaded : 1;
|
||||||
guint can_offload : 1;
|
guint can_offload : 1;
|
||||||
@ -43,6 +43,9 @@ typedef struct
|
|||||||
guint was_above : 1;
|
guint was_above : 1;
|
||||||
guint can_raise : 1;
|
guint can_raise : 1;
|
||||||
guint is_above : 1;
|
guint is_above : 1;
|
||||||
|
|
||||||
|
guint had_background : 1;
|
||||||
|
guint has_background : 1;
|
||||||
} GskOffloadInfo;
|
} GskOffloadInfo;
|
||||||
|
|
||||||
GskOffload * gsk_offload_new (GdkSurface *surface,
|
GskOffload * gsk_offload_new (GdkSurface *surface,
|
||||||
|
@ -210,11 +210,11 @@ collect_offload_info (GdkSurface *surface,
|
|||||||
gdk_texture_get_width (info->texture),
|
gdk_texture_get_width (info->texture),
|
||||||
gdk_texture_get_height (info->texture));
|
gdk_texture_get_height (info->texture));
|
||||||
g_string_append_printf (s, "source: %g %g %g %g, ",
|
g_string_append_printf (s, "source: %g %g %g %g, ",
|
||||||
info->source.origin.x, info->source.origin.y,
|
info->source_rect.origin.x, info->source_rect.origin.y,
|
||||||
info->source.size.width, info->source.size.height);
|
info->source_rect.size.width, info->source_rect.size.height);
|
||||||
g_string_append_printf (s, "dest: %g %g %g %g\n",
|
g_string_append_printf (s, "dest: %g %g %g %g\n",
|
||||||
info->dest.origin.x, info->dest.origin.y,
|
info->texture_rect.origin.x, info->texture_rect.origin.y,
|
||||||
info->dest.size.width, info->dest.size.height);
|
info->texture_rect.size.width, info->texture_rect.size.height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
g_string_append_printf (s, "%u: %snot offloaded\n",
|
g_string_append_printf (s, "%u: %snot offloaded\n",
|
||||||
@ -416,8 +416,11 @@ parse_node_file (GFile *file, const char *generate)
|
|||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
if (diff && g_bytes_get_size (diff) > 0)
|
if (diff && g_bytes_get_size (diff) > 0)
|
||||||
{
|
{
|
||||||
g_print ("Resulting .offload file doesn't match reference:\n%s\n",
|
char *basename = g_path_get_basename (reference_file);
|
||||||
|
g_print ("Resulting file doesn't match reference (%s):\n%s\n",
|
||||||
|
basename,
|
||||||
(const char *) g_bytes_get_data (diff, NULL));
|
(const char *) g_bytes_get_data (diff, NULL));
|
||||||
|
g_free (basename);
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -452,8 +455,11 @@ parse_node_file (GFile *file, const char *generate)
|
|||||||
g_assert_no_error (error);
|
g_assert_no_error (error);
|
||||||
if (diff && g_bytes_get_size (diff) > 0)
|
if (diff && g_bytes_get_size (diff) > 0)
|
||||||
{
|
{
|
||||||
g_print ("Resulting .offload2 file doesn't match reference:\n%s\n",
|
char *basename = g_path_get_basename (reference_file);
|
||||||
|
g_print ("Resulting file doesn't match reference (%s):\n%s\n",
|
||||||
|
basename,
|
||||||
(const char *) g_bytes_get_data (diff, NULL));
|
(const char *) g_bytes_get_data (diff, NULL));
|
||||||
|
g_free (basename);
|
||||||
result = FALSE;
|
result = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user