npapi-vlc | branch: master | Felix Paul Kühne <[email protected]> | Sat May 18 09:15:21 2013 +0200| [33d6acef978e252f170f1c691532db3a05d7a546] | committer: Felix Paul Kühne
windowless-mac: really draw a transparent background below the video instead of something black > http://git.videolan.org/gitweb.cgi/npapi-vlc.git/?a=commit;h=33d6acef978e252f170f1c691532db3a05d7a546 --- npapi/vlcwindowless_mac.cpp | 32 ++++---------------------------- npapi/vlcwindowless_mac.h | 1 - 2 files changed, 4 insertions(+), 29 deletions(-) diff --git a/npapi/vlcwindowless_mac.cpp b/npapi/vlcwindowless_mac.cpp index a578948..2c555fb 100644 --- a/npapi/vlcwindowless_mac.cpp +++ b/npapi/vlcwindowless_mac.cpp @@ -35,29 +35,6 @@ VlcWindowlessMac::~VlcWindowlessMac() CGColorSpaceRelease(colorspace); } -void VlcWindowlessMac::drawBackground(CGContextRef cgContext) -{ - float windowWidth = npwindow.width; - float windowHeight = npwindow.height; - - CGContextSaveGState(cgContext); - - // this context is flipped.. - CGContextTranslateCTM(cgContext, 0.0, windowHeight); - CGContextScaleCTM(cgContext, 1., -1.); - - // fetch background color - unsigned r = 0, g = 0, b = 0; - HTMLColor2RGB(get_options().get_bg_color().c_str(), &r, &g, &b); - - // draw background - CGContextAddRect(cgContext, CGRectMake(0, 0, windowWidth, windowHeight)); - CGContextSetRGBFillColor(cgContext,r/255.,g/255.,b/255.,1.); - CGContextDrawPath(cgContext, kCGPathFill); - - CGContextRestoreGState(cgContext); -} - void VlcWindowlessMac::drawNoPlayback(CGContextRef cgContext) { float windowWidth = npwindow.width; @@ -171,7 +148,7 @@ bool VlcWindowlessMac::handle_event(void *event) return true; } - drawBackground(cgContext); + CGContextClearRect(cgContext, CGRectMake(0, 0, npwindow.width, npwindow.height) ); if(!VlcPluginBase::player_has_vout()) return true; @@ -191,12 +168,11 @@ bool VlcWindowlessMac::handle_event(void *event) static const size_t kComponentsPerPixel = 4; static const size_t kBitsPerComponent = sizeof(unsigned char) * 8; - /* render frame */ CFDataRef dataRef = CFDataCreateWithBytesNoCopy(kCFAllocatorDefault, - (const uint8_t *)&m_frame_buf[0], - sizeof(m_frame_buf[0]), - kCFAllocatorNull); + (const uint8_t *)&m_frame_buf[0], + sizeof(m_frame_buf[0]), + kCFAllocatorNull); CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData(dataRef); CGImageRef image = CGImageCreate(m_media_width, m_media_height, diff --git a/npapi/vlcwindowless_mac.h b/npapi/vlcwindowless_mac.h index 8288e34..bd5202c 100644 --- a/npapi/vlcwindowless_mac.h +++ b/npapi/vlcwindowless_mac.h @@ -36,7 +36,6 @@ public: NPError get_root_layer(void *value); protected: - void drawBackground(CGContextRef cgContext); void drawNoPlayback(CGContextRef cgContext); private: _______________________________________________ vlc-commits mailing list [email protected] http://mailman.videolan.org/listinfo/vlc-commits
