forked from AuroraMiddleware/gtk
Merge branch 'fallback-rendering' into 'master'
Fallback rendering See merge request GNOME/gtk!1152
This commit is contained in:
commit
a31a80277c
@ -36,7 +36,6 @@
|
||||
#define ORTHO_NEAR_PLANE -10000
|
||||
#define ORTHO_FAR_PLANE 10000
|
||||
|
||||
#define HIGHLIGHT_FALLBACK 0
|
||||
#define DEBUG_OPS 0
|
||||
|
||||
#define SHADOW_EXTRA_SIZE 4
|
||||
@ -502,12 +501,20 @@ render_fallback_node (GskGLRenderer *self,
|
||||
cairo_fill (cr);
|
||||
cairo_restore (cr);
|
||||
|
||||
#if HIGHLIGHT_FALLBACK
|
||||
if (gsk_render_node_get_node_type (node) != GSK_CAIRO_NODE)
|
||||
#if G_ENABLE_DEBUG
|
||||
if (GSK_RENDERER_DEBUG_CHECK (GSK_RENDERER (self), FALLBACK))
|
||||
{
|
||||
cairo_move_to (cr, 0, 0);
|
||||
cairo_rectangle (cr, 0, 0, node->bounds.size.width, node->bounds.size.height);
|
||||
cairo_set_source_rgba (cr, 1, 0, 0, 1);
|
||||
if (gsk_render_node_get_node_type (node) == GSK_CAIRO_NODE)
|
||||
cairo_set_source_rgba (cr, 0.3, 0, 1, 0.25);
|
||||
else
|
||||
cairo_set_source_rgba (cr, 1, 0, 0, 0.25);
|
||||
cairo_fill_preserve (cr);
|
||||
if (gsk_render_node_get_node_type (node) == GSK_CAIRO_NODE)
|
||||
cairo_set_source_rgba (cr, 0.3, 0, 1, 1);
|
||||
else
|
||||
cairo_set_source_rgba (cr, 1, 0, 0, 1);
|
||||
cairo_stroke (cr);
|
||||
}
|
||||
#endif
|
||||
|
@ -194,7 +194,6 @@ gtk_inspector_logs_class_init (GtkInspectorLogsClass *klass)
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, vulkan_gsk);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, shaders);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, surface);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, fallback);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, glyphcache);
|
||||
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorLogs, actions);
|
||||
|
@ -137,12 +137,6 @@
|
||||
<signal name="toggled" handler="flag_toggled"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="fallback">
|
||||
<property name="label">Fallback</property>
|
||||
<signal name="toggled" handler="flag_toggled"/>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="glyphcache">
|
||||
<property name="label">Glyph Cache</property>
|
||||
|
@ -36,6 +36,9 @@
|
||||
#include "gtkscale.h"
|
||||
#include "gtkwindow.h"
|
||||
#include "gtklistbox.h"
|
||||
#include "gskdebugprivate.h"
|
||||
#include "gskrendererprivate.h"
|
||||
#include "gtknative.h"
|
||||
|
||||
#include "fallback-c89.c"
|
||||
|
||||
@ -74,6 +77,7 @@ struct _GtkInspectorVisualPrivate
|
||||
GtkWidget *debug_box;
|
||||
GtkWidget *fps_switch;
|
||||
GtkWidget *updates_switch;
|
||||
GtkWidget *fallback_switch;
|
||||
GtkWidget *baselines_switch;
|
||||
GtkWidget *layout_switch;
|
||||
GtkWidget *resize_switch;
|
||||
@ -302,6 +306,48 @@ updates_activate (GtkSwitch *sw,
|
||||
redraw_everything ();
|
||||
}
|
||||
|
||||
static void
|
||||
fallback_activate (GtkSwitch *sw,
|
||||
GParamSpec *pspec,
|
||||
GtkInspectorVisual *vis)
|
||||
{
|
||||
GtkInspectorWindow *iw;
|
||||
gboolean fallback;
|
||||
guint flags;
|
||||
GList *toplevels, *l;
|
||||
|
||||
fallback = gtk_switch_get_active (sw);
|
||||
iw = GTK_INSPECTOR_WINDOW (gtk_widget_get_root (GTK_WIDGET (vis)));
|
||||
if (iw == NULL)
|
||||
return;
|
||||
|
||||
flags = gsk_get_debug_flags ();
|
||||
if (fallback)
|
||||
flags = flags | GSK_DEBUG_FALLBACK;
|
||||
else
|
||||
flags = flags & ~GSK_DEBUG_FALLBACK;
|
||||
gsk_set_debug_flags (flags);
|
||||
|
||||
toplevels = gtk_window_list_toplevels ();
|
||||
for (l = toplevels; l; l = l->next)
|
||||
{
|
||||
GtkWidget *toplevel = l->data;
|
||||
GskRenderer *renderer;
|
||||
|
||||
if ((GtkRoot *)toplevel == gtk_widget_get_root (GTK_WIDGET (sw))) /* skip the inspector */
|
||||
continue;
|
||||
|
||||
renderer = gtk_native_get_renderer (GTK_NATIVE (toplevel));
|
||||
if (!renderer)
|
||||
continue;
|
||||
|
||||
gsk_renderer_set_debug_flags (renderer, flags);
|
||||
}
|
||||
g_list_free (toplevels);
|
||||
|
||||
redraw_everything ();
|
||||
}
|
||||
|
||||
static void
|
||||
baselines_activate (GtkSwitch *sw)
|
||||
{
|
||||
@ -871,6 +917,11 @@ row_activated (GtkListBox *box,
|
||||
GtkSwitch *sw = GTK_SWITCH (vis->priv->updates_switch);
|
||||
gtk_switch_set_active (sw, !gtk_switch_get_active (sw));
|
||||
}
|
||||
else if (gtk_widget_is_ancestor (vis->priv->fallback_switch, GTK_WIDGET (row)))
|
||||
{
|
||||
GtkSwitch *sw = GTK_SWITCH (vis->priv->fallback_switch);
|
||||
gtk_switch_set_active (sw, !gtk_switch_get_active (sw));
|
||||
}
|
||||
else if (gtk_widget_is_ancestor (vis->priv->baselines_switch, GTK_WIDGET (row)))
|
||||
{
|
||||
GtkSwitch *sw = GTK_SWITCH (vis->priv->baselines_switch);
|
||||
@ -1058,12 +1109,14 @@ gtk_inspector_visual_class_init (GtkInspectorVisualClass *klass)
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, font_scale_adjustment);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, fps_switch);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, updates_switch);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, fallback_switch);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, baselines_switch);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, layout_switch);
|
||||
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, resize_switch);
|
||||
|
||||
gtk_widget_class_bind_template_callback (widget_class, fps_activate);
|
||||
gtk_widget_class_bind_template_callback (widget_class, updates_activate);
|
||||
gtk_widget_class_bind_template_callback (widget_class, fallback_activate);
|
||||
gtk_widget_class_bind_template_callback (widget_class, direction_changed);
|
||||
gtk_widget_class_bind_template_callback (widget_class, baselines_activate);
|
||||
gtk_widget_class_bind_template_callback (widget_class, layout_activate);
|
||||
|
@ -425,6 +425,32 @@
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<property name="margin">10</property>
|
||||
<property name="spacing">40</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="fallback_label">
|
||||
<property name="label" translatable="yes">Show Fallback Rendering</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="xalign">0.0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkSwitch" id="fallback_switch">
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">baseline</property>
|
||||
<property name="hexpand">1</property>
|
||||
<signal name="notify::active" handler="fallback_activate"/>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkListBoxRow">
|
||||
<child>
|
||||
@ -586,6 +612,7 @@
|
||||
<widget name="hidpi_label"/>
|
||||
<widget name="animation_label"/>
|
||||
<widget name="updates_label"/>
|
||||
<widget name="fallback_label"/>
|
||||
<widget name="baselines_label"/>
|
||||
<widget name="layout_label"/>
|
||||
<widget name="resize_label"/>
|
||||
|
Loading…
Reference in New Issue
Block a user