GraphicsMagick: Initialize colors directly.
GraphicsMagick Commits <[email protected]>
| Newsgroups | gmane.comp.video.graphicsmagick.cvs |
|---|---|
| Message-ID | <mailman.36897.1672259904.1459.graphicsmagick-commit@lists.sourceforge.net> |
changeset 2df243003b44 in /hg/GraphicsMagick details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=2df243003b44 summary: Initialize colors directly. diffstat: ChangeLog | 3 +++ magick/color_lookup-private.h | 36 ++++++++++++++++++++++++++++++++++++ magick/compare.c | 5 ++++- magick/image.c | 16 ++++++---------- magick/studio.h | 5 ----- www/Changelog.html | 2 ++ 6 files changed, 51 insertions(+), 16 deletions(-) diffs (139 lines): diff -r 9325f5f98cdb -r 2df243003b44 ChangeLog --- a/ChangeLog Wed Dec 28 09:11:04 2022 -0600 +++ b/ChangeLog Wed Dec 28 14:38:12 2022 -0600 @@ -1,5 +1,8 @@ 2022-12-28 Bob Friesenhahn <[email protected]> + * magick/image.c (AllocateImage): Initialize colors directly. + (GetImageInfo): Initialize colors directly. + * utilities/tests/convert-cmds.txt: Add more convert command permutations. diff -r 9325f5f98cdb -r 2df243003b44 magick/color_lookup-private.h --- a/magick/color_lookup-private.h Wed Dec 28 09:11:04 2022 -0600 +++ b/magick/color_lookup-private.h Wed Dec 28 14:38:12 2022 -0600 @@ -50,6 +50,42 @@ extern MagickPassFail InitializeColorInfo(void); +#define BackgroundColor "#ffffffffffff" /* white */ +#define BackgroundColorInit(q) \ + do { SetRedSample(q,MaxRGB); \ + SetGreenSample(q,MaxRGB); \ + SetBlueSample(q,MaxRGB); \ + SetOpacitySample(q,0U); } while(0) + +#define BorderColor "#dfdfdfdfdfdf" /* gray */ +#define BorderColorInit(q) \ + do { \ + SetGraySample(q,ScaleShortToQuantum(0xdfdf)); \ + SetOpacitySample(q,0); \ + } while(0) + +#define ForegroundColor "#000000000000" /* black */ +#define ForegroundColorInit(q) \ + do { \ + SetGraySample(q,0); \ + SetOpacitySample(q,0); } \ + while(0) + +#define HighlightColor "#f1f100001e1e" /* light red */ +#define HighlightColorInit(q) \ + do { SetRedSample(q,ScaleShortToQuantum(0xf1f1)); \ + SetGreenSample(q,ScaleShortToQuantum(0x000)); \ + SetBlueSample(q,ScaleShortToQuantum(0x1e1e)); \ + SetOpacitySample(q,0); \ + } while(0) + +#define MatteColor "#bdbdbdbdbdbd" /* gray */ +#define MatteColorInit(q) \ + do { \ + SetGraySample(q,ScaleShortToQuantum(0xbdbd)); \ + SetOpacitySample(q,0); \ + } while(0) + /* * Local Variables: * mode: c diff -r 9325f5f98cdb -r 2df243003b44 magick/compare.c --- a/magick/compare.c Wed Dec 28 09:11:04 2022 -0600 +++ b/magick/compare.c Wed Dec 28 14:38:12 2022 -0600 @@ -990,10 +990,13 @@ ExceptionInfo *exception) { assert(options != (DifferenceImageOptions *) NULL); + ARG_NOT_USED(exception); + memset(options,0,sizeof(DifferenceImageOptions)); options->channel=AllChannels; options->highlight_style=TintHighlightStyle; - (void) QueryColorDatabase(HighlightColor,&options->highlight_color,exception); + /* (void) QueryColorDatabase(HighlightColor,&options->highlight_color,exception); */ + HighlightColorInit(&options->highlight_color); } diff -r 9325f5f98cdb -r 2df243003b44 magick/image.c --- a/magick/image.c Wed Dec 28 09:11:04 2022 -0600 +++ b/magick/image.c Wed Dec 28 14:38:12 2022 -0600 @@ -361,12 +361,9 @@ allocate_image->compose=OverCompositeOp; allocate_image->blur=1.0; GetExceptionInfo(&allocate_image->exception); - (void) QueryColorDatabase(BackgroundColor,&allocate_image->background_color, - &allocate_image->exception); - (void) QueryColorDatabase(BorderColor,&allocate_image->border_color, - &allocate_image->exception); - (void) QueryColorDatabase(MatteColor,&allocate_image->matte_color, - &allocate_image->exception); + BackgroundColorInit(&allocate_image->background_color); + BorderColorInit(&allocate_image->border_color); + MatteColorInit(&allocate_image->matte_color); allocate_image->orientation=UndefinedOrientation; GetTimerInfo(&allocate_image->timer); GetCacheInfo(&allocate_image->cache); @@ -1944,10 +1941,9 @@ image_info->dither=True; image_info->progress=True; GetExceptionInfo(&exception); - (void) QueryColorDatabase(BackgroundColor,&image_info->background_color, - &exception); - (void) QueryColorDatabase(BorderColor,&image_info->border_color,&exception); - (void) QueryColorDatabase(MatteColor,&image_info->matte_color,&exception); + BackgroundColorInit(&image_info->background_color); + BorderColorInit(&image_info->border_color); + MatteColorInit(&image_info->matte_color); DestroyExceptionInfo(&exception); image_info->signature=MagickSignature; } diff -r 9325f5f98cdb -r 2df243003b44 magick/studio.h --- a/magick/studio.h Wed Dec 28 09:11:04 2022 -0600 +++ b/magick/studio.h Wed Dec 28 14:38:12 2022 -0600 @@ -535,14 +535,9 @@ /* Common const definitions */ -#define BackgroundColor "#ffffffffffff" /* white */ -#define BorderColor "#dfdfdfdfdfdf" /* gray */ #define DefaultTileFrame "15x15+3+3" #define DefaultTileGeometry "120x120+4+3>" #define DefaultTileLabel "%f\n%wx%h\n%b" -#define ForegroundColor "#000000000000" /* black */ -#define HighlightColor "#f1f100001e1e" /* light red */ -#define MatteColor "#bdbdbdbdbdbd" /* gray */ #define PSDensityGeometry "72.0x72.0" #define PSPageGeometry "612x792>" diff -r 9325f5f98cdb -r 2df243003b44 www/Changelog.html --- a/www/Changelog.html Wed Dec 28 09:11:04 2022 -0600 +++ b/www/Changelog.html Wed Dec 28 14:38:12 2022 -0600 @@ -40,6 +40,8 @@ <p>2022-12-28 Bob Friesenhahn <<a class="reference external" href="mailto:bfriesen%40simple.dallas.tx.us">bfriesen<span>@</span>simple<span>.</span>dallas<span>.</span>tx<span>.</span>us</a>></p> <blockquote> <ul class="simple"> +<li><p>magick/image.c (AllocateImage): Initialize colors directly. +(GetImageInfo): Initialize colors directly.</p></li> <li><p>utilities/tests/convert-cmds.txt: Add more convert command permutations.</p></li> </ul>