summaryrefslogtreecommitdiffstats
path: root/macosx
diff options
context:
space:
mode:
authorritsuka <[email protected]>2013-12-03 17:01:56 +0000
committerritsuka <[email protected]>2013-12-03 17:01:56 +0000
commit037efe2d010f7983cb83879850e276af38d57a80 (patch)
treec0658d1fbebe5edb7170e72c28fa4ec73d399c74 /macosx
parent87ba2a39cc223742796170d87a8563c2e64910d8 (diff)
MacGUI: Release the cached images when the preview window is closed.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5912 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx')
-rw-r--r--macosx/HBPreviewController.m3
-rw-r--r--macosx/HBPreviewGenerator.h2
-rw-r--r--macosx/HBPreviewGenerator.m5
3 files changed, 6 insertions, 4 deletions
diff --git a/macosx/HBPreviewController.m b/macosx/HBPreviewController.m
index 8cca74037..9d9d2c6fd 100644
--- a/macosx/HBPreviewController.m
+++ b/macosx/HBPreviewController.m
@@ -283,6 +283,7 @@ typedef enum ViewMode : NSUInteger {
[self stopMovieTimer];
}
+ [self.generator purgeImageCache];
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"PreviewWindowIsOpen"];
}
@@ -634,7 +635,7 @@ typedef enum ViewMode : NSUInteger {
{
hb_title_t *title = self.title;
- NSImage *fPreviewImage = [self.generator imageAtIndex:self.pictureIndex];
+ NSImage *fPreviewImage = [self.generator imageAtIndex:self.pictureIndex shouldCache:YES];
NSSize imageScaledSize = [fPreviewImage size];
[self.pictureLayer setContents:fPreviewImage];
diff --git a/macosx/HBPreviewGenerator.h b/macosx/HBPreviewGenerator.h
index e17114c45..438d078aa 100644
--- a/macosx/HBPreviewGenerator.h
+++ b/macosx/HBPreviewGenerator.h
@@ -22,7 +22,7 @@
- (id) initWithHandle: (hb_handle_t *) handle andTitle: (hb_title_t *) title;
/* Still image generator */
-- (NSImage *) imageAtIndex: (NSUInteger) index;
+- (NSImage *) imageAtIndex: (NSUInteger) index shouldCache: (BOOL) cache;
- (NSUInteger) imagesCount;
- (void) purgeImageCache;
diff --git a/macosx/HBPreviewGenerator.m b/macosx/HBPreviewGenerator.m
index 99ca20f86..25a7ec344 100644
--- a/macosx/HBPreviewGenerator.m
+++ b/macosx/HBPreviewGenerator.m
@@ -52,7 +52,7 @@ typedef enum EncodeState : NSUInteger {
*
* @param index picture index in title.
*/
-- (NSImage *) imageAtIndex: (NSUInteger) index
+- (NSImage *) imageAtIndex: (NSUInteger) index shouldCache: (BOOL) cache
{
if (index >= self.imagesCount)
return nil;
@@ -67,7 +67,8 @@ typedef enum EncodeState : NSUInteger {
libhb:self.handle
title:self.title
deinterlace:self.deinterlace];
- [self.picturePreviews setObject:theImage forKey:@(index)];
+ if (cache)
+ [self.picturePreviews setObject:theImage forKey:@(index)];
}
return theImage;