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>
* xterm.c (do_ewmh_fullscreen): Don't remove maximized_horz/vert
......
......@@ -160,25 +160,11 @@ Updated by Christian Limpach (chris@nice.ch)
@implementation EmacsImage
static EmacsImage *ImageList = nil;
+ allocInitFromFile: (Lisp_Object)file
{
EmacsImage *image = ImageList;
NSImageRep *imgRep;
Lisp_Object found;
/* 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;
}
EmacsImage *image;
/* Search bitmap-file-path for the file, if appropriate. */
found = x_find_image_file (file);
......@@ -205,54 +191,14 @@ @implementation EmacsImage
[image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])];
[image setName: [NSString stringWithUTF8String: SSDATA (file)]];
[image reference];
ImageList = [image imageListSetNext: ImageList];
return image;
}
- reference
{
refCount++;
return self;
}
- imageListSetNext: (id)arg
{
imageListNext = arg;
return self;
}
- imageListNext
{
return imageListNext;
}
- (void)dealloc
{
id list = ImageList;
if (refCount > 1)
{
refCount--;
return;
}
[stippleMask release];
if (list == self)
ImageList = imageListNext;
else
{
while (list != nil && [list imageListNext] != self)
list = [list imageListNext];
[list imageListSetNext: imageListNext];
}
[super dealloc];
}
......
......@@ -358,16 +358,11 @@ typedef float EmacsCGFloat;
@interface EmacsImage : NSImage
{
id imageListNext;
int refCount;
NSBitmapImageRep *bmRep; /* used for accessing pixel data */
unsigned char *pixmapData[5]; /* shortcut to access pixel data */
NSColor *stippleMask;
}
+ allocInitFromFile: (Lisp_Object)file;
- reference;
- imageListSetNext: (id)arg;
- imageListNext;
- (void)dealloc;
- initFromXBM: (unsigned char *)bits width: (int)w height: (int)h
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