Now that we track depth, we can also pass it into the GDK frame code.
For now it's just passed along, code acts the same as with
prefers_high_depth.
static void
gdk_broadway_cairo_context_begin_frame (GdkDrawContext *draw_context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
cairo_region_t *region)
{
GdkBroadwayCairoContext *self = GDK_BROADWAY_CAIRO_CONTEXT (draw_context);
static void
gdk_broadway_draw_context_begin_frame (GdkDrawContext *draw_context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
cairo_region_t *region)
{
GdkBroadwayDrawContext *self = GDK_BROADWAY_DRAW_CONTEXT (draw_context);
g_return_if_fail (priv->surface != NULL);
g_return_if_fail (region != NULL);
- gdk_draw_context_begin_frame_full (context, FALSE, region);
+ gdk_draw_context_begin_frame_full (context, GDK_MEMORY_U8, region);
}
/*
- * @prefers_high_depth: %TRUE to request a higher bit depth
+ * @depth: best depth to render in
*
- * If high depth is preferred, GDK will see about providing a rendering target
- * that supports higher bit depth than 8 bits per channel. Typically this means
- * a target supporting 16bit floating point pixels, but that is not guaranteed.
+ * If the given depth is not `GDK_MEMORY_U8`, GDK will see about providing a
+ * rendering target that supports a higher bit depth than 8 bits per channel.
+ * Typically this means a target supporting 16bit floating point pixels, but
+ * that is not guaranteed.
*
* This is only a request and if the GDK backend does not support HDR rendering
* or does not consider it worthwhile, it may choose to not honor the request.
- * It may also choose to provide high depth even if it was not requested.
+ * It may also choose to provide a differnet depth even if it was not requested.
* Typically the steps undertaken by a backend are:
* 1. Check if high depth is supported by this drawing backend.
* 2. Check if the compositor supports high depth.
* In either of those cases, the context will usually choose to not honor the request.
*
* The rendering code must be able to deal with content in any bit depth, no matter
- * the preference. The prefers_high_depth argument is only a hint and GDK is free
+ * the preference. The depth argument is only a hint and GDK is free
* to choose.
*/
void
gdk_draw_context_begin_frame_full (GdkDrawContext *context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
const cairo_region_t *region)
{
GdkDrawContextPrivate *priv = gdk_draw_context_get_instance_private (context);
}
if (gdk_display_get_debug_flags (priv->display) & GDK_DEBUG_HIGH_DEPTH)
- prefers_high_depth = TRUE;
+ depth = GDK_MEMORY_FLOAT32;
priv->frame_region = cairo_region_copy (region);
priv->surface->paint_context = g_object_ref (context);
- GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, prefers_high_depth, priv->frame_region);
+ GDK_DRAW_CONTEXT_GET_CLASS (context)->begin_frame (context, depth, priv->frame_region);
cairo_region_intersect_rectangle (priv->frame_region,
&(cairo_rectangle_int_t) {
#include "gdkdrawcontext.h"
+#include "gdkmemoryformatprivate.h"
+
G_BEGIN_DECLS
#define GDK_DRAW_CONTEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GDK_TYPE_DRAW_CONTEXT, GdkDrawContextClass))
GObjectClass parent_class;
void (* begin_frame) (GdkDrawContext *context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
cairo_region_t *update_area);
void (* end_frame) (GdkDrawContext *context,
cairo_region_t *painted);
void gdk_draw_context_surface_resized (GdkDrawContext *context);
void gdk_draw_context_begin_frame_full (GdkDrawContext *context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
const cairo_region_t *region);
G_END_DECLS
static void
gdk_gl_context_real_begin_frame (GdkDrawContext *draw_context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
cairo_region_t *region)
{
GdkGLContext *context = GDK_GL_CONTEXT (draw_context);
#ifdef HAVE_EGL
if (priv->egl_context)
- gdk_surface_ensure_egl_surface (surface, prefers_high_depth);
+ gdk_surface_ensure_egl_surface (surface, depth != GDK_MEMORY_U8);
#endif
damage = GDK_GL_CONTEXT_GET_CLASS (context)->get_damage (context);
static void
gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
cairo_region_t *region)
{
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context);
static void
_gdk_macos_cairo_context_begin_frame (GdkDrawContext *draw_context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
cairo_region_t *region)
{
GdkMacosCairoContext *self = (GdkMacosCairoContext *)draw_context;
static void
gdk_macos_gl_context_begin_frame (GdkDrawContext *context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
cairo_region_t *region)
{
GdkMacosGLContext *self = (GdkMacosGLContext *)context;
static void
gdk_wayland_cairo_context_begin_frame (GdkDrawContext *draw_context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
cairo_region_t *region)
{
GdkWaylandCairoContext *self = GDK_WAYLAND_CAIRO_CONTEXT (draw_context);
static void
gdk_wayland_gl_context_begin_frame (GdkDrawContext *draw_context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
cairo_region_t *region)
{
gdk_wayland_surface_ensure_wl_egl_window (gdk_draw_context_get_surface (draw_context));
- GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->begin_frame (draw_context, prefers_high_depth, region);
+ GDK_DRAW_CONTEXT_CLASS (gdk_wayland_gl_context_parent_class)->begin_frame (draw_context, depth, region);
}
static void
static void
gdk_win32_cairo_context_begin_frame (GdkDrawContext *draw_context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
cairo_region_t *region)
{
GdkWin32CairoContext *self = GDK_WIN32_CAIRO_CONTEXT (draw_context);
static void
gdk_win32_gl_context_egl_begin_frame (GdkDrawContext *draw_context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
cairo_region_t *update_area)
{
gdk_win32_surface_handle_queued_move_resize (draw_context);
- GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_egl_parent_class)->begin_frame (draw_context, prefers_high_depth, update_area);
+ GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_egl_parent_class)->begin_frame (draw_context, depth, update_area);
}
static void
static void
gdk_win32_gl_context_wgl_begin_frame (GdkDrawContext *draw_context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
cairo_region_t *update_area)
{
gdk_win32_surface_handle_queued_move_resize (draw_context);
- GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->begin_frame (draw_context, prefers_high_depth, update_area);
+ GDK_DRAW_CONTEXT_CLASS (gdk_win32_gl_context_wgl_parent_class)->begin_frame (draw_context, depth, update_area);
}
static int
static void
gdk_win32_vulkan_context_begin_frame (GdkDrawContext *draw_context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
cairo_region_t *update_area)
{
gdk_win32_surface_handle_queued_move_resize (draw_context);
- GDK_DRAW_CONTEXT_CLASS (gdk_win32_vulkan_context_parent_class)->begin_frame (draw_context, prefers_high_depth, update_area);
+ GDK_DRAW_CONTEXT_CLASS (gdk_win32_vulkan_context_parent_class)->begin_frame (draw_context, depth, update_area);
}
static void
static void
gdk_x11_cairo_context_begin_frame (GdkDrawContext *draw_context,
- gboolean prefers_high_depth,
+ GdkMemoryDepth depth,
cairo_region_t *region)
{
GdkX11CairoContext *self = GDK_X11_CAIRO_CONTEXT (draw_context);
viewport.size.height = gdk_surface_get_height (surface) * scale;
gdk_draw_context_begin_frame_full (GDK_DRAW_CONTEXT (self->context),
- gsk_render_node_get_preferred_depth (root) != GDK_MEMORY_U8,
+ gsk_render_node_get_preferred_depth (root),
update_area);
gdk_gl_context_make_current (self->context);