{ "gl-legacy", GDK_DEBUG_GL_LEGACY },
{ "gl-gles", GDK_DEBUG_GL_GLES },
{ "vulkan-disable", GDK_DEBUG_VULKAN_DISABLE },
- { "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE },
- { "cairo-image", GDK_DEBUG_CAIRO_IMAGE }
+ { "vulkan-validate", GDK_DEBUG_VULKAN_VALIDATE }
};
#endif
GDK_DEBUG_GL_LEGACY = 1 << 15,
GDK_DEBUG_GL_GLES = 1 << 16,
GDK_DEBUG_VULKAN_DISABLE = 1 << 17,
- GDK_DEBUG_VULKAN_VALIDATE = 1 << 18,
- GDK_DEBUG_CAIRO_IMAGE = 1 << 19
+ GDK_DEBUG_VULKAN_VALIDATE = 1 << 18
} GdkDebugFlags;
extern guint _gdk_debug_flags;
int width,
int height)
{
- cairo_surface_t *surface_surface, *similar_surface;
- double sx, sy;
+ cairo_surface_t *similar_surface;
+ int scale;
g_return_val_if_fail (GDK_IS_SURFACE (surface), NULL);
- surface_surface = gdk_surface_ref_impl_surface (surface);
- sx = sy = 1;
- cairo_surface_get_device_scale (surface_surface, &sx, &sy);
-
- if (GDK_DISPLAY_DEBUG_CHECK (surface->display, CAIRO_IMAGE))
- {
- similar_surface = cairo_image_surface_create (content == CAIRO_CONTENT_COLOR ? CAIRO_FORMAT_RGB24 :
- content == CAIRO_CONTENT_ALPHA ? CAIRO_FORMAT_A8 : CAIRO_FORMAT_ARGB32,
- width * sx, height * sy);
- cairo_surface_set_device_scale (similar_surface, sx, sy);
- }
- else
- {
- similar_surface = cairo_surface_create_similar (surface_surface,
- content,
- width, height);
- }
+ scale = gdk_surface_get_scale_factor (surface);
- cairo_surface_destroy (surface_surface);
+ similar_surface = cairo_image_surface_create (content == CAIRO_CONTENT_COLOR ? CAIRO_FORMAT_RGB24 :
+ content == CAIRO_CONTENT_ALPHA ? CAIRO_FORMAT_A8 : CAIRO_FORMAT_ARGB32,
+ width * scale, height * scale);
+ cairo_surface_set_device_scale (similar_surface, scale, scale);
return similar_surface;
}
GtkAdjustment *cursor_size_adjustment;
GtkWidget *debug_box;
- GtkWidget *rendering_mode_combo;
GtkWidget *baselines_switch;
GtkWidget *layout_switch;
GtkWidget *touchscreen_switch;
}
}
-static void
-init_rendering_mode (GtkInspectorVisual *vis)
-{
- GdkDebugFlags flags = gdk_display_get_debug_flags (gdk_display_get_default ());
- int mode = 0;
-
- if (flags & GDK_DEBUG_CAIRO_IMAGE)
- mode = 1;
-
- gtk_combo_box_set_active (GTK_COMBO_BOX (vis->priv->rendering_mode_combo), mode);
-}
-
-static void
-rendering_mode_changed (GtkComboBox *c,
- GtkInspectorVisual *vis)
-{
- GdkDebugFlags flags = gdk_display_get_debug_flags (gdk_display_get_default ());
- int mode;
-
- mode = gtk_combo_box_get_active (c);
-
- flags = flags & ~GDK_DEBUG_CAIRO_IMAGE;
- if (mode == 1)
- flags = flags | GDK_DEBUG_CAIRO_IMAGE;
-
- gdk_display_set_debug_flags (gdk_display_get_default (), flags);
-}
-
static void
update_gl_flag (GtkSwitch *sw,
GdkDebugFlags flag)
init_font (vis);
init_font_scale (vis);
init_scale (vis);
- init_rendering_mode (vis);
init_animation (vis);
init_slowdown (vis);
init_touchscreen (vis);
object_class->constructed = gtk_inspector_visual_constructed;
gtk_widget_class_set_template_from_resource (widget_class, "/org/gtk/libgtk/inspector/visual.ui");
- gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, rendering_mode_combo);
gtk_widget_class_bind_template_child_private (widget_class, GtkInspectorVisual, direction_combo);
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_callback (widget_class, fps_activate);
gtk_widget_class_bind_template_callback (widget_class, updates_activate);
gtk_widget_class_bind_template_callback (widget_class, direction_changed);
- gtk_widget_class_bind_template_callback (widget_class, rendering_mode_changed);
gtk_widget_class_bind_template_callback (widget_class, baselines_activate);
gtk_widget_class_bind_template_callback (widget_class, layout_activate);
gtk_widget_class_bind_template_callback (widget_class, widget_resize_activate);
<child>
<object class="GtkListBox" id="debug_box">
<property name="selection-mode">none</property>
- <child>
- <object class="GtkListBoxRow">
- <property name="activatable">0</property>
- <child>
- <object class="GtkBox">
- <property name="margin">10</property>
- <property name="spacing">40</property>
- <child>
- <object class="GtkLabel" id="rendering_mode_label">
- <property name="label" translatable="yes">Rendering Mode</property>
- <property name="halign">start</property>
- <property name="valign">baseline</property>
- <property name="xalign">0.0</property>
- </object>
- </child>
- <child>
- <object class="GtkComboBoxText" id="rendering_mode_combo">
- <property name="halign">end</property>
- <property name="valign">baseline</property>
- <property name="hexpand">1</property>
- <signal name="changed" handler="rendering_mode_changed"/>
- <items>
- <item translatable="yes" id="similar">Similar</item>
- <item translatable="yes" id="image">Image</item>
- </items>
- </object>
- </child>
- </object>
- </child>
- </object>
- </child>
<child>
<object class="GtkListBoxRow">
<property name="activatable">0</property>
<widget name="direction_label"/>
<widget name="hidpi_label"/>
<widget name="animation_label"/>
- <widget name="rendering_mode_label"/>
<widget name="updates_label"/>
<widget name="baselines_label"/>
<widget name="layout_label"/>
<widget name="cursor_combo"/>
<widget name="font_button"/>
<widget name="direction_combo"/>
- <widget name="rendering_mode_combo"/>
<widget name="gl_combo"/>
</widgets>
</object>