[gtk/matthiasc/color-profile-rebased: 856/875] 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: 856/875] gsk: Upload textures in linear sRGB
- Date: Wed, 28 Sep 2022 18:51:56 +0000 (UTC)
commit 1ea0bc8b61906088ebb71f9c2877fe964c0dd7e0
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 689480a60d..e86effe643 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"
@@ -280,11 +281,11 @@ gsk_gl_glyph_library_upload_glyph (GskGLGlyphLibrary *self,
pixel_data = free_data = g_malloc (width * height * 4);
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),
stride,
GDK_MEMORY_DEFAULT,
- gdk_color_space_get_srgb (),
+ gdk_color_space_get_srgb_linear (),
width, height);
stride = width * 4;
gl_format = GL_RGBA;
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]