Author: rmottola Date: Mon Jan 11 12:04:22 2016 New Revision: 39263 URL: http://svn.gna.org/viewcvs/gnustep?rev=39263&view=rev Log: Use actual pixel dimensions and not size, or resolutions different than 72dpi will make wrong thumbnails.
Modified: apps/gworkspace/trunk/ChangeLog apps/gworkspace/trunk/GWorkspace/Thumbnailer/ImageThumbnailer/ImageThumbnailer.m Modified: apps/gworkspace/trunk/ChangeLog URL: http://svn.gna.org/viewcvs/gnustep/apps/gworkspace/trunk/ChangeLog?rev=39263&r1=39262&r2=39263&view=diff ============================================================================== --- apps/gworkspace/trunk/ChangeLog (original) +++ apps/gworkspace/trunk/ChangeLog Mon Jan 11 12:04:22 2016 @@ -1,3 +1,8 @@ +2016-01-11 Riccardo Mottola <r...@gnu.org> + + * GWorkspace/Thumbnailer/GWThumbnailer.m (makeThumbnailForPath) + Use actual pixel dimensions and not size, or resolutions different than 72dpi will make wrong thumbnails. + 2016-01-07 Riccardo Mottola <r...@gnu.org> * Inspector/Attributes.m Modified: apps/gworkspace/trunk/GWorkspace/Thumbnailer/ImageThumbnailer/ImageThumbnailer.m URL: http://svn.gna.org/viewcvs/gnustep/apps/gworkspace/trunk/GWorkspace/Thumbnailer/ImageThumbnailer/ImageThumbnailer.m?rev=39263&r1=39262&r2=39263&view=diff ============================================================================== --- apps/gworkspace/trunk/GWorkspace/Thumbnailer/ImageThumbnailer/ImageThumbnailer.m (original) +++ apps/gworkspace/trunk/GWorkspace/Thumbnailer/ImageThumbnailer/ImageThumbnailer.m Mon Jan 11 12:04:22 2016 @@ -1,6 +1,6 @@ /* ImageThumbnailer.m * - * Copyright (C) 2003-2015 Free Software Foundation, Inc. + * Copyright (C) 2003-2016 Free Software Foundation, Inc. * * Author: Enrico Sersale <enr...@imago.ro> * Riccardo Mottola <r...@gnu.org> @@ -58,16 +58,15 @@ || ((srcSpp == 4) && (bitsPerPixel == 32)) || ((srcSpp == 1) && (bitsPerPixel == 8)) || ((srcSpp == 2) && (bitsPerPixel == 16))) { - NSSize imsize = [image size]; - - if ((imsize.width <= TMBMAX) && (imsize.height <= TMBMAX) - && (imsize.width >= (TMBMAX - RESZLIM)) - && (imsize.height >= (TMBMAX - RESZLIM))) + + if (([srcRep pixelsWide] <= TMBMAX) && ([srcRep pixelsHigh]<= TMBMAX) + && ([srcRep pixelsWide] >= (TMBMAX - RESZLIM)) + && ([srcRep pixelsHigh] >= (TMBMAX - RESZLIM))) { RETAIN (tiffData); RELEASE (image); RELEASE (arp); - + return AUTORELEASE (tiffData); } else @@ -78,7 +77,7 @@ NSInteger destBytesPerRow; NSInteger destBytesPerPixel; NSInteger dstsizeW, dstsizeH; - float fact = (imsize.width >= imsize.height) ? (imsize.width / TMBMAX) : (imsize.height / TMBMAX); + float fact = ([srcRep pixelsWide] >= [srcRep pixelsHigh]) ? ([srcRep pixelsWide] / TMBMAX) : ([srcRep pixelsHigh] / TMBMAX); float xratio; float yratio; @@ -89,11 +88,11 @@ unsigned i; NSData *tiffData; - dstsizeW = (NSInteger)floor(imsize.width / fact + 0.5); - dstsizeH = (NSInteger)floor(imsize.height / fact + 0.5); - - xratio = imsize.width / (float)dstsizeW; - yratio = imsize.height / (float)dstsizeH; + dstsizeW = (NSInteger)floor([srcRep pixelsWide] / fact + 0.5); + dstsizeH = (NSInteger)floor([srcRep pixelsHigh] / fact + 0.5); + + xratio = [srcRep pixelsWide] / (float)dstsizeW; + yratio = [srcRep pixelsHigh] / (float)dstsizeH; destSamplesPerPixel = [srcRep samplesPerPixel]; dstRep = [[NSBitmapImageRep alloc] _______________________________________________ Gnustep-cvs mailing list Gnustep-cvs@gna.org https://mail.gna.org/listinfo/gnustep-cvs