gsk: Upload textures in linear sRGB
We want to do compositing in a linear colorspace, so convert textures to linear sRGB before uploading. Currently, this causes images to come out dark, since we don't have a way to tell the compositor that our framebuffer is linear, so it assumes a gamma that we don't provide.
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
#include <gdk/gdkglcontextprivate.h>
|
||||
#include <gdk/gdkmemoryformatprivate.h>
|
||||
#include <gdk/gdkmemorytextureprivate.h>
|
||||
#include <gdk/gdkcolorprofileprivate.h>
|
||||
#include <gdk/gdkprofilerprivate.h>
|
||||
#include <gsk/gskdebugprivate.h>
|
||||
#include <gsk/gskroundedrectprivate.h>
|
||||
@@ -1391,7 +1392,7 @@ gsk_gl_command_queue_do_upload_texture (GskGLCommandQueue *self,
|
||||
}
|
||||
}
|
||||
|
||||
memtex = gdk_memory_texture_from_texture (texture, data_format, gdk_color_profile_get_srgb ());
|
||||
memtex = gdk_memory_texture_from_texture (texture, data_format, gdk_color_profile_get_srgb_linear ());
|
||||
data = gdk_memory_texture_get_data (memtex);
|
||||
stride = gdk_memory_texture_get_stride (memtex);
|
||||
bpp = gdk_memory_format_bytes_per_pixel (data_format);
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
|
||||
#include <gdk/gdkglcontextprivate.h>
|
||||
#include <gdk/gdkmemoryformatprivate.h>
|
||||
#include <gdk/gdkcolorprofileprivate.h>
|
||||
#include <gdk/gdkprofilerprivate.h>
|
||||
|
||||
#include "gskglcommandqueueprivate.h"
|
||||
@@ -284,11 +285,11 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
|
||||
gdk_memory_convert (pixel_data,
|
||||
width * 4,
|
||||
GDK_MEMORY_R8G8B8A8_PREMULTIPLIED,
|
||||
gdk_color_profile_get_srgb (),
|
||||
gdk_color_profile_get_srgb_linear (),
|
||||
cairo_image_surface_get_data (surface),
|
||||
width * 4,
|
||||
GDK_MEMORY_DEFAULT,
|
||||
gdk_color_profile_get_srgb (),
|
||||
gdk_color_profile_get_srgb_linear (),
|
||||
width, height);
|
||||
gl_format = GL_RGBA;
|
||||
gl_type = GL_UNSIGNED_BYTE;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <gdk/gdkglcontextprivate.h>
|
||||
#include <gdk/gdkmemoryformatprivate.h>
|
||||
#include <gdk/gdkprofilerprivate.h>
|
||||
#include <gdk/gdkcolorprofileprivate.h>
|
||||
#include <gdk/gdktextureprivate.h>
|
||||
#include <gdk/gdkmemorytextureprivate.h>
|
||||
|
||||
@@ -97,7 +98,6 @@ gsk_ngl_texture_prepare_upload (GdkGLContext *context,
|
||||
g_object_unref (memtex);
|
||||
|
||||
format = GDK_MEMORY_R8G8B8A8_PREMULTIPLIED;
|
||||
profile = gdk_color_profile_get_srgb ();
|
||||
if (!gdk_memory_format_gl_format (format,
|
||||
gdk_gl_context_get_use_es (context),
|
||||
gl_internalformat,
|
||||
@@ -108,7 +108,7 @@ gsk_ngl_texture_prepare_upload (GdkGLContext *context,
|
||||
}
|
||||
}
|
||||
|
||||
return gdk_memory_texture_from_texture (texture, format, profile);
|
||||
return gdk_memory_texture_from_texture (texture, format, gdk_color_profile_get_srgb_linear ());
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#include <gdk/gdkglcontextprivate.h>
|
||||
#include <gdk/gdkprofilerprivate.h>
|
||||
#include <gdk/gdkrgbaprivate.h>
|
||||
#include <gdk/gdkcolorprofileprivate.h>
|
||||
#include <gsk/gskrendernodeprivate.h>
|
||||
#include <gsk/gskglshaderprivate.h>
|
||||
#include <gdk/gdktextureprivate.h>
|
||||
@@ -1226,6 +1227,8 @@ gsk_gl_render_job_visit_as_fallback (GskGLRenderJob *job,
|
||||
surface_width,
|
||||
surface_height);
|
||||
|
||||
gdk_cairo_surface_set_color_profile (rendered_surface, gdk_color_profile_get_srgb_linear ());
|
||||
|
||||
cairo_surface_set_device_scale (rendered_surface, scale_x, scale_y);
|
||||
cr = cairo_create (rendered_surface);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user