Make |track_| in MediaStreamTrack const. and a couple of other cosmetic changes.
[chromium-blink-merge.git] / ppapi / thunk / ppb_compositor_layer_thunk.cc
blobf0a98df596895be699dbb7d1534e23777e12522b
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"
15 namespace ppapi {
16 namespace thunk {
18 namespace {
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,
27 float red,
28 float green,
29 float blue,
30 float alpha,
31 const struct PP_Size* size) {
32 VLOG(4) << "PPB_CompositorLayer::SetColor()";
33 EnterResource<PPB_CompositorLayer_API> enter(layer, true);
34 if (enter.failed())
35 return enter.retval();
36 return enter.object()->SetColor(red, green, blue, alpha, size);
39 int32_t SetTexture_0_1(PP_Resource layer,
40 PP_Resource context,
41 uint32_t texture,
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);
46 if (enter.failed())
47 return enter.retval();
48 return enter.SetResult(enter.object()->SetTexture0_1(context,
49 texture,
50 size,
51 enter.callback()));
54 int32_t SetTexture(PP_Resource layer,
55 PP_Resource context,
56 uint32_t target,
57 uint32_t texture,
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);
62 if (enter.failed())
63 return enter.retval();
64 return enter.SetResult(enter.object()->SetTexture(context,
65 target,
66 texture,
67 size,
68 enter.callback()));
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);
77 if (enter.failed())
78 return enter.retval();
79 return enter.SetResult(enter.object()->SetImage(image_data,
80 size,
81 enter.callback()));
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);
87 if (enter.failed())
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);
95 if (enter.failed())
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);
103 if (enter.failed())
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);
111 if (enter.failed())
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);
119 if (enter.failed())
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);
127 if (enter.failed())
128 return enter.retval();
129 return enter.object()->SetPremultipliedAlpha(premult);
132 const PPB_CompositorLayer_0_1 g_ppb_compositorlayer_thunk_0_1 = {
133 &IsCompositorLayer,
134 &SetColor,
135 &SetTexture_0_1,
136 &SetImage,
137 &SetClipRect,
138 &SetTransform,
139 &SetOpacity,
140 &SetBlendMode,
141 &SetSourceRect,
142 &SetPremultipliedAlpha
145 const PPB_CompositorLayer_0_2 g_ppb_compositorlayer_thunk_0_2 = {
146 &IsCompositorLayer,
147 &SetColor,
148 &SetTexture,
149 &SetImage,
150 &SetClipRect,
151 &SetTransform,
152 &SetOpacity,
153 &SetBlendMode,
154 &SetSourceRect,
155 &SetPremultipliedAlpha
158 } // namespace
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;
170 } // namespace thunk
171 } // namespace ppapi