From 9d8c8ce096b3b8b2b1df1aec061f17eabba22b1d Mon Sep 17 00:00:00 2001 From: cristy Date: Tue, 25 Oct 2011 16:13:52 +0000 Subject: [PATCH] --- MagickCore/decorate.c | 25 ++++++++++++------------- MagickCore/distort.c | 3 +-- MagickCore/histogram.c | 8 ++++---- MagickCore/identify.c | 2 +- MagickCore/image.c | 13 +++---------- MagickCore/paint.c | 17 +++++++---------- MagickCore/paint.h | 4 ++-- MagickCore/pixel-accessor.h | 13 ------------- MagickCore/shear.c | 18 ++++++++---------- MagickWand/drawing-wand.c | 6 +++--- MagickWand/mogrify.c | 2 +- MagickWand/operation.c | 2 +- coders/palm.c | 3 +-- coders/uil.c | 8 ++++---- coders/xpm.c | 4 ++-- 15 files changed, 50 insertions(+), 78 deletions(-) diff --git a/MagickCore/decorate.c b/MagickCore/decorate.c index 6f12c2c66..4771b9ea0 100644 --- a/MagickCore/decorate.c +++ b/MagickCore/decorate.c @@ -185,7 +185,6 @@ MagickExport Image *FrameImage(const Image *image,const FrameInfo *frame_info, PixelInfo accentuate, - border, highlight, interior, matte, @@ -241,39 +240,39 @@ MagickExport Image *FrameImage(const Image *image,const FrameInfo *frame_info, /* Initialize 3D effects color. */ - GetPixelInfo(frame_image,&interior); - SetPixelInfoPacket(frame_image,&image->border_color,&interior); - GetPixelInfo(frame_image,&matte); - matte.colorspace=RGBColorspace; - SetPixelInfoPacket(frame_image,&image->matte_color,&matte); - GetPixelInfo(frame_image,&border); - border.colorspace=RGBColorspace; - SetPixelInfoPacket(frame_image,&image->border_color,&border); - GetPixelInfo(frame_image,&accentuate); + interior=image->border_color; + matte=image->matte_color; + accentuate=matte; accentuate.red=(MagickRealType) (QuantumScale*((QuantumRange- AccentuateModulate)*matte.red+(QuantumRange*AccentuateModulate))); accentuate.green=(MagickRealType) (QuantumScale*((QuantumRange- AccentuateModulate)*matte.green+(QuantumRange*AccentuateModulate))); accentuate.blue=(MagickRealType) (QuantumScale*((QuantumRange- AccentuateModulate)*matte.blue+(QuantumRange*AccentuateModulate))); + accentuate.black=(MagickRealType) (QuantumScale*((QuantumRange- + AccentuateModulate)*matte.black+(QuantumRange*AccentuateModulate))); accentuate.alpha=matte.alpha; - GetPixelInfo(frame_image,&highlight); + highlight=matte; highlight.red=(MagickRealType) (QuantumScale*((QuantumRange- HighlightModulate)*matte.red+(QuantumRange*HighlightModulate))); highlight.green=(MagickRealType) (QuantumScale*((QuantumRange- HighlightModulate)*matte.green+(QuantumRange*HighlightModulate))); highlight.blue=(MagickRealType) (QuantumScale*((QuantumRange- HighlightModulate)*matte.blue+(QuantumRange*HighlightModulate))); + highlight.black=(MagickRealType) (QuantumScale*((QuantumRange- + HighlightModulate)*matte.black+(QuantumRange*HighlightModulate))); highlight.alpha=matte.alpha; - GetPixelInfo(frame_image,&shadow); + shadow=matte; shadow.red=QuantumScale*matte.red*ShadowModulate; shadow.green=QuantumScale*matte.green*ShadowModulate; shadow.blue=QuantumScale*matte.blue*ShadowModulate; + shadow.black=QuantumScale*matte.black*ShadowModulate; shadow.alpha=matte.alpha; - GetPixelInfo(frame_image,&trough); + trough=matte; trough.red=QuantumScale*matte.red*TroughModulate; trough.green=QuantumScale*matte.green*TroughModulate; trough.blue=QuantumScale*matte.blue*TroughModulate; + trough.black=QuantumScale*matte.black*TroughModulate; trough.alpha=matte.alpha; status=MagickTrue; progress=0; diff --git a/MagickCore/distort.c b/MagickCore/distort.c index b934e1b7c..daade12ff 100644 --- a/MagickCore/distort.c +++ b/MagickCore/distort.c @@ -2311,8 +2311,7 @@ MagickExport Image *DistortImage(const Image *image,DistortImageMethod method, */ validity = 1.0; - GetPixelInfo(distort_image,&invalid); - SetPixelInfoPacket(distort_image,&distort_image->matte_color,&invalid); + invalid=distort_image->matte_color; if (distort_image->colorspace == CMYKColorspace) ConvertRGBToCMYK(&invalid); /* what about other color spaces? */ for (i=0; i < (ssize_t) distort_image->columns; i++) diff --git a/MagickCore/histogram.c b/MagickCore/histogram.c index af17ac290..816268bdb 100644 --- a/MagickCore/histogram.c +++ b/MagickCore/histogram.c @@ -257,7 +257,7 @@ static CubeInfo *ClassifyImageColors(const Image *image, } for (i=0; i < (ssize_t) node_info->number_unique; i++) { - SetPixelInfoPacket(image,&node_info->list[i],&target); + target=node_info->list[i]; if (IsPixelInfoEquivalent(&pixel,&target) != MagickFalse) break; } @@ -725,7 +725,7 @@ MagickExport MagickBooleanType IsHistogramImage(const Image *image, break; for (i=0; i < (ssize_t) node_info->number_unique; i++) { - SetPixelInfoPacket(image,&node_info->list[i],&target); + target=node_info->list[i]; if (IsPixelInfoEquivalent(&pixel,&target) != MagickFalse) break; } @@ -885,7 +885,7 @@ MagickExport MagickBooleanType IsPaletteImage(const Image *image, break; for (i=0; i < (ssize_t) node_info->number_unique; i++) { - SetPixelInfoPacket(image,&node_info->list[i],&target); + target=node_info->list[i]; if (IsPixelInfoEquivalent(&pixel,&target) != MagickFalse) break; } @@ -1134,7 +1134,7 @@ MagickExport size_t GetNumberColors(const Image *image,FILE *file, status=MagickTrue; for (i=0; i < (ssize_t) number_colors; i++) { - SetPixelInfoPacket(image,p,&pixel); + pixel=(*p); (void) CopyMagickString(tuple,"(",MaxTextExtent); ConcatenateColorComponent(&pixel,RedPixelChannel,X11Compliance,tuple); (void) ConcatenateMagickString(tuple,",",MaxTextExtent); diff --git a/MagickCore/identify.c b/MagickCore/identify.c index ba1c16def..d6d7501d8 100644 --- a/MagickCore/identify.c +++ b/MagickCore/identify.c @@ -647,7 +647,7 @@ MagickExport MagickBooleanType IdentifyImage(Image *image,FILE *file, p=image->colormap; for (i=0; i < (ssize_t) image->colors; i++) { - SetPixelInfoPacket(image,p,&pixel); + pixel=(*p); (void) CopyMagickString(tuple,"(",MaxTextExtent); ConcatenateColorComponent(&pixel,RedPixelChannel,X11Compliance, tuple); diff --git a/MagickCore/image.c b/MagickCore/image.c index c31f1a363..0e25f8a28 100644 --- a/MagickCore/image.c +++ b/MagickCore/image.c @@ -2433,9 +2433,6 @@ MagickExport MagickBooleanType SetImageAlphaChannel(Image *image, PixelInfo background; - PixelInfo - pixel; - ssize_t y; @@ -2446,9 +2443,7 @@ MagickExport MagickBooleanType SetImageAlphaChannel(Image *image, break; if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse) break; - GetPixelInfo(image,&background); - SetPixelInfoPacket(image,&image->background_color,&background); - SetPacketPixelInfo(image,&background,&pixel); + background=image->background_color; image_view=AcquireCacheView(image); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(dynamic,4) shared(status) @@ -2506,8 +2501,7 @@ MagickExport MagickBooleanType SetImageAlphaChannel(Image *image, /* Reset all color channels to background color. */ - GetPixelInfo(image,&background); - SetPixelInfoPacket(image,&(image->background_color),&background); + background=image->background_color; (void) LevelImageColors(image,&background,&background,MagickTrue, exception); } @@ -2603,8 +2597,7 @@ MagickExport MagickBooleanType SetImageBackgroundColor(Image *image, return(MagickFalse); if (image->background_color.alpha != OpaqueAlpha) image->matte=MagickTrue; - GetPixelInfo(image,&background); - SetPixelInfoPacket(image,&image->background_color,&background); + background=image->background_color; SetPacketPixelInfo(image,&background,&pixel); /* Set image background color. diff --git a/MagickCore/paint.c b/MagickCore/paint.c index 5d13857cb..75f1a1519 100644 --- a/MagickCore/paint.c +++ b/MagickCore/paint.c @@ -138,7 +138,6 @@ MagickExport MagickBooleanType FloodfillPaintImage(Image *image, status; PixelInfo - fill, pixel; PixelInfo @@ -202,7 +201,6 @@ MagickExport MagickBooleanType FloodfillPaintImage(Image *image, s=segment_stack; PushSegmentStack(y,x,x,1); PushSegmentStack(y+1,x,x,-1); - GetPixelInfo(image,&fill); GetPixelInfo(image,&pixel); image_view=AcquireCacheView(image); floodplane_view=AcquireCacheView(floodplane_image); @@ -335,17 +333,16 @@ MagickExport MagickBooleanType FloodfillPaintImage(Image *image, if (GetPixelAlpha(floodplane_image,p) != OpaqueAlpha) { (void) GetFillColor(draw_info,x,y,&fill_color,exception); - SetPixelInfoPacket(image,&fill_color,&fill); if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) - SetPixelRed(image,ClampToQuantum(fill.red),q); + SetPixelRed(image,ClampToQuantum(fill_color.red),q); if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) - SetPixelGreen(image,ClampToQuantum(fill.green),q); + SetPixelGreen(image,ClampToQuantum(fill_color.green),q); if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) - SetPixelBlue(image,ClampToQuantum(fill.blue),q); + SetPixelBlue(image,ClampToQuantum(fill_color.blue),q); if ((GetPixelBlackTraits(image) & UpdatePixelTrait) != 0) - SetPixelBlack(image,ClampToQuantum(fill.black),q); + SetPixelBlack(image,ClampToQuantum(fill_color.black),q); if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) - SetPixelAlpha(image,ClampToQuantum(fill.alpha),q); + SetPixelAlpha(image,ClampToQuantum(fill_color.alpha),q); } p+=GetPixelChannels(floodplane_image); q+=GetPixelChannels(image); @@ -456,9 +453,9 @@ MagickExport MagickBooleanType GradientImage(Image *image, sizeof(*gradient->stops)); for (i=0; i < (ssize_t) gradient->number_stops; i++) GetPixelInfo(image,&gradient->stops[i].color); - SetPixelInfoPacket(image,start_color,&gradient->stops[0].color); + gradient->stops[0].color=(*start_color); gradient->stops[0].offset=0.0; - SetPixelInfoPacket(image,stop_color,&gradient->stops[1].color); + gradient->stops[1].color=(*stop_color); gradient->stops[1].offset=1.0; /* Draw a gradient on the image. diff --git a/MagickCore/paint.h b/MagickCore/paint.h index a6df12453..2897a109d 100644 --- a/MagickCore/paint.h +++ b/MagickCore/paint.h @@ -31,8 +31,8 @@ extern MagickExport Image extern MagickExport MagickBooleanType FloodfillPaintImage(Image *,const DrawInfo *,const PixelInfo *,const ssize_t, const ssize_t,const MagickBooleanType,ExceptionInfo *), - GradientImage(Image *,const GradientType,const SpreadMethod, - const PixelInfo *,const PixelInfo *,ExceptionInfo *), + GradientImage(Image *,const GradientType,const SpreadMethod,const PixelInfo *, + const PixelInfo *,ExceptionInfo *), OpaquePaintImage(Image *,const PixelInfo *,const PixelInfo *, const MagickBooleanType,ExceptionInfo *), TransparentPaintImage(Image *,const PixelInfo *, diff --git a/MagickCore/pixel-accessor.h b/MagickCore/pixel-accessor.h index c480fd69f..872099726 100644 --- a/MagickCore/pixel-accessor.h +++ b/MagickCore/pixel-accessor.h @@ -525,19 +525,6 @@ static inline void SetPixelInfo(const Image *image,const Quantum *pixel, pixel[image->channel_map[IndexPixelChannel].channel]; } -static inline void SetPixelInfoPacket(const Image *image, - const PixelInfo *pixel,PixelInfo *pixel_info) -{ - pixel_info->red=(MagickRealType) pixel->red; - pixel_info->green=(MagickRealType) pixel->green; - pixel_info->blue=(MagickRealType) pixel->blue; - pixel_info->alpha=(MagickRealType) pixel->alpha; - if (image->colorspace == CMYKColorspace) - pixel_info->black=(MagickRealType) pixel->black; - if (image->storage_class == PseudoClass) - pixel_info->index=(MagickRealType) pixel->index; -} - static inline void SetPixelMagenta(const Image *image,const Quantum magenta, Quantum *pixel) { diff --git a/MagickCore/shear.c b/MagickCore/shear.c index 384faee80..d0b015789 100644 --- a/MagickCore/shear.c +++ b/MagickCore/shear.c @@ -1476,16 +1476,15 @@ static MagickBooleanType XShearImage(Image *image,const MagickRealType degrees, ssize_t y; + /* + X shear image. + */ assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); - GetPixelInfo(image,&background); - SetPixelInfoPacket(image,&image->background_color,&background); - /* - X shear image. - */ status=MagickTrue; + background=image->background_color; progress=0; image_view=AcquireCacheView(image); #if defined(MAGICKCORE_OPENMP_SUPPORT) @@ -1692,17 +1691,16 @@ static MagickBooleanType YShearImage(Image *image,const MagickRealType degrees, ssize_t x; + /* + Y Shear image. + */ assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename); - GetPixelInfo(image,&background); - SetPixelInfoPacket(image,&image->background_color,&background); - /* - Y Shear image. - */ status=MagickTrue; progress=0; + background=image->background_color; image_view=AcquireCacheView(image); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(dynamic,4) shared(progress, status) diff --git a/MagickWand/drawing-wand.c b/MagickWand/drawing-wand.c index 5aa037b62..89102c5b5 100644 --- a/MagickWand/drawing-wand.c +++ b/MagickWand/drawing-wand.c @@ -2466,7 +2466,7 @@ WandExport char *DrawGetVectorGraphics(DrawingWand *wand) if (CurrentContext->fill.alpha != OpaqueAlpha) pixel.matte=CurrentContext->fill.alpha != OpaqueAlpha ? MagickTrue : MagickFalse; - SetPixelInfoPacket(wand->image,&CurrentContext->fill,&pixel); + pixel=CurrentContext->fill; GetColorTuple(&pixel,MagickTrue,value); (void) SetXMLTreeContent(child,value); } @@ -2532,7 +2532,7 @@ WandExport char *DrawGetVectorGraphics(DrawingWand *wand) if (CurrentContext->stroke.alpha != OpaqueAlpha) pixel.matte=CurrentContext->stroke.alpha != OpaqueAlpha ? MagickTrue : MagickFalse; - SetPixelInfoPacket(wand->image,&CurrentContext->stroke,&pixel); + pixel=CurrentContext->stroke; GetColorTuple(&pixel,MagickTrue,value); (void) SetXMLTreeContent(child,value); } @@ -2625,7 +2625,7 @@ WandExport char *DrawGetVectorGraphics(DrawingWand *wand) if (CurrentContext->undercolor.alpha != OpaqueAlpha) pixel.matte=CurrentContext->undercolor.alpha != OpaqueAlpha ? MagickTrue : MagickFalse; - SetPixelInfoPacket(wand->image,&CurrentContext->undercolor,&pixel); + pixel=CurrentContext->undercolor; GetColorTuple(&pixel,MagickTrue,value); (void) SetXMLTreeContent(child,value); } diff --git a/MagickWand/mogrify.c b/MagickWand/mogrify.c index b73476e32..c70f7be8a 100644 --- a/MagickWand/mogrify.c +++ b/MagickWand/mogrify.c @@ -678,7 +678,7 @@ WandExport MagickBooleanType MogrifyImage(ImageInfo *image_info,const int argc, quantize_info=AcquireQuantizeInfo(mogrify_info); SetGeometryInfo(&geometry_info); GetPixelInfo(*image,&fill); - SetPixelInfoPacket(*image,&(*image)->background_color,&fill); + fill=(*image)->background_color; attenuate=1.0; compose=(*image)->compose; interpolate_method=UndefinedInterpolatePixel; diff --git a/MagickWand/operation.c b/MagickWand/operation.c index b63e4a3bc..1db89b78f 100644 --- a/MagickWand/operation.c +++ b/MagickWand/operation.c @@ -1588,7 +1588,7 @@ MagickExport MagickBooleanType ApplyImageOperator(MagickWand *wand, quantize_info=AcquireQuantizeInfo(image_info); SetGeometryInfo(&geometry_info); GetPixelInfo(*image,&fill); - SetPixelInfoPacket(*image,&(*image)->background_color,&fill); + fill=(*image)->background_color; channel=image_info->channel; format=GetImageOption(image_info,"format"); diff --git a/coders/palm.c b/coders/palm.c index fd1fa99b6..8baf5412e 100644 --- a/coders/palm.c +++ b/coders/palm.c @@ -513,8 +513,7 @@ static Image *ReadPALMImage(const ImageInfo *image_info, if (flags & PALM_HAS_TRANSPARENCY_FLAG) { if (bits_per_pixel != 16) - SetPixelInfoPacket(image,image->colormap+(mask-transparentIndex), - &transpix); + transpix=image->colormap[mask-transparentIndex]; (void) TransparentPaintImage(image,&transpix,(Quantum) TransparentAlpha, MagickFalse,exception); } diff --git a/coders/uil.c b/coders/uil.c index 3dc11fcb3..4bed55e56 100644 --- a/coders/uil.c +++ b/coders/uil.c @@ -174,12 +174,12 @@ static MagickBooleanType WriteUILImage(const ImageInfo *image_info,Image *image, status, transparent; - PixelInfo - pixel; - MagickSizeType number_pixels; + PixelInfo + pixel; + register const Quantum *p; @@ -303,7 +303,7 @@ static MagickBooleanType WriteUILImage(const ImageInfo *image_info,Image *image, /* Define UIL color. */ - SetPixelInfoPacket(image,image->colormap+i,&pixel); + pixel=image->colormap[i]; pixel.colorspace=RGBColorspace; pixel.depth=8; pixel.alpha=(MagickRealType) OpaqueAlpha; diff --git a/coders/xpm.c b/coders/xpm.c index 4ac87217c..dc579abd2 100644 --- a/coders/xpm.c +++ b/coders/xpm.c @@ -737,7 +737,7 @@ static MagickBooleanType WritePICONImage(const ImageInfo *image_info, /* Define XPM color. */ - SetPixelInfoPacket(image,picon->colormap+i,&pixel); + pixel=picon->colormap[i]; pixel.colorspace=RGBColorspace; pixel.depth=8; pixel.alpha=(MagickRealType) OpaqueAlpha; @@ -973,7 +973,7 @@ static MagickBooleanType WriteXPMImage(const ImageInfo *image_info,Image *image, /* Define XPM color. */ - SetPixelInfoPacket(image,image->colormap+i,&pixel); + pixel=image->colormap[i]; pixel.colorspace=RGBColorspace; pixel.depth=8; pixel.alpha=(MagickRealType) OpaqueAlpha; -- 2.40.0