* Source/NSBitmapImageRep+PNG.m:

HACK: PNG can not represent 72DPI exactly. If the pixels-per-meter value is
near 72DPI, assume it is exactly 72 DPI. Note that the same problem occurrs
at 144DPI, or 288DPI... so don't use PNG for resolution independent graphics.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34127 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2011-11-06 22:31:23 +00:00
parent 4b64d6f2f6
commit 7362d7314d
2 changed files with 20 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2011-11-06 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSBitmapImageRep+PNG.m:
HACK: PNG can not represent 72DPI exactly. If the pixels-per-meter value is
near 72DPI, assume it is exactly 72 DPI. Note that the same problem occurrs
at 144DPI, or 288DPI... so don't use PNG for resolution independent graphics.
2011-11-06 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSPopUpButtonCell.m (-insertItemWithTitle:atIndex:): Set

View file

@ -266,6 +266,19 @@ static void reader_func(png_structp png_struct, png_bytep data,
const CGFloat pointsPerMeter = 39.3700787 * 72.0;
NSSize sizeInPoints = NSMakeSize((width / (CGFloat)xppm) * pointsPerMeter,
(height / (CGFloat)yppm) * pointsPerMeter);
// HACK: PNG can not represent 72DPI exactly. If the ppm value is near 72DPI,
// assume it is exactly 72 DPI. Note that the same problem occurrs at 144DPI...
// so don't use PNG for resolution independent graphics.
if (xppm == 2834 || xppm == 2835)
{
sizeInPoints.width = width;
}
if (yppm == 2834 || yppm == 2835)
{
sizeInPoints.height = height;
}
[self setSize: sizeInPoints];
}
}