From: cristy Date: Fri, 11 Nov 2011 15:47:57 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~6656 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=48853f123c49f159ce4f5b20f0768a8987800bd0;p=imagemagick --- diff --git a/coders/pdf.c b/coders/pdf.c index 435a525b7..850994027 100644 --- a/coders/pdf.c +++ b/coders/pdf.c @@ -424,8 +424,6 @@ static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) (void) ResetMagickMemory(&hires_bounds,0,sizeof(hires_bounds)); (void) ResetMagickMemory(&page,0,sizeof(page)); (void) ResetMagickMemory(command,0,sizeof(command)); - hires_bounds.x2=0.0; - hires_bounds.y2=0.0; angle=0.0; p=command; for (c=ReadBlobByte(image); c != EOF; c=ReadBlobByte(image)) @@ -523,22 +521,20 @@ static Image *ReadPDFImage(const ImageInfo *image_info,ExceptionInfo *exception) } if (count != 4) continue; - if (((bounds.x2 > hires_bounds.x2) && (bounds.y2 > hires_bounds.y2)) || - ((hires_bounds.x2 == 0.0) && (hires_bounds.y2 == 0.0))) - { - /* - Set PDF render geometry. - */ - (void) FormatLocaleString(geometry,MaxTextExtent, - "%gx%g%+.15g%+.15g",bounds.x2-bounds.x1,bounds.y2-bounds.y1, - bounds.x1,bounds.y1); - (void) SetImageProperty(image,"pdf:HiResBoundingBox",geometry, - exception); - page.width=(size_t) floor(bounds.x2-bounds.x1+0.5); - page.height=(size_t) floor(bounds.y2-bounds.y1+0.5); - hires_bounds=bounds; - } + hires_bounds=bounds; } + if ((hires_bounds.x2 != 0.0) && (hires_bounds.y2 != 0.0)) + { + /* + Set PDF render geometry. + */ + (void) FormatLocaleString(geometry,MaxTextExtent,"%gx%g%+.15g%+.15g", + hires_bounds.x2-bounds.x1,hires_bounds.y2-hires_bounds.y1, + hires_bounds.x1,hires_bounds.y1); + (void) SetImageProperty(image,"pdf:HiResBoundingBox",geometry,exception); + page.width=(size_t) floor(hires_bounds.x2-hires_bounds.x1+0.5); + page.height=(size_t) floor(hires_bounds.y2-hires_bounds.y1+0.5); + } (void) CloseBlob(image); if ((fabs(angle) == 90.0) || (fabs(angle) == 270.0)) {