Revert of Update WV test license server config to use portable sdk server. (https...
[chromium-blink-merge.git] / ppapi / thunk / ppb_graphics_2d_dev_thunk.cc
blob8e9a07c58bb1ae6f3807355c4f28fd3a34384ef5
1 // Copyright (c) 2012 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 dev/ppb_graphics_2d_dev.idl modified Mon Nov 25 11:02:23 2013.
7 #include "ppapi/c/dev/ppb_graphics_2d_dev.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/shared_impl/tracked_callback.h"
10 #include "ppapi/thunk/enter.h"
11 #include "ppapi/thunk/ppapi_thunk_export.h"
12 #include "ppapi/thunk/ppb_graphics_2d_api.h"
14 namespace ppapi {
15 namespace thunk {
17 namespace {
19 PP_Bool SetScale(PP_Resource resource, float scale) {
20 VLOG(4) << "PPB_Graphics2D_Dev::SetScale()";
21 EnterResource<PPB_Graphics2D_API> enter(resource, true);
22 if (enter.failed())
23 return PP_FALSE;
24 return enter.object()->SetScale(scale);
27 float GetScale(PP_Resource resource) {
28 VLOG(4) << "PPB_Graphics2D_Dev::GetScale()";
29 EnterResource<PPB_Graphics2D_API> enter(resource, true);
30 if (enter.failed())
31 return 0.0f;
32 return enter.object()->GetScale();
35 void SetOffset(PP_Resource resource, const struct PP_Point* offset) {
36 VLOG(4) << "PPB_Graphics2D_Dev::SetOffset()";
37 EnterResource<PPB_Graphics2D_API> enter(resource, true);
38 if (enter.failed())
39 return;
40 enter.object()->SetOffset(offset);
43 void SetResizeMode(PP_Resource resource,
44 PP_Graphics2D_Dev_ResizeMode resize_mode) {
45 VLOG(4) << "PPB_Graphics2D_Dev::SetResizeMode()";
46 EnterResource<PPB_Graphics2D_API> enter(resource, true);
47 if (enter.failed())
48 return;
49 enter.object()->SetResizeMode(resize_mode);
52 const PPB_Graphics2D_Dev_0_1 g_ppb_graphics2d_dev_thunk_0_1 = {
53 &SetScale,
54 &GetScale,
55 &SetResizeMode
58 const PPB_Graphics2D_Dev_0_2 g_ppb_graphics2d_dev_thunk_0_2 = {
59 &SetScale,
60 &GetScale,
61 &SetOffset,
62 &SetResizeMode
65 } // namespace
67 PPAPI_THUNK_EXPORT const PPB_Graphics2D_Dev_0_1*
68 GetPPB_Graphics2D_Dev_0_1_Thunk() {
69 return &g_ppb_graphics2d_dev_thunk_0_1;
72 PPAPI_THUNK_EXPORT const PPB_Graphics2D_Dev_0_2*
73 GetPPB_Graphics2D_Dev_0_2_Thunk() {
74 return &g_ppb_graphics2d_dev_thunk_0_2;
77 } // namespace thunk
78 } // namespace ppapi