npapi-vlc | branch: master | Felix Paul Kühne <[email protected]> | Wed Jan 16 02:28:53 2013 +0100| [9b53551e152f824236947c5728b496c7e9735555] | committer: Felix Paul Kühne
Windowless Mac Plugin: cache CGColorSpace > http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=9b53551e152f824236947c5728b496c7e9735555 --- npapi/vlcwindowless_mac.cpp | 9 ++++++--- npapi/vlcwindowless_mac.h | 4 ++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/npapi/vlcwindowless_mac.cpp b/npapi/vlcwindowless_mac.cpp index 844ed76..a578948 100644 --- a/npapi/vlcwindowless_mac.cpp +++ b/npapi/vlcwindowless_mac.cpp @@ -27,6 +27,12 @@ VlcWindowlessMac::VlcWindowlessMac(NPP instance, NPuint16_t mode) : VlcWindowlessBase(instance, mode) { + colorspace = CGColorSpaceCreateDeviceRGB(); +} + +VlcWindowlessMac::~VlcWindowlessMac() +{ + CGColorSpaceRelease(colorspace); } void VlcWindowlessMac::drawBackground(CGContextRef cgContext) @@ -192,7 +198,6 @@ bool VlcWindowlessMac::handle_event(void *event) sizeof(m_frame_buf[0]), kCFAllocatorNull); CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData(dataRef); - CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB(); CGImageRef image = CGImageCreate(m_media_width, m_media_height, kBitsPerComponent, @@ -205,7 +210,6 @@ bool VlcWindowlessMac::handle_event(void *event) true, kCGRenderingIntentPerceptual); if (!image) { - CGColorSpaceRelease(colorspace); CGImageRelease(image); CGDataProviderRelease(dataProvider); CGContextRestoreGState(cgContext); @@ -214,7 +218,6 @@ bool VlcWindowlessMac::handle_event(void *event) CGRect rect = CGRectMake(left, top, m_media_width, m_media_height); CGContextDrawImage(cgContext, rect, image); - CGColorSpaceRelease(colorspace); CGImageRelease(image); CGDataProviderRelease(dataProvider); diff --git a/npapi/vlcwindowless_mac.h b/npapi/vlcwindowless_mac.h index 5fe6cb9..8288e34 100644 --- a/npapi/vlcwindowless_mac.h +++ b/npapi/vlcwindowless_mac.h @@ -30,6 +30,7 @@ class VlcWindowlessMac : public VlcWindowlessBase { public: VlcWindowlessMac(NPP instance, NPuint16_t mode); + virtual ~VlcWindowlessMac(); bool handle_event(void *event); NPError get_root_layer(void *value); @@ -37,6 +38,9 @@ public: protected: void drawBackground(CGContextRef cgContext); void drawNoPlayback(CGContextRef cgContext); + +private: + CGColorSpaceRef colorspace; }; #endif /* __VLCWINDOWLESS_MAC_H__ */ _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
