[gtk/matthiasc/color-profile-rebased: 28/47] gsk: Upload textures in linear sRGB
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/color-profile-rebased: 28/47] gsk: Upload textures in linear sRGB
- Date: Fri, 13 May 2022 21:23:01 +0000 (UTC)
commit a397e36347976ea10ccd415560ce72e32e4a3cb5
Author: Matthias Clasen <mclasen redhat com>
Date: Sun May 8 13:04:04 2022 -0400
gsk: Upload textures in linear sRGB
We want to do compositing in a linear color space,
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.
gsk/gl/gskglcommandqueue.c | 1 +
gsk/gl/gskglglyphlibrary.c | 5 +++--
gsk/gl/gskgliconlibrary.c | 3 ++-
gsk/gl/gskglrenderjob.c | 3 +++
4 files changed, 9 insertions(+), 3 deletions(-)
---
diff --git a/gsk/gl/gskglcommandqueue.c b/gsk/gl/gskglcommandqueue.c
index 7d4a369a8b..9f1710b8f4 100644
--- a/gsk/gl/gskglcommandqueue.c
+++ b/gsk/gl/gskglcommandqueue.c
@@ -28,6 +28,7 @@
#include <gdk/gdkglcontextprivate.h>
#include <gdk/gdkmemoryformatprivate.h>
#include <gdk/gdkmemorytextureprivate.h>
+#include <gdk/gdkcolorspaceprivate.h>
#include <gdk/gdkprofilerprivate.h>
#include <gsk/gskdebugprivate.h>
#include <gsk/gskroundedrectprivate.h>
diff --git a/gsk/gl/gskglglyphlibrary.c b/gsk/gl/gskglglyphlibrary.c
index 11c269eb92..36aa73b62f 100644
--- a/gsk/gl/gskglglyphlibrary.c
+++ b/gsk/gl/gskglglyphlibrary.c
@@ -22,6 +22,7 @@
#include <gdk/gdkglcontextprivate.h>
#include <gdk/gdkmemoryformatprivate.h>
+#include <gdk/gdkcolorspaceprivate.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_space_get_srgb (),
+ gdk_color_space_get_srgb_linear (),
cairo_image_surface_get_data (surface),
width * 4,
GDK_MEMORY_DEFAULT,
- gdk_color_space_get_srgb (),
+ gdk_color_space_get_srgb_linear (),
width, height);
gl_format = GL_RGBA;
gl_type = GL_UNSIGNED_BYTE;
diff --git a/gsk/gl/gskgliconlibrary.c b/gsk/gl/gskgliconlibrary.c
index cd427c74d8..7d22b3a797 100644
--- a/gsk/gl/gskgliconlibrary.c
+++ b/gsk/gl/gskgliconlibrary.c
@@ -23,6 +23,7 @@
#include <gdk/gdkglcontextprivate.h>
#include <gdk/gdkmemoryformatprivate.h>
#include <gdk/gdkprofilerprivate.h>
+#include <gdk/gdkcolorspaceprivate.h>
#include <gdk/gdktextureprivate.h>
#include <gdk/gdkmemorytextureprivate.h>
@@ -107,7 +108,7 @@ gsk_ngl_texture_prepare_upload (GdkGLContext *context,
}
}
- return gdk_memory_texture_from_texture (texture, format, color_space);
+ return gdk_memory_texture_from_texture (texture, format, gdk_color_space_get_srgb_linear ());
}
static void
diff --git a/gsk/gl/gskglrenderjob.c b/gsk/gl/gskglrenderjob.c
index 97b3d9d4c9..699a809d81 100644
--- a/gsk/gl/gskglrenderjob.c
+++ b/gsk/gl/gskglrenderjob.c
@@ -26,6 +26,7 @@
#include <gdk/gdkglcontextprivate.h>
#include <gdk/gdkprofilerprivate.h>
#include <gdk/gdkrgbaprivate.h>
+#include <gdk/gdkcolorspaceprivate.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_space (rendered_surface, gdk_color_space_get_srgb_linear ());
+
cairo_surface_set_device_scale (rendered_surface, scale_x, scale_y);
cr = cairo_create (rendered_surface);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]