mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-25 13:11:13 +00:00
gdk: Add GDK_MEMORY_NONE depth
That's basically the "undefined" value. We need that when drawing nothing, which so far only happens with empty container nodes. But empty container nodes can be children of other nodes, and that makes things propagate. So instead of catching them, force the whole rest of the code to deal with an undefined depth. We also can't just set a random depth, because that will cause merging to fail.
This commit is contained in:
parent
9abc83fdad
commit
1bbf5f7a17
@ -1575,10 +1575,22 @@ gdk_display_get_egl_config (GdkDisplay *self,
|
||||
{
|
||||
GdkDisplayPrivate *priv = gdk_display_get_instance_private (self);
|
||||
|
||||
if (depth == GDK_MEMORY_U8 || depth == GDK_MEMORY_U8_SRGB)
|
||||
return priv->egl_config;
|
||||
else
|
||||
return priv->egl_config_high_depth;
|
||||
switch (depth)
|
||||
{
|
||||
case GDK_MEMORY_NONE:
|
||||
case GDK_MEMORY_U8:
|
||||
case GDK_MEMORY_U8_SRGB:
|
||||
return priv->egl_config;
|
||||
|
||||
case GDK_MEMORY_U16:
|
||||
case GDK_MEMORY_FLOAT16:
|
||||
case GDK_MEMORY_FLOAT32:
|
||||
return priv->egl_config_high_depth;
|
||||
|
||||
case GDK_N_DEPTHS:
|
||||
default:
|
||||
g_return_val_if_reached (priv->egl_config);
|
||||
}
|
||||
}
|
||||
|
||||
static EGLDisplay
|
||||
|
@ -1537,12 +1537,13 @@ gdk_memory_depth_merge (GdkMemoryDepth depth1,
|
||||
GdkMemoryDepth depth2)
|
||||
{
|
||||
static const GdkMemoryDepth merged_depths[GDK_N_DEPTHS][GDK_N_DEPTHS] = {
|
||||
/* U8 U8_SRGB U16 FLOAT16 FLOAT32 */
|
||||
[GDK_MEMORY_U8] = { GDK_MEMORY_U8, GDK_MEMORY_FLOAT16, GDK_MEMORY_U16, GDK_MEMORY_FLOAT16, GDK_MEMORY_FLOAT32 },
|
||||
[GDK_MEMORY_U8_SRGB] = { GDK_MEMORY_FLOAT16, GDK_MEMORY_U8_SRGB, GDK_MEMORY_FLOAT32, GDK_MEMORY_FLOAT16, GDK_MEMORY_FLOAT32 },
|
||||
[GDK_MEMORY_U16] = { GDK_MEMORY_U16, GDK_MEMORY_FLOAT32, GDK_MEMORY_U16, GDK_MEMORY_FLOAT32, GDK_MEMORY_FLOAT32 },
|
||||
[GDK_MEMORY_FLOAT16] = { GDK_MEMORY_FLOAT16, GDK_MEMORY_FLOAT16, GDK_MEMORY_FLOAT32, GDK_MEMORY_FLOAT16, GDK_MEMORY_FLOAT32 },
|
||||
[GDK_MEMORY_FLOAT32] = { GDK_MEMORY_FLOAT32, GDK_MEMORY_FLOAT32, GDK_MEMORY_FLOAT32, GDK_MEMORY_FLOAT32, GDK_MEMORY_FLOAT32 },
|
||||
/* NONE U8 U8_SRGB U16 FLOAT16 FLOAT32 */
|
||||
[GDK_MEMORY_NONE] = { GDK_MEMORY_NONE, GDK_MEMORY_U8, GDK_MEMORY_U8_SRGB, GDK_MEMORY_U16, GDK_MEMORY_FLOAT16, GDK_MEMORY_FLOAT32 },
|
||||
[GDK_MEMORY_U8] = { GDK_MEMORY_U8, GDK_MEMORY_U8, GDK_MEMORY_FLOAT16, GDK_MEMORY_U16, GDK_MEMORY_FLOAT16, GDK_MEMORY_FLOAT32 },
|
||||
[GDK_MEMORY_U8_SRGB] = { GDK_MEMORY_U8_SRGB, GDK_MEMORY_FLOAT16, GDK_MEMORY_U8_SRGB, GDK_MEMORY_FLOAT32, GDK_MEMORY_FLOAT16, GDK_MEMORY_FLOAT32 },
|
||||
[GDK_MEMORY_U16] = { GDK_MEMORY_U16, GDK_MEMORY_U16, GDK_MEMORY_FLOAT32, GDK_MEMORY_U16, GDK_MEMORY_FLOAT32, GDK_MEMORY_FLOAT32 },
|
||||
[GDK_MEMORY_FLOAT16] = { GDK_MEMORY_FLOAT16, GDK_MEMORY_FLOAT16, GDK_MEMORY_FLOAT16, GDK_MEMORY_FLOAT32, GDK_MEMORY_FLOAT16, GDK_MEMORY_FLOAT32 },
|
||||
[GDK_MEMORY_FLOAT32] = { GDK_MEMORY_FLOAT32, GDK_MEMORY_FLOAT32, GDK_MEMORY_FLOAT32, GDK_MEMORY_FLOAT32, GDK_MEMORY_FLOAT32, GDK_MEMORY_FLOAT32 },
|
||||
};
|
||||
|
||||
g_assert (depth1 < GDK_N_DEPTHS);
|
||||
@ -1565,6 +1566,7 @@ gdk_memory_depth_get_format (GdkMemoryDepth depth)
|
||||
{
|
||||
switch (depth)
|
||||
{
|
||||
case GDK_MEMORY_NONE:
|
||||
case GDK_MEMORY_U8:
|
||||
case GDK_MEMORY_U8_SRGB:
|
||||
return GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
|
||||
@ -1594,6 +1596,7 @@ gdk_memory_depth_get_alpha_format (GdkMemoryDepth depth)
|
||||
{
|
||||
switch (depth)
|
||||
{
|
||||
case GDK_MEMORY_NONE:
|
||||
case GDK_MEMORY_U8:
|
||||
case GDK_MEMORY_U8_SRGB:
|
||||
return GDK_MEMORY_A8;
|
||||
@ -1621,6 +1624,7 @@ gdk_memory_depth_is_srgb (GdkMemoryDepth depth)
|
||||
case GDK_MEMORY_U8_SRGB:
|
||||
return TRUE;
|
||||
|
||||
case GDK_MEMORY_NONE:
|
||||
case GDK_MEMORY_U8:
|
||||
case GDK_MEMORY_U16:
|
||||
case GDK_MEMORY_FLOAT16:
|
||||
|
@ -37,6 +37,7 @@ typedef enum {
|
||||
} GdkMemoryAlpha;
|
||||
|
||||
typedef enum {
|
||||
GDK_MEMORY_NONE,
|
||||
GDK_MEMORY_U8,
|
||||
GDK_MEMORY_U8_SRGB,
|
||||
GDK_MEMORY_U16,
|
||||
|
@ -643,7 +643,7 @@ gdk_vulkan_context_begin_frame (GdkDrawContext *draw_context,
|
||||
VkResult acquire_result;
|
||||
guint i;
|
||||
|
||||
if (depth != priv->current_depth)
|
||||
if (depth != priv->current_depth && depth != GDK_MEMORY_NONE)
|
||||
{
|
||||
if (priv->formats[depth].gdk_format != priv->formats[priv->current_depth].gdk_format)
|
||||
{
|
||||
@ -936,6 +936,7 @@ gdk_vulkan_context_real_init (GInitable *initable,
|
||||
priv->formats[GDK_MEMORY_FLOAT16] = priv->formats[GDK_MEMORY_FLOAT32];
|
||||
if (priv->formats[GDK_MEMORY_U16].vk_format.format == VK_FORMAT_UNDEFINED)
|
||||
priv->formats[GDK_MEMORY_U16] = priv->formats[GDK_MEMORY_FLOAT32];
|
||||
priv->formats[GDK_MEMORY_NONE] = priv->formats[GDK_MEMORY_U8];
|
||||
|
||||
if (!gdk_vulkan_context_check_swapchain (context, error))
|
||||
goto out_surface;
|
||||
|
@ -3396,6 +3396,7 @@ gsk_container_node_new (GskRenderNode **children,
|
||||
if (n_children == 0)
|
||||
{
|
||||
gsk_rect_init_from_rect (&node->bounds, graphene_rect_zero ());
|
||||
node->preferred_depth = GDK_MEMORY_NONE;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -3619,6 +3619,7 @@ append_texture_param (Printer *p,
|
||||
g_string_append (p->str, "url(\"data:image/tiff;base64,\\\n");
|
||||
break;
|
||||
|
||||
case GDK_MEMORY_NONE:
|
||||
case GDK_N_DEPTHS:
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
|
Loading…
Reference in New Issue
Block a user