[gimp] app: color manage palette and gradient previews
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: color manage palette and gradient previews
- Date: Fri, 27 May 2016 21:59:45 +0000 (UTC)
commit 9a871f6262c812e43ff09fd3bbfc760c63f87c8a
Author: Michael Natterer <mitch gimp org>
Date: Fri May 27 23:59:07 2016 +0200
app: color manage palette and gradient previews
app/widgets/gimpviewrenderergradient.c | 11 +++++++++++
app/widgets/gimpviewrendererpalette.c | 19 ++++++++++++++++++-
2 files changed, 29 insertions(+), 1 deletions(-)
---
diff --git a/app/widgets/gimpviewrenderergradient.c b/app/widgets/gimpviewrenderergradient.c
index 10db1f6..3094842 100644
--- a/app/widgets/gimpviewrenderergradient.c
+++ b/app/widgets/gimpviewrenderergradient.c
@@ -159,6 +159,7 @@ gimp_view_renderer_gradient_render (GimpViewRenderer *renderer,
GimpViewRendererGradient *rendergrad = GIMP_VIEW_RENDERER_GRADIENT (renderer);
GimpGradient *gradient = GIMP_GRADIENT (renderer->viewable);
GimpGradientSegment *seg = NULL;
+ GimpColorTransform *transform;
guchar *buf;
guchar *dest;
gint dest_stride;
@@ -194,6 +195,16 @@ gimp_view_renderer_gradient_render (GimpViewRenderer *renderer,
dest = cairo_image_surface_get_data (renderer->surface);
dest_stride = cairo_image_surface_get_stride (renderer->surface);
+ transform = gimp_view_renderer_get_color_transform (renderer, widget,
+ babl_format ("cairo-ARGB32"),
+ babl_format ("cairo-ARGB32"));
+
+ if (transform)
+ gimp_color_transform_process_pixels (transform,
+ babl_format ("cairo-ARGB32"), buf,
+ babl_format ("cairo-ARGB32"), buf,
+ renderer->width);
+
for (y = 0; y < renderer->height; y++, dest += dest_stride)
{
memcpy (dest, buf, renderer->width * 4);
diff --git a/app/widgets/gimpviewrendererpalette.c b/app/widgets/gimpviewrendererpalette.c
index cb73236..d320a20 100644
--- a/app/widgets/gimpviewrendererpalette.c
+++ b/app/widgets/gimpviewrendererpalette.c
@@ -82,6 +82,7 @@ gimp_view_renderer_palette_render (GimpViewRenderer *renderer,
{
GimpViewRendererPalette *renderpal = GIMP_VIEW_RENDERER_PALETTE (renderer);
GimpPalette *palette;
+ GimpColorTransform *transform;
guchar *row;
guchar *dest;
GList *list;
@@ -150,6 +151,10 @@ gimp_view_renderer_palette_render (GimpViewRenderer *renderer,
dest = cairo_image_surface_get_data (renderer->surface);
dest_stride = cairo_image_surface_get_stride (renderer->surface);
+ transform = gimp_view_renderer_get_color_transform (renderer, widget,
+ babl_format ("cairo-RGB24"),
+ babl_format ("cairo-RGB24"));
+
for (y = 0; y < renderer->height; y++)
{
if ((y % renderpal->cell_height) == 0)
@@ -200,7 +205,19 @@ gimp_view_renderer_palette_render (GimpViewRenderer *renderer,
}
else
{
- memcpy (dest, row, renderer->width * 4);
+ if (transform)
+ {
+ gimp_color_transform_process_pixels (transform,
+ babl_format ("cairo-RGB24"),
+ row,
+ babl_format ("cairo-RGB24"),
+ dest,
+ renderer->width);
+ }
+ else
+ {
+ memcpy (dest, row, renderer->width * 4);
+ }
}
dest += dest_stride;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]