summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2010-10-20 23:28:28 +0000
committerTor Andersson <tor@ghostscript.com>2010-10-20 23:28:28 +0000
commit6324164812f0952e9352fb24f8d8f1d103f52707 (patch)
tree226b4bd7f2aabcb252ee5187ab33c1ee5af36d8e /fitz
parent3a67269b466ada017058faa8ebed2df10f12c5f4 (diff)
downloadmupdf-6324164812f0952e9352fb24f8d8f1d103f52707.tar.xz
Special case the component scaling for Lab image data when color converting.
Diffstat (limited to 'fitz')
-rw-r--r--fitz/res_colorspace.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/fitz/res_colorspace.c b/fitz/res_colorspace.c
index f770bbcb..9d4d7bc6 100644
--- a/fitz/res_colorspace.c
+++ b/fitz/res_colorspace.c
@@ -347,10 +347,29 @@ fz_stdconvpixmap(fz_pixmap *src, fz_pixmap *dst)
srcn = ss->n;
dstn = ds->n;
- /* TODO: special case Lab colorspace (scaling of components to float) */
+ /* Special case for Lab colorspace (scaling of components to float) */
+ if (!strcmp(ss->name, "Lab") && srcn == 3)
+ {
+ for (y = 0; y < src->h; y++)
+ {
+ for (x = 0; x < src->w; x++)
+ {
+ srcv[0] = *s++ / 255.0f * 100;
+ srcv[1] = *s++ - 128;
+ srcv[2] = *s++ - 128;
+
+ fz_convertcolor(ss, srcv, ds, dstv);
+
+ for (k = 0; k < dstn; k++)
+ *d++ = dstv[k] * 255;
+
+ *d++ = *s++;
+ }
+ }
+ }
/* Brute-force for small images */
- if (src->w * src->h < 256)
+ else if (src->w * src->h < 256)
{
for (y = 0; y < src->h; y++)
{