[gtk/matthiasc/color-profiles] ngl: Linearize colors too
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/matthiasc/color-profiles] ngl: Linearize colors too
- Date: Thu, 30 Sep 2021 03:28:54 +0000 (UTC)
commit 94b1f09cbb22abf8c579668308069da97ed0be9e
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Sep 29 23:27:57 2021 -0400
ngl: Linearize colors too
Convert all the GdkRGBA colors that we have
in render nodes to linear sRGB before using
them. This brings the rendering back in line
with what cairo produces, except for the video.
gsk/ngl/gsknglrenderjob.c | 22 +++++++++++++++++-----
1 file changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/gsk/ngl/gsknglrenderjob.c b/gsk/ngl/gsknglrenderjob.c
index 5a03e5f5b6..adecb988d2 100644
--- a/gsk/ngl/gsknglrenderjob.c
+++ b/gsk/ngl/gsknglrenderjob.c
@@ -30,6 +30,7 @@
#include <gsk/gskglshaderprivate.h>
#include <gdk/gdktextureprivate.h>
#include <gdk/gdkcolorprofileprivate.h>
+#include <gdk/gdkmemoryformatprivate.h>
#include <gsk/gsktransformprivate.h>
#include <gsk/gskroundedrectprivate.h>
#include <math.h>
@@ -929,7 +930,19 @@ static inline void
rgba_to_half (const GdkRGBA *rgba,
guint16 h[4])
{
- float_to_half4 ((const float *)rgba, h);
+ GdkRGBA d;
+ gdk_memory_convert ((guchar *) &d,
+ sizeof (float) * 4,
+ GDK_MEMORY_R32G32B32_FLOAT,
+ gdk_color_profile_get_srgb_linear (),
+ (guchar *) rgba,
+ sizeof (float) * 4,
+ GDK_MEMORY_R32G32B32_FLOAT,
+ gdk_color_profile_get_srgb (),
+ 1,
+ 1);
+ d.alpha = rgba->alpha;
+ float_to_half4 ((const float *)&d, h);
}
/* fill_vertex_data */
@@ -3997,16 +4010,15 @@ static void
gsk_ngl_render_job_postprocess (GskNglRenderJob *job,
guint texture_id)
{
- GskNglProgram *program = job->driver->postprocessing_no_clip;
-
gsk_ngl_command_queue_bind_framebuffer (job->command_queue, job->framebuffer);
+ gsk_ngl_command_queue_clear (job->command_queue, 0, &job->viewport);
- gsk_ngl_render_job_begin_draw (job, program);
+ gsk_ngl_render_job_begin_draw (job, CHOOSE_PROGRAM (job, postprocessing));
gsk_ngl_program_set_uniform_texture (job->current_program,
UNIFORM_SHARED_SOURCE, 0,
GL_TEXTURE_2D, GL_TEXTURE0, texture_id);
gsk_ngl_uniform_state_set1f (job->command_queue->uniforms,
- program->program_info,
+ job->current_program->program_info,
UNIFORM_GAMMA, 0,
2.2);
gsk_ngl_render_job_draw_offscreen_rect (job, &job->viewport);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]