diff options
| author | Jan D | 2014-12-24 12:10:01 +0100 |
|---|---|---|
| committer | Jan D | 2014-12-24 12:10:01 +0100 |
| commit | 2566f386bf0ba1e652524aecb43667d9d8ebd929 (patch) | |
| tree | 6408e372edb184e29d80e2e8838e724327d69999 /src | |
| parent | 216c6aadf22bfb9d209b6ce9a469499fd6e1b78f (diff) | |
| download | emacs-2566f386bf0ba1e652524aecb43667d9d8ebd929.tar.gz emacs-2566f386bf0ba1e652524aecb43667d9d8ebd929.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 11 | ||||
| -rw-r--r-- | src/nsimage.m | 56 | ||||
| -rw-r--r-- | src/nsterm.h | 5 |
3 files changed, 12 insertions, 60 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 9aeb8f26152..75545acee90 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,14 @@ | |||
| 1 | 2014-11-02 Jan Djärv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * nsterm.h (EmacsImage): Remove imageListNext, refCount, reference, | ||
| 4 | imageListSetNext, imageListNext. | ||
| 5 | |||
| 6 | * nsimage.m (ImageList, imageListNext, imageListSetNext:) | ||
| 7 | (reference): Remove. | ||
| 8 | (allocInitFromFile:): Remove searching ImageList and calling | ||
| 9 | reference (Bug#18918). | ||
| 10 | (dealloc): Remove handling if ImageList. | ||
| 11 | |||
| 1 | 2014-12-22 Jan Djärv <jan.h.d@swipnet.se> | 12 | 2014-12-22 Jan Djärv <jan.h.d@swipnet.se> |
| 2 | 13 | ||
| 3 | * xterm.c (do_ewmh_fullscreen): Don't remove maximized_horz/vert | 14 | * xterm.c (do_ewmh_fullscreen): Don't remove maximized_horz/vert |
diff --git a/src/nsimage.m b/src/nsimage.m index 6b68072b87a..cb29bf1b047 100644 --- a/src/nsimage.m +++ b/src/nsimage.m | |||
| @@ -160,25 +160,11 @@ ns_set_alpha (void *img, int x, int y, unsigned char a) | |||
| 160 | 160 | ||
| 161 | @implementation EmacsImage | 161 | @implementation EmacsImage |
| 162 | 162 | ||
| 163 | static EmacsImage *ImageList = nil; | ||
| 164 | |||
| 165 | + allocInitFromFile: (Lisp_Object)file | 163 | + allocInitFromFile: (Lisp_Object)file |
| 166 | { | 164 | { |
| 167 | EmacsImage *image = ImageList; | ||
| 168 | NSImageRep *imgRep; | 165 | NSImageRep *imgRep; |
| 169 | Lisp_Object found; | 166 | Lisp_Object found; |
| 170 | 167 | EmacsImage *image; | |
| 171 | /* look for an existing image of the same name */ | ||
| 172 | while (image != nil && | ||
| 173 | [[image name] compare: [NSString stringWithUTF8String: SSDATA (file)]] | ||
| 174 | != NSOrderedSame) | ||
| 175 | image = [image imageListNext]; | ||
| 176 | |||
| 177 | if (image != nil) | ||
| 178 | { | ||
| 179 | [image reference]; | ||
| 180 | return image; | ||
| 181 | } | ||
| 182 | 168 | ||
| 183 | /* Search bitmap-file-path for the file, if appropriate. */ | 169 | /* Search bitmap-file-path for the file, if appropriate. */ |
| 184 | found = x_find_image_file (file); | 170 | found = x_find_image_file (file); |
| @@ -205,54 +191,14 @@ static EmacsImage *ImageList = nil; | |||
| 205 | [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; | 191 | [image setSize: NSMakeSize([imgRep pixelsWide], [imgRep pixelsHigh])]; |
| 206 | 192 | ||
| 207 | [image setName: [NSString stringWithUTF8String: SSDATA (file)]]; | 193 | [image setName: [NSString stringWithUTF8String: SSDATA (file)]]; |
| 208 | [image reference]; | ||
| 209 | ImageList = [image imageListSetNext: ImageList]; | ||
| 210 | 194 | ||
| 211 | return image; | 195 | return image; |
| 212 | } | 196 | } |
| 213 | 197 | ||
| 214 | 198 | ||
| 215 | - reference | ||
| 216 | { | ||
| 217 | refCount++; | ||
| 218 | return self; | ||
| 219 | } | ||
| 220 | |||
| 221 | |||
| 222 | - imageListSetNext: (id)arg | ||
| 223 | { | ||
| 224 | imageListNext = arg; | ||
| 225 | return self; | ||
| 226 | } | ||
| 227 | |||
| 228 | |||
| 229 | - imageListNext | ||
| 230 | { | ||
| 231 | return imageListNext; | ||
| 232 | } | ||
| 233 | |||
| 234 | |||
| 235 | - (void)dealloc | 199 | - (void)dealloc |
| 236 | { | 200 | { |
| 237 | id list = ImageList; | ||
| 238 | |||
| 239 | if (refCount > 1) | ||
| 240 | { | ||
| 241 | refCount--; | ||
| 242 | return; | ||
| 243 | } | ||
| 244 | |||
| 245 | [stippleMask release]; | 201 | [stippleMask release]; |
| 246 | |||
| 247 | if (list == self) | ||
| 248 | ImageList = imageListNext; | ||
| 249 | else | ||
| 250 | { | ||
| 251 | while (list != nil && [list imageListNext] != self) | ||
| 252 | list = [list imageListNext]; | ||
| 253 | [list imageListSetNext: imageListNext]; | ||
| 254 | } | ||
| 255 | |||
| 256 | [super dealloc]; | 202 | [super dealloc]; |
| 257 | } | 203 | } |
| 258 | 204 | ||
diff --git a/src/nsterm.h b/src/nsterm.h index 115d7ac6779..aa23e20ee84 100644 --- a/src/nsterm.h +++ b/src/nsterm.h | |||
| @@ -358,16 +358,11 @@ typedef float EmacsCGFloat; | |||
| 358 | 358 | ||
| 359 | @interface EmacsImage : NSImage | 359 | @interface EmacsImage : NSImage |
| 360 | { | 360 | { |
| 361 | id imageListNext; | ||
| 362 | int refCount; | ||
| 363 | NSBitmapImageRep *bmRep; /* used for accessing pixel data */ | 361 | NSBitmapImageRep *bmRep; /* used for accessing pixel data */ |
| 364 | unsigned char *pixmapData[5]; /* shortcut to access pixel data */ | 362 | unsigned char *pixmapData[5]; /* shortcut to access pixel data */ |
| 365 | NSColor *stippleMask; | 363 | NSColor *stippleMask; |
| 366 | } | 364 | } |
| 367 | + allocInitFromFile: (Lisp_Object)file; | 365 | + allocInitFromFile: (Lisp_Object)file; |
| 368 | - reference; | ||
| 369 | - imageListSetNext: (id)arg; | ||
| 370 | - imageListNext; | ||
| 371 | - (void)dealloc; | 366 | - (void)dealloc; |
| 372 | - initFromXBM: (unsigned char *)bits width: (int)w height: (int)h | 367 | - initFromXBM: (unsigned char *)bits width: (int)w height: (int)h |
| 373 | flip: (BOOL)flip; | 368 | flip: (BOOL)flip; |