Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
VLC Browser Plugins
Commits
9390b416
Commit
9390b416
authored
Jan 16, 2013
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windowed mac plugin: cache CGColorSpace
parent
da726fb5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
npapi/vlcplugin_mac.mm
npapi/vlcplugin_mac.mm
+11
-4
No files found.
npapi/vlcplugin_mac.mm
View file @
9390b416
...
...
@@ -39,6 +39,7 @@
@end
@interface
VLCPlaybackLayer
:
CALayer
{
CGColorSpaceRef
_colorspace
;
VlcPluginMac
*
_cppPlugin
;
}
@property
(
readwrite
)
VlcPluginMac
*
cppPlugin
;
...
...
@@ -440,11 +441,19 @@ bool VlcPluginMac::handle_event(void *event)
if
(
self
=
[
super
init
])
{
self
.
needsDisplayOnBoundsChange
=
YES
;
self
.
autoresizingMask
=
kCALayerWidthSizable
|
kCALayerHeightSizable
;
_colorspace
=
CGColorSpaceCreateDeviceRGB
();
}
return
self
;
}
-
(
void
)
dealloc
{
CGColorSpaceRelease
(
_colorspace
);
[
super
dealloc
];
}
-
(
void
)
drawInContext
:(
CGContextRef
)
cgContext
{
if
(
!
cgContext
)
...
...
@@ -498,20 +507,19 @@ bool VlcPluginMac::handle_event(void *event)
sizeof
([
self
cppPlugin
]
->
m_frame_buf
[
0
]),
kCFAllocatorNull
);
CGDataProviderRef
dataProvider
=
CGDataProviderCreateWithCFData
(
dataRef
);
CGColorSpaceRef
colorspace
=
CGColorSpaceCreateDeviceRGB
();
CGImageRef
image
=
CGImageCreate
(
media_width
,
media_height
,
kBitsPerComponent
,
kBitsPerComponent
*
kComponentsPerPixel
,
kComponentsPerPixel
*
media_width
,
colorspace
,
_
colorspace
,
kCGBitmapByteOrder16Big
,
dataProvider
,
NULL
,
true
,
kCGRenderingIntentPerceptual
);
if
(
!
image
)
{
CGColorSpaceRelease
(
colorspace
);
CGImageRelease
(
image
);
CGDataProviderRelease
(
dataProvider
);
CGContextRestoreGState
(
cgContext
);
...
...
@@ -520,7 +528,6 @@ bool VlcPluginMac::handle_event(void *event)
CGRect
rect
=
CGRectMake
(
left
,
top
,
display_width
,
display_height
);
CGContextDrawImage
(
cgContext
,
rect
,
image
);
CGColorSpaceRelease
(
colorspace
);
CGImageRelease
(
image
);
CGDataProviderRelease
(
dataProvider
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment