Merging changes from the trunk to the branch for testplant for NSImage changes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/branches/gnustep_testplant_branch@35317 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2012-07-24 17:04:52 +00:00
parent 09227d4ba2
commit eee9416e6b

View file

@ -1652,7 +1652,33 @@ static NSSize GSResolutionOfImageRep(NSImageRep *rep)
// element which is an array with a first element 0 and than the image rep.
reps = [coder decodeObjectForKey: @"NSReps"];
reps = [reps objectAtIndex: 0];
[self addRepresentation: [reps objectAtIndex: 1]];
id rep = [reps objectAtIndex: 1];
if([rep isKindOfClass:[NSImageRep class]])
{
[self addRepresentation: rep];
}
else
{
if([rep isKindOfClass:[NSURL class]])
{
rep = [NSImageRep imageRepWithContentsOfURL:rep];
// If we are unable to resolved the URL, try to get it from the
// resources folder.
if(rep == nil)
{
NSString *fileName = [[rep absoluteString] lastPathComponent];
NSString *path = [[NSBundle mainBundle] pathForImageResource:fileName];
rep = [NSImageRep imageRepWithContentsOfFile:path];
}
// If the representation was found, add it...
if(rep != nil)
{
[self addRepresentation: rep];
}
}
}
}
if ([coder containsValueForKey: @"NSSize"])
{