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 Sep 18 11:36:39 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(
49 enter
.object()->SetTexture0_1(context
, texture
, size
, enter
.callback()));
52 int32_t SetTexture(PP_Resource layer
,
56 const struct PP_Size
* size
,
57 struct PP_CompletionCallback cc
) {
58 VLOG(4) << "PPB_CompositorLayer::SetTexture()";
59 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, cc
, true);
61 return enter
.retval();
62 return enter
.SetResult(enter
.object()->SetTexture(context
, target
, texture
,
63 size
, enter
.callback()));
66 int32_t SetImage(PP_Resource layer
,
67 PP_Resource image_data
,
68 const struct PP_Size
* size
,
69 struct PP_CompletionCallback cc
) {
70 VLOG(4) << "PPB_CompositorLayer::SetImage()";
71 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, cc
, true);
73 return enter
.retval();
74 return enter
.SetResult(
75 enter
.object()->SetImage(image_data
, size
, enter
.callback()));
78 int32_t SetClipRect(PP_Resource layer
, const struct PP_Rect
* rect
) {
79 VLOG(4) << "PPB_CompositorLayer::SetClipRect()";
80 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, true);
82 return enter
.retval();
83 return enter
.object()->SetClipRect(rect
);
86 int32_t SetTransform(PP_Resource layer
, const float matrix
[16]) {
87 VLOG(4) << "PPB_CompositorLayer::SetTransform()";
88 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, true);
90 return enter
.retval();
91 return enter
.object()->SetTransform(matrix
);
94 int32_t SetOpacity(PP_Resource layer
, float opacity
) {
95 VLOG(4) << "PPB_CompositorLayer::SetOpacity()";
96 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, true);
98 return enter
.retval();
99 return enter
.object()->SetOpacity(opacity
);
102 int32_t SetBlendMode(PP_Resource layer
, PP_BlendMode mode
) {
103 VLOG(4) << "PPB_CompositorLayer::SetBlendMode()";
104 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, true);
106 return enter
.retval();
107 return enter
.object()->SetBlendMode(mode
);
110 int32_t SetSourceRect(PP_Resource layer
, const struct PP_FloatRect
* rect
) {
111 VLOG(4) << "PPB_CompositorLayer::SetSourceRect()";
112 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, true);
114 return enter
.retval();
115 return enter
.object()->SetSourceRect(rect
);
118 int32_t SetPremultipliedAlpha(PP_Resource layer
, PP_Bool premult
) {
119 VLOG(4) << "PPB_CompositorLayer::SetPremultipliedAlpha()";
120 EnterResource
<PPB_CompositorLayer_API
> enter(layer
, true);
122 return enter
.retval();
123 return enter
.object()->SetPremultipliedAlpha(premult
);
126 const PPB_CompositorLayer_0_1 g_ppb_compositorlayer_thunk_0_1
= {
136 &SetPremultipliedAlpha
};
138 const PPB_CompositorLayer_0_2 g_ppb_compositorlayer_thunk_0_2
= {
148 &SetPremultipliedAlpha
};
152 PPAPI_THUNK_EXPORT
const PPB_CompositorLayer_0_1
*
153 GetPPB_CompositorLayer_0_1_Thunk() {
154 return &g_ppb_compositorlayer_thunk_0_1
;
157 PPAPI_THUNK_EXPORT
const PPB_CompositorLayer_0_2
*
158 GetPPB_CompositorLayer_0_2_Thunk() {
159 return &g_ppb_compositorlayer_thunk_0_2
;