mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-30 17:20:38 +00:00
Moved method [NSBundle pathForImageResource:] to here.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14559 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
ebe7ed977a
commit
73c54f7230
1 changed files with 29 additions and 2 deletions
|
@ -49,6 +49,35 @@
|
|||
BOOL NSImageDoesCaching = YES; /* enable caching */
|
||||
BOOL NSImageForceCaching = NO; /* use on missmatch */
|
||||
|
||||
@implementation NSBundle (NSImageAdditions)
|
||||
|
||||
- (NSString*) pathForImageResource: (NSString*)name
|
||||
{
|
||||
NSString *ext = [name pathExtension];
|
||||
NSString *path = nil;
|
||||
|
||||
if ((ext == nil) || [ext isEqualToString:@""])
|
||||
{
|
||||
NSArray *types = [NSImage imageUnfilteredFileTypes];
|
||||
unsigned c = [types count];
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; path == nil && i < c; i++)
|
||||
{
|
||||
ext = [types objectAtIndex: i];
|
||||
path = [self pathForResource: name ofType: ext];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
name = [name stringByDeletingPathExtension];
|
||||
path = [self pathForResource: name ofType: ext];
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface GSRepData : NSObject
|
||||
{
|
||||
@public
|
||||
|
@ -671,7 +700,6 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
|||
if (NSImageDoesCaching == YES && [rep isKindOfClass: cachedClass])
|
||||
{
|
||||
NSRect rect = [(NSCachedImageRep *)rep rect];
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
float y = aPoint.y;
|
||||
|
||||
NSDebugLLog(@"NSImage", @"composite rect %@ in %@",
|
||||
|
@ -752,7 +780,6 @@ repd_for_rep(NSArray *_reps, NSImageRep *rep)
|
|||
if (NSImageDoesCaching == YES && [rep isKindOfClass: cachedClass])
|
||||
{
|
||||
NSRect rect = [(NSCachedImageRep *)rep rect];
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
float y = aPoint.y;
|
||||
|
||||
// Move the drawing rectangle to the origin of the image rep
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue