Commit 2566f386 authored by Jan D's avatar Jan D

Backport: Don't cache images in nsimage.m (Bug#18918).

Fixes: Bug#18918

* nsterm.h (EmacsImage): Remove imageListNext, refCount, reference,
imageListSetNext, imageListNext.

* nsimage.m (ImageList, imageListNext, imageListSetNext:)
(reference): Remove.
(allocInitFromFile:): Remove searching ImageList and calling
reference (Bug#18918).
(dealloc): Remove handling if ImageList.
parent 216c6aad
2014-11-02 Jan Djärv <jan.h.d@swipnet.se>
* nsterm.h (EmacsImage): Remove imageListNext, refCount, reference,
imageListSetNext, imageListNext.
* nsimage.m (ImageList, imageListNext, imageListSetNext:)
(reference): Remove.
(allocInitFromFile:): Remove searching ImageList and calling
reference (Bug#18918).
(dealloc): Remove handling if ImageList.
2014-12-22 Jan Djärv <jan.h.d@swipnet.se> 2014-12-22 Jan Djärv <jan.h.d@swipnet.se>
* xterm.c (do_ewmh_fullscreen): Don't remove maximized_horz/vert * xterm.c (do_ewmh_fullscreen): Don't remove maximized_horz/vert
......
...@@ -160,25 +160,11 @@ Updated by Christian Limpach (chris@nice.ch) ...@@ -160,25 +160,11 @@ Updated by Christian Limpach (chris@nice.ch)
@implementation EmacsImage @implementation EmacsImage
static EmacsImage *ImageList = nil;
+ allocInitFromFile: (Lisp_Object)file + allocInitFromFile: (Lisp_Object)file
{ {
EmacsImage *image = ImageList;
NSImageRep *imgRep; NSImageRep *imgRep;
Lisp_Object found; Lisp_Object found;
EmacsImage *image;
/* look for an existing image of the same name */
while (image != nil &&
[[image name] compare: [NSString stringWithUTF8String: SSDATA (file)]]
!= NSOrderedSame)
image = [image imageListNext];
if (image != nil)
{
[image reference];
return image;
}
/* Search bitmap-file-path for the file, if appropriate. */ /* Search bitmap-file-path for the file, if appropriate. */
found = x_find_image_file (file); found = x_find_image_file (file);
...@@ -205,54 +191,14 @@ @implementation EmacsImage ...@@ -205,54 +191,14 @@ @implementation EmacsImage
[image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])];
[image setName: [NSString stringWithUTF8String: SSDATA (file)]]; [image setName: [NSString stringWithUTF8String: SSDATA (file)]];
[image reference];
ImageList = [image imageListSetNext: ImageList];
return image; return image;
} }
- reference
{
refCount++;
return self;
}
- imageListSetNext: (id)arg
{
imageListNext = arg;
return self;
}
- imageListNext
{
return imageListNext;
}
- (void)dealloc - (void)dealloc
{ {
id list = ImageList;
if (refCount > 1)
{
refCount--;
return;
}
[stippleMask release]; [stippleMask release];
if (list == self)
ImageList = imageListNext;
else
{
while (list != nil && [list imageListNext] != self)
list = [list imageListNext];
[list imageListSetNext: imageListNext];
}
[super dealloc]; [super dealloc];
} }
......
...@@ -358,16 +358,11 @@ typedef float EmacsCGFloat; ...@@ -358,16 +358,11 @@ typedef float EmacsCGFloat;
@interface EmacsImage : NSImage @interface EmacsImage : NSImage
{ {
id imageListNext;
int refCount;
NSBitmapImageRep *bmRep; /* used for accessing pixel data */ NSBitmapImageRep *bmRep; /* used for accessing pixel data */
unsigned char *pixmapData[5]; /* shortcut to access pixel data */ unsigned char *pixmapData[5]; /* shortcut to access pixel data */
NSColor *stippleMask; NSColor *stippleMask;
} }
+ allocInitFromFile: (Lisp_Object)file; + allocInitFromFile: (Lisp_Object)file;
- reference;
- imageListSetNext: (id)arg;
- imageListNext;
- (void)dealloc; - (void)dealloc;
- initFromXBM: (unsigned char *)bits width: (int)w height: (int)h - initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
flip: (BOOL)flip; flip: (BOOL)flip;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment