From: Akihiko Odaki Date: Mon, 19 Feb 2018 20:02:47 +0000 (+0900) Subject: Do not refer to page in OptimizeLayerFrames (#987) X-Git-Tag: 7.0.7-24~49 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b5a7073da902c79264ef8d3ccc8dd715fed8222d;p=imagemagick Do not refer to page in OptimizeLayerFrames (#987) page dimension was used to create images to compare different disposal methods. However, functions used for the comparisons, namely CompareImagesBounds and IsBoundsCleared are based on the dimensions of images themselves. Creating image with page dimension is inefficient when converting images with larger pages and therefore should be avoided. --- diff --git a/MagickCore/layer.c b/MagickCore/layer.c index 567a0a669..c74424311 100644 --- a/MagickCore/layer.c +++ b/MagickCore/layer.c @@ -987,8 +987,7 @@ static Image *OptimizeLayerFrames(const Image *image, /* Initialise Previous Image as fully transparent */ - prev_image=CloneImage(curr,curr->page.width,curr->page.height, - MagickTrue,exception); + prev_image=CloneImage(curr,curr->columns,curr->rows,MagickTrue,exception); if (prev_image == (Image *) NULL) { bounds=(RectangleInfo *) RelinquishMagickMemory(bounds); @@ -1096,8 +1095,8 @@ static Image *OptimizeLayerFrames(const Image *image, dup_bounds.width=dup_bounds.height=0; /* no dup, no pixel added */ if ( add_frames ) { - dup_image=CloneImage(curr->previous,curr->previous->page.width, - curr->previous->page.height,MagickTrue,exception); + dup_image=CloneImage(curr->previous,curr->previous->columns, + curr->previous->rows,MagickTrue,exception); if (dup_image == (Image *) NULL) { bounds=(RectangleInfo *) RelinquishMagickMemory(bounds); @@ -1124,8 +1123,8 @@ static Image *OptimizeLayerFrames(const Image *image, /* Now compare against a simple background disposal */ - bgnd_image=CloneImage(curr->previous,curr->previous->page.width, - curr->previous->page.height,MagickTrue,exception); + bgnd_image=CloneImage(curr->previous,curr->previous->columns, + curr->previous->rows,MagickTrue,exception); if (bgnd_image == (Image *) NULL) { bounds=(RectangleInfo *) RelinquishMagickMemory(bounds); @@ -1280,8 +1279,8 @@ static Image *OptimizeLayerFrames(const Image *image, bgnd_image=DestroyImage(bgnd_image); if ( disposals[i-1] == NoneDispose ) { - prev_image=CloneImage(curr->previous,curr->previous->page.width, - curr->previous->page.height,MagickTrue,exception); + prev_image=CloneImage(curr->previous,curr->columns, + curr->rows,MagickTrue,exception); if (prev_image == (Image *) NULL) { bounds=(RectangleInfo *) RelinquishMagickMemory(bounds);