* Source/NSImage.m: Throw an exception if you attempt to lock focus on an image with

size (0, 0)
* Source/NSCachedImageRep.m: Throw an exception if you attempt to create a cached
image rep with a size of (0, 0).


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33819 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2011-09-08 18:42:31 +00:00
parent 741578fb42
commit 192e2d6174
3 changed files with 19 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2011-09-08 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSImage.m: Throw an exception if you attempt to lock focus on an image with
size (0, 0)
* Source/NSCachedImageRep.m: Throw an exception if you attempt to create a cached
image rep with a size of (0, 0).
2011-09-07 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSFontPanel.m: Add a tooltip on the character panel button

View file

@ -89,6 +89,14 @@
{
NSWindow *win;
if (aSize.width <= 0 || aSize.height <= 0 ||
pixelsWide <= 0 || pixelsHigh <= 0)
{
[NSException raise: NSInvalidArgumentException
format: @"NSCachedImageRep created with size %@ pixelsWide %d pixelsHigh %d",
NSStringFromSize(aSize), pixelsWide, pixelsHigh];
}
// FIXME: Only create new window when separate is YES
win = [[GSCacheW alloc] initWithContentRect: NSMakeRect(0, 0, pixelsWide, pixelsHigh)
styleMask: NSBorderlessWindowMask | NSUnscaledWindowMask

View file

@ -1055,6 +1055,10 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
NSWindow *window;
GSRepData *repd;
if (NSSizesEqual(NSZeroSize, [self size]))
[NSException raise: NSImageCacheException
format: @"Cannot lock focus on image with size (0, 0)"];
if (imageRep == nil)
imageRep = [self bestRepresentationForDevice: nil];