mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
Merge branch 'matthiasc/for-master' into 'master'
inspector: Fix surface transform regression See merge request GNOME/gtk!3280
This commit is contained in:
commit
fe45f283af
@ -11462,6 +11462,7 @@ gtk_widget_render (GtkWidget *widget,
|
|||||||
GdkSurface *surface,
|
GdkSurface *surface,
|
||||||
const cairo_region_t *region)
|
const cairo_region_t *region)
|
||||||
{
|
{
|
||||||
|
GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
|
||||||
GtkSnapshot *snapshot;
|
GtkSnapshot *snapshot;
|
||||||
GskRenderer *renderer;
|
GskRenderer *renderer;
|
||||||
GskRenderNode *root;
|
GskRenderNode *root;
|
||||||
@ -11497,7 +11498,8 @@ gtk_widget_render (GtkWidget *widget,
|
|||||||
renderer,
|
renderer,
|
||||||
surface,
|
surface,
|
||||||
region,
|
region,
|
||||||
root);
|
root,
|
||||||
|
priv->render_node);
|
||||||
|
|
||||||
gsk_renderer_render (renderer, root, region);
|
gsk_renderer_render (renderer, root, region);
|
||||||
|
|
||||||
|
@ -172,15 +172,10 @@ gtk_updates_overlay_snapshot (GtkInspectorOverlay *overlay,
|
|||||||
GtkUpdate *draw;
|
GtkUpdate *draw;
|
||||||
gint64 now;
|
gint64 now;
|
||||||
GList *l;
|
GList *l;
|
||||||
double native_x, native_y;
|
|
||||||
|
|
||||||
if (!GTK_IS_NATIVE (widget))
|
if (!GTK_IS_NATIVE (widget))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* The coordinates we're getting from GdkSurface API are in GdkSurface coordinate spaces,
|
|
||||||
* but we're snapshotting in widget space, so we need to transform */
|
|
||||||
gtk_native_get_surface_transform (GTK_NATIVE (widget), &native_x, &native_y);
|
|
||||||
|
|
||||||
updates = gtk_update_overlay_lookup_for_widget (self, widget, TRUE);
|
updates = gtk_update_overlay_lookup_for_widget (self, widget, TRUE);
|
||||||
now = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
|
now = gdk_frame_clock_get_frame_time (gtk_widget_get_frame_clock (widget));
|
||||||
|
|
||||||
@ -234,7 +229,7 @@ gtk_updates_overlay_snapshot (GtkInspectorOverlay *overlay,
|
|||||||
cairo_region_get_rectangle (draw->region, i, &rect);
|
cairo_region_get_rectangle (draw->region, i, &rect);
|
||||||
gtk_snapshot_append_color (snapshot,
|
gtk_snapshot_append_color (snapshot,
|
||||||
&(GdkRGBA) { 1, 0, 0, 0.4 * (1 - progress) },
|
&(GdkRGBA) { 1, 0, 0, 0.4 * (1 - progress) },
|
||||||
&GRAPHENE_RECT_INIT(rect.x - native_x, rect.y - native_y,
|
&GRAPHENE_RECT_INIT(rect.x, rect.y,
|
||||||
rect.width, rect.height));
|
rect.width, rect.height));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -780,24 +780,25 @@ gtk_inspector_prepare_render (GtkWidget *widget,
|
|||||||
GskRenderer *renderer,
|
GskRenderer *renderer,
|
||||||
GdkSurface *surface,
|
GdkSurface *surface,
|
||||||
const cairo_region_t *region,
|
const cairo_region_t *region,
|
||||||
GskRenderNode *node)
|
GskRenderNode *root,
|
||||||
|
GskRenderNode *widget_node)
|
||||||
{
|
{
|
||||||
GtkInspectorWindow *iw;
|
GtkInspectorWindow *iw;
|
||||||
|
|
||||||
iw = gtk_inspector_window_get_for_display (gtk_widget_get_display (widget));
|
iw = gtk_inspector_window_get_for_display (gtk_widget_get_display (widget));
|
||||||
if (iw == NULL)
|
if (iw == NULL)
|
||||||
return node;
|
return root;
|
||||||
|
|
||||||
/* sanity check for single-display GDK backends */
|
/* sanity check for single-display GDK backends */
|
||||||
if (GTK_WIDGET (iw) == widget)
|
if (GTK_WIDGET (iw) == widget)
|
||||||
return node;
|
return root;
|
||||||
|
|
||||||
gtk_inspector_recorder_record_render (GTK_INSPECTOR_RECORDER (iw->widget_recorder),
|
gtk_inspector_recorder_record_render (GTK_INSPECTOR_RECORDER (iw->widget_recorder),
|
||||||
widget,
|
widget,
|
||||||
renderer,
|
renderer,
|
||||||
surface,
|
surface,
|
||||||
region,
|
region,
|
||||||
node);
|
root);
|
||||||
|
|
||||||
if (iw->overlays)
|
if (iw->overlays)
|
||||||
{
|
{
|
||||||
@ -806,7 +807,7 @@ gtk_inspector_prepare_render (GtkWidget *widget,
|
|||||||
double native_x, native_y;
|
double native_x, native_y;
|
||||||
|
|
||||||
snapshot = gtk_snapshot_new ();
|
snapshot = gtk_snapshot_new ();
|
||||||
gtk_snapshot_append_node (snapshot, node);
|
gtk_snapshot_append_node (snapshot, root);
|
||||||
|
|
||||||
gtk_native_get_surface_transform (GTK_NATIVE (widget), &native_x, &native_y);
|
gtk_native_get_surface_transform (GTK_NATIVE (widget), &native_x, &native_y);
|
||||||
|
|
||||||
@ -815,16 +816,16 @@ gtk_inspector_prepare_render (GtkWidget *widget,
|
|||||||
|
|
||||||
for (l = iw->overlays; l; l = l->next)
|
for (l = iw->overlays; l; l = l->next)
|
||||||
{
|
{
|
||||||
gtk_inspector_overlay_snapshot (l->data, snapshot, node, widget);
|
gtk_inspector_overlay_snapshot (l->data, snapshot, widget_node, widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_snapshot_restore (snapshot);
|
gtk_snapshot_restore (snapshot);
|
||||||
|
|
||||||
gsk_render_node_unref (node);
|
gsk_render_node_unref (root);
|
||||||
node = gtk_snapshot_free_to_node (snapshot);
|
root = gtk_snapshot_free_to_node (snapshot);
|
||||||
}
|
}
|
||||||
|
|
||||||
return node;
|
return root;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
|
@ -154,7 +154,8 @@ GskRenderNode * gtk_inspector_prepare_render
|
|||||||
GskRenderer *renderer,
|
GskRenderer *renderer,
|
||||||
GdkSurface *surface,
|
GdkSurface *surface,
|
||||||
const cairo_region_t *region,
|
const cairo_region_t *region,
|
||||||
GskRenderNode *node);
|
GskRenderNode *root,
|
||||||
|
GskRenderNode *widget_node);
|
||||||
gboolean gtk_inspector_handle_event (GdkEvent *event);
|
gboolean gtk_inspector_handle_event (GdkEvent *event);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
Loading…
Reference in New Issue
Block a user