Pepper_47_C_interfaces
|
#include <ppb_compositor.h>
Public Attributes | |
PP_Bool(* | IsCompositor )(PP_Resource resource) |
PP_Resource(* | Create )(PP_Instance instance) |
PP_Resource(* | AddLayer )(PP_Resource compositor) |
int32_t(* | CommitLayers )(PP_Resource compositor, struct PP_CompletionCallback cc) |
int32_t(* | ResetLayers )(PP_Resource compositor) |
Defines the PPB_Compositor
interface. Used for setting PPB_CompositorLayer
layers to the Chromium compositor for compositing. This allows a plugin to combine different sources of visual data efficiently, such as PPB_ImageData
images and OpenGL textures. See also PPB_CompositorLayer
for more information. This interface is still in development (Dev API status) and may change, so is only supported on Dev channel and Canary currently.
Example usage from plugin code:
Setup:
Setup layer stack:
Present one frame: layer_if->SetColor(color_layer, 255, 255, 0, 255, PP_MakeSize(400, 400)); PP_CompletionCallback release_callback = { TextureReleasedCallback, 0, PP_COMPLETIONCALLBACK_FLAG_NONE, }; layer_if->SetTexture(texture_layer, graphics3d, texture_id, PP_MakeSize(300, 300), release_callback);
PP_CompletionCallback callback = { DidFinishCommitLayersCallback, (void*) texture_id, PP_COMPLETIONCALLBACK_FLAG_NONE, }; compositor_if->CommitLayers(compositor, callback);
release callback void ReleaseCallback(int32_t result, void* user_data) { if (result == PP_OK) { uint32_t texture_id = (uint32_t) user_data; // reuse the texture or delete it. } }
Shutdown:
Definition at line 84 of file ppb_compositor.h.
PP_Resource(* PPB_Compositor_0_1::AddLayer)(PP_Resource compositor) |
Creates a new PPB_CompositorLayer
and adds it to the end of the layer stack. A PP_Resource
containing the layer is returned. It is uninitialized, SetColor()
, SetTexture
or SetImage
should be used to initialize it. The layer will appear above other pre-existing layers. If ResetLayers
is called or the PPB_Compositor
is released, the returned layer will be invalidated, and any further calls on the layer will return PP_ERROR_BADRESOURCE
.
param[in] compositor A PP_Resource
corresponding to a compositor layer resource.
PP_Resource
containing the compositor layer resource if sucessful or 0 otherwise. Definition at line 120 of file ppb_compositor.h.
int32_t(* PPB_Compositor_0_1::CommitLayers)(PP_Resource compositor, struct PP_CompletionCallback cc) |
Commits layers added by AddLayer()
to the chromium compositor.
param[in] compositor A PP_Resource
corresponding to a compositor layer resource.
[in] | cc | A PP_CompletionCallback to be called when layers have been represented on screen. |
pp_errors.h
. Definition at line 131 of file ppb_compositor.h.
PP_Resource(* PPB_Compositor_0_1::Create)(PP_Instance instance) |
Creates a Compositor resource.
[in] | instance | A PP_Instance identifying one instance of a module. |
PP_Resource
containing the compositor resource if sucessful or 0 otherwise. Definition at line 103 of file ppb_compositor.h.
PP_Bool(* PPB_Compositor_0_1::IsCompositor)(PP_Resource resource) |
Determines if a resource is a compositor resource.
[in] | resource | The PP_Resource to test. |
PP_Bool
with PP_TRUE
if the given resource is a compositor resource or PP_FALSE
otherwise. Definition at line 93 of file ppb_compositor.h.
int32_t(* PPB_Compositor_0_1::ResetLayers)(PP_Resource compositor) |
Resets layers added by AddLayer()
.
param[in] compositor A PP_Resource
corresponding to a compositor layer resource.
pp_errors.h
. Definition at line 141 of file ppb_compositor.h.