1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // From ppb_compositor_layer.idl modified Thu Aug 14 18:06:33 2014.
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/ppb_compositor_layer.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppapi_thunk_export.h"
13 #include "ppapi/thunk/ppb_compositor_layer_api.h"
20 PP_Bool
IsCompositorLayer(PP_Resource resource
) {
21 VLOG(4) << "PPB_CompositorLayer::IsCompositorLayer()";
22 EnterResource
<PPB_CompositorLayer_API
> enter(resource
, false);
23 return PP_FromBool(enter
.succeeded());
26 int32_t SetColor(PP_Resource layer
,
31 const struct PP_Size
* size
) {
32 VLOG(4) << "PPB_CompositorLayer::SetColor()";
33 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, true);
35 return enter
.retval();
36 return enter
.object()->SetColor(red
, green
, blue
, alpha
, size
);
39 int32_t SetTexture_0_1(PP_Resource layer
,
42 const struct PP_Size
* size
,
43 struct PP_CompletionCallback cc
) {
44 VLOG(4) << "PPB_CompositorLayer::SetTexture()";
45 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, cc
, true);
47 return enter
.retval();
48 return enter
.SetResult(enter
.object()->SetTexture0_1(context
,
54 int32_t SetTexture(PP_Resource layer
,
58 const struct PP_Size
* size
,
59 struct PP_CompletionCallback cc
) {
60 VLOG(4) << "PPB_CompositorLayer::SetTexture()";
61 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, cc
, true);
63 return enter
.retval();
64 return enter
.SetResult(enter
.object()->SetTexture(context
,
71 int32_t SetImage(PP_Resource layer
,
72 PP_Resource image_data
,
73 const struct PP_Size
* size
,
74 struct PP_CompletionCallback cc
) {
75 VLOG(4) << "PPB_CompositorLayer::SetImage()";
76 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, cc
, true);
78 return enter
.retval();
79 return enter
.SetResult(enter
.object()->SetImage(image_data
,
84 int32_t SetClipRect(PP_Resource layer
, const struct PP_Rect
* rect
) {
85 VLOG(4) << "PPB_CompositorLayer::SetClipRect()";
86 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, true);
88 return enter
.retval();
89 return enter
.object()->SetClipRect(rect
);
92 int32_t SetTransform(PP_Resource layer
, const float matrix
[16]) {
93 VLOG(4) << "PPB_CompositorLayer::SetTransform()";
94 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, true);
96 return enter
.retval();
97 return enter
.object()->SetTransform(matrix
);
100 int32_t SetOpacity(PP_Resource layer
, float opacity
) {
101 VLOG(4) << "PPB_CompositorLayer::SetOpacity()";
102 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, true);
104 return enter
.retval();
105 return enter
.object()->SetOpacity(opacity
);
108 int32_t SetBlendMode(PP_Resource layer
, PP_BlendMode mode
) {
109 VLOG(4) << "PPB_CompositorLayer::SetBlendMode()";
110 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, true);
112 return enter
.retval();
113 return enter
.object()->SetBlendMode(mode
);
116 int32_t SetSourceRect(PP_Resource layer
, const struct PP_FloatRect
* rect
) {
117 VLOG(4) << "PPB_CompositorLayer::SetSourceRect()";
118 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, true);
120 return enter
.retval();
121 return enter
.object()->SetSourceRect(rect
);
124 int32_t SetPremultipliedAlpha(PP_Resource layer
, PP_Bool premult
) {
125 VLOG(4) << "PPB_CompositorLayer::SetPremultipliedAlpha()";
126 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, true);
128 return enter
.retval();
129 return enter
.object()->SetPremultipliedAlpha(premult
);
132 const PPB_CompositorLayer_0_1 g_ppb_compositorlayer_thunk_0_1
= {
142 &SetPremultipliedAlpha
145 const PPB_CompositorLayer_0_2 g_ppb_compositorlayer_thunk_0_2
= {
155 &SetPremultipliedAlpha
160 PPAPI_THUNK_EXPORT
const PPB_CompositorLayer_0_1
*
161 GetPPB_CompositorLayer_0_1_Thunk() {
162 return &g_ppb_compositorlayer_thunk_0_1
;
165 PPAPI_THUNK_EXPORT
const PPB_CompositorLayer_0_2
*
166 GetPPB_CompositorLayer_0_2_Thunk() {
167 return &g_ppb_compositorlayer_thunk_0_2
;