buffer: force nearest neighbor scaling for CMYK buffers

This makes it possible to work with CMYK based buffers in the ui of
the standalone GEGL binary at zoom factors <100%. The problem this
works around is RGB assumptions in the 2x2 downscale and boxfilter
algorithms for GeglBuffer.
parent fa947c49
...@@ -2015,6 +2015,7 @@ _gegl_buffer_get_unlocked (GeglBuffer *buffer, ...@@ -2015,6 +2015,7 @@ _gegl_buffer_get_unlocked (GeglBuffer *buffer,
g_return_if_fail (scale > 0.0f); g_return_if_fail (scale > 0.0f);
if (format == NULL) if (format == NULL)
format = buffer->soft_format; format = buffer->soft_format;
...@@ -2090,6 +2091,17 @@ _gegl_buffer_get_unlocked (GeglBuffer *buffer, ...@@ -2090,6 +2091,17 @@ _gegl_buffer_get_unlocked (GeglBuffer *buffer,
gint interpolation = (flags & GEGL_BUFFER_FILTER_ALL); gint interpolation = (flags & GEGL_BUFFER_FILTER_ALL);
gint factor = 1; gint factor = 1;
/* XXX: temporary, force nearest neighbor filter for blit saling of
CMYK based buffers
*/
const Babl *bfmt = gegl_buffer_get_format (buffer);
const char *babl_name = babl_get_name (bfmt);
if (babl_name[0] == 'c' ||
babl_name[0] == 'C')
{
interpolation = GEGL_BUFFER_FILTER_NEAREST;
}
while (scale <= 0.5) while (scale <= 0.5)
{ {
x1 = 0 < x1 ? x1 / 2 : (x1 - 1) / 2; x1 = 0 < x1 ? x1 / 2 : (x1 - 1) / 2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment