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 @@
...
@@ -39,6 +39,7 @@
@end
@end
@interface
VLCPlaybackLayer
:
CALayer
{
@interface
VLCPlaybackLayer
:
CALayer
{
CGColorSpaceRef
_colorspace
;
VlcPluginMac
*
_cppPlugin
;
VlcPluginMac
*
_cppPlugin
;
}
}
@property
(
readwrite
)
VlcPluginMac
*
cppPlugin
;
@property
(
readwrite
)
VlcPluginMac
*
cppPlugin
;
...
@@ -440,11 +441,19 @@ bool VlcPluginMac::handle_event(void *event)
...
@@ -440,11 +441,19 @@ bool VlcPluginMac::handle_event(void *event)
if
(
self
=
[
super
init
])
{
if
(
self
=
[
super
init
])
{
self
.
needsDisplayOnBoundsChange
=
YES
;
self
.
needsDisplayOnBoundsChange
=
YES
;
self
.
autoresizingMask
=
kCALayerWidthSizable
|
kCALayerHeightSizable
;
self
.
autoresizingMask
=
kCALayerWidthSizable
|
kCALayerHeightSizable
;
_colorspace
=
CGColorSpaceCreateDeviceRGB
();
}
}
return
self
;
return
self
;
}
}
-
(
void
)
dealloc
{
CGColorSpaceRelease
(
_colorspace
);
[
super
dealloc
];
}
-
(
void
)
drawInContext
:(
CGContextRef
)
cgContext
-
(
void
)
drawInContext
:(
CGContextRef
)
cgContext
{
{
if
(
!
cgContext
)
if
(
!
cgContext
)
...
@@ -498,20 +507,19 @@ bool VlcPluginMac::handle_event(void *event)
...
@@ -498,20 +507,19 @@ bool VlcPluginMac::handle_event(void *event)
sizeof
([
self
cppPlugin
]
->
m_frame_buf
[
0
]),
sizeof
([
self
cppPlugin
]
->
m_frame_buf
[
0
]),
kCFAllocatorNull
);
kCFAllocatorNull
);
CGDataProviderRef
dataProvider
=
CGDataProviderCreateWithCFData
(
dataRef
);
CGDataProviderRef
dataProvider
=
CGDataProviderCreateWithCFData
(
dataRef
);
CGColorSpaceRef
colorspace
=
CGColorSpaceCreateDeviceRGB
();
CGImageRef
image
=
CGImageCreate
(
media_width
,
CGImageRef
image
=
CGImageCreate
(
media_width
,
media_height
,
media_height
,
kBitsPerComponent
,
kBitsPerComponent
,
kBitsPerComponent
*
kComponentsPerPixel
,
kBitsPerComponent
*
kComponentsPerPixel
,
kComponentsPerPixel
*
media_width
,
kComponentsPerPixel
*
media_width
,
colorspace
,
_
colorspace
,
kCGBitmapByteOrder16Big
,
kCGBitmapByteOrder16Big
,
dataProvider
,
dataProvider
,
NULL
,
NULL
,
true
,
true
,
kCGRenderingIntentPerceptual
);
kCGRenderingIntentPerceptual
);
if
(
!
image
)
{
if
(
!
image
)
{
CGColorSpaceRelease
(
colorspace
);
CGImageRelease
(
image
);
CGImageRelease
(
image
);
CGDataProviderRelease
(
dataProvider
);
CGDataProviderRelease
(
dataProvider
);
CGContextRestoreGState
(
cgContext
);
CGContextRestoreGState
(
cgContext
);
...
@@ -520,7 +528,6 @@ bool VlcPluginMac::handle_event(void *event)
...
@@ -520,7 +528,6 @@ bool VlcPluginMac::handle_event(void *event)
CGRect
rect
=
CGRectMake
(
left
,
top
,
display_width
,
display_height
);
CGRect
rect
=
CGRectMake
(
left
,
top
,
display_width
,
display_height
);
CGContextDrawImage
(
cgContext
,
rect
,
image
);
CGContextDrawImage
(
cgContext
,
rect
,
image
);
CGColorSpaceRelease
(
colorspace
);
CGImageRelease
(
image
);
CGImageRelease
(
image
);
CGDataProviderRelease
(
dataProvider
);
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