From b0cc2440829ce0deb7e81fd61933c5f4f0e8942c Mon Sep 17 00:00:00 2001 From: Keith Isdale Date: Thu, 27 Aug 2009 13:55:41 +1000 Subject: QImageReader via JPEG image load plugin fails to load correctly a CMYK encoded JPEG CMKY encoded JPEG code missing from scaled image JPEG loading Task-number: 260192 Reviewed-by: Stian Sandvik Thomassen --- src/plugins/imageformats/jpeg/qjpeghandler.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/imageformats/jpeg/qjpeghandler.cpp b/src/plugins/imageformats/jpeg/qjpeghandler.cpp index e8728c6..81ef60b 100644 --- a/src/plugins/imageformats/jpeg/qjpeghandler.cpp +++ b/src/plugins/imageformats/jpeg/qjpeghandler.cpp @@ -493,7 +493,16 @@ private: in--; out[i] = qRgb(*in, *in, *in); } - } else { + } else if (cinfo->out_color_space == JCS_CMYK) { + int cols32Bit = scaledWidth() * 4; + in = (uchar*)out + cols32Bit; + for (uint i = scaledWidth(); i--; ) { + in -= 4; + int k = in[3]; + out[i] = qRgb(k * in[0] / 255, k * in[1] / 255, k * in[2] / 255); + //out[i] = qRgb(in[0], in[1], in[2]); + } + } else { in = (uchar*)out + cols24Bit; for (uint i = scaledWidth(); i--; ) { in -= 3; -- cgit v0.12