From 217ddd65b7d51317779310a76abef4eb273e5792 Mon Sep 17 00:00:00 2001 From: cristy Date: Fri, 6 Dec 2013 23:27:09 +0000 Subject: [PATCH] --- coders/jpeg.c | 45 ++++++++++++++++++++++++--------------------- 1 file changed, 24 insertions(+), 21 deletions(-) diff --git a/coders/jpeg.c b/coders/jpeg.c index 352b6d57b..88f67ffd8 100644 --- a/coders/jpeg.c +++ b/coders/jpeg.c @@ -1360,23 +1360,26 @@ static Image *ReadJPEGImage(const ImageInfo *image_info, if (image->colorspace != CMYKColorspace) for (x=0; x < (ssize_t) image->columns; x++) { - SetPixelRed(image,ScaleShortToQuantum(scale*GETJSAMPLE(*p++)),q); - SetPixelGreen(image,ScaleShortToQuantum(scale*GETJSAMPLE(*p++)),q); - SetPixelBlue(image,ScaleShortToQuantum(scale*GETJSAMPLE(*p++)),q); + SetPixelRed(image,ScaleShortToQuantum(scale*GETJSAMPLE(*p++)), + q); + SetPixelGreen(image,ScaleShortToQuantum(scale*GETJSAMPLE(*p++)), + q); + SetPixelBlue(image,ScaleShortToQuantum(scale*GETJSAMPLE(*p++)), + q); SetPixelAlpha(image,OpaqueAlpha,q); q+=GetPixelChannels(image); } else for (x=0; x < (ssize_t) image->columns; x++) { - SetPixelCyan(image,QuantumRange- - ScaleShortToQuantum(scale*GETJSAMPLE(*p++)),q); - SetPixelMagenta(image,QuantumRange- - ScaleShortToQuantum(scale*GETJSAMPLE(*p++)),q); - SetPixelYellow(image,QuantumRange- - ScaleShortToQuantum(scale*GETJSAMPLE(*p++)),q); - SetPixelBlack(image,QuantumRange- - ScaleShortToQuantum(scale*GETJSAMPLE(*p++)),q); + SetPixelCyan(image,QuantumRange-ScaleShortToQuantum(scale* + GETJSAMPLE(*p++)),q); + SetPixelMagenta(image,QuantumRange-ScaleShortToQuantum(scale* + GETJSAMPLE(*p++)),q); + SetPixelYellow(image,QuantumRange-ScaleShortToQuantum(scale* + GETJSAMPLE(*p++)),q); + SetPixelBlack(image,QuantumRange-ScaleShortToQuantum(scale* + GETJSAMPLE(*p++)),q); SetPixelAlpha(image,OpaqueAlpha,q); q+=GetPixelChannels(image); } @@ -2727,8 +2730,8 @@ static MagickBooleanType WriteJPEGImage(const ImageInfo *image_info, q=jpeg_pixels; for (x=0; x < (ssize_t) image->columns; x++) { - *q++=(JSAMPLE) (ScaleQuantumToShort(ClampToQuantum(GetPixelLuma( - image,p)))/scale); + *q++=(JSAMPLE) (ScaleQuantumToShort(ClampToQuantum(GetPixelLuma(image, + p)))/scale); p+=GetPixelChannels(image); } (void) jpeg_write_scanlines(&jpeg_info,scanline,1); @@ -2783,14 +2786,14 @@ static MagickBooleanType WriteJPEGImage(const ImageInfo *image_info, /* Convert DirectClass packets to contiguous CMYK scanlines. */ - *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange- - GetPixelRed(image,p))/scale); - *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange- - GetPixelGreen(image,p))/scale); - *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange- - GetPixelBlue(image,p))/scale); - *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange- - GetPixelBlack(image,p))/scale); + *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange-GetPixelRed( + image,p))/scale); + *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange-GetPixelGreen( + image,p))/scale); + *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange-GetPixelBlue( + image,p))/scale); + *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange-GetPixelBlack( + image,p))/scale); p+=GetPixelChannels(image); } (void) jpeg_write_scanlines(&jpeg_info,scanline,1); -- 2.40.0