Commit 3fbb103a authored by David Fuhrmann's avatar David Fuhrmann

coregraphicslayer: fix memleak and avoid unnecessary image copy

parent 607c5b7a
...@@ -255,6 +255,7 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic ...@@ -255,6 +255,7 @@ static void Display(vout_display_t *vd, picture_t *picture, subpicture_t *subpic
kCGRenderingIntentPerceptual); kCGRenderingIntentPerceptual);
CGDataProviderRelease(dataProvider); CGDataProviderRelease(dataProvider);
CFRelease(dataRef);
if (!newFrame) if (!newFrame)
goto end; goto end;
...@@ -289,6 +290,14 @@ static int Control(vout_display_t *vd, int query, va_list args) ...@@ -289,6 +290,14 @@ static int Control(vout_display_t *vd, int query, va_list args)
return self; return self;
} }
- (void) dealloc
{
if (_lastFrame)
CGImageRelease(_lastFrame);
[super dealloc];
}
- (bool)locked - (bool)locked
{ {
return lock; return lock;
...@@ -302,8 +311,10 @@ static int Control(vout_display_t *vd, int query, va_list args) ...@@ -302,8 +311,10 @@ static int Control(vout_display_t *vd, int query, va_list args)
return; return;
} }
_lastFrame = CGImageCreateCopy(lastFrame); if (_lastFrame)
CGImageRelease(lastFrame); CGImageRelease(_lastFrame);
_lastFrame = lastFrame;
CGRect invalidRect = CGRectMake(0, 0, CGImageGetWidth(_lastFrame), CGImageGetHeight(_lastFrame)); CGRect invalidRect = CGRectMake(0, 0, CGImageGetWidth(_lastFrame), CGImageGetHeight(_lastFrame));
[CATransaction begin]; [CATransaction begin];
[self setNeedsDisplayInRect:invalidRect]; [self setNeedsDisplayInRect:invalidRect];
......
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