add SK_SUPPORT_LEGACY_HQ_SCALING to suppress changes to HQ scaling
[chromium-blink-merge.git] / ppapi / thunk / ppb_widget_dev_thunk.cc
blob4ea0d478c854dc72688a469c4cb79ca777cf2165
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_widget_dev.idl modified Mon May 6 10:11:29 2013.
7 #include "ppapi/c/dev/ppb_widget_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_widget_api.h"
14 namespace ppapi {
15 namespace thunk {
17 namespace {
19 PP_Bool IsWidget(PP_Resource resource) {
20 VLOG(4) << "PPB_Widget_Dev::IsWidget()";
21 EnterResource<PPB_Widget_API> enter(resource, false);
22 return PP_FromBool(enter.succeeded());
25 PP_Bool Paint(PP_Resource widget,
26 const struct PP_Rect* rect,
27 PP_Resource image) {
28 VLOG(4) << "PPB_Widget_Dev::Paint()";
29 EnterResource<PPB_Widget_API> enter(widget, false);
30 if (enter.failed())
31 return PP_FALSE;
32 return enter.object()->Paint(rect, image);
35 PP_Bool HandleEvent(PP_Resource widget, PP_Resource input_event) {
36 VLOG(4) << "PPB_Widget_Dev::HandleEvent()";
37 EnterResource<PPB_Widget_API> enter(widget, false);
38 if (enter.failed())
39 return PP_FALSE;
40 return enter.object()->HandleEvent(input_event);
43 PP_Bool GetLocation(PP_Resource widget, struct PP_Rect* location) {
44 VLOG(4) << "PPB_Widget_Dev::GetLocation()";
45 EnterResource<PPB_Widget_API> enter(widget, false);
46 if (enter.failed())
47 return PP_FALSE;
48 return enter.object()->GetLocation(location);
51 void SetLocation(PP_Resource widget, const struct PP_Rect* location) {
52 VLOG(4) << "PPB_Widget_Dev::SetLocation()";
53 EnterResource<PPB_Widget_API> enter(widget, false);
54 if (enter.failed())
55 return;
56 enter.object()->SetLocation(location);
59 void SetScale(PP_Resource widget, float scale) {
60 VLOG(4) << "PPB_Widget_Dev::SetScale()";
61 EnterResource<PPB_Widget_API> enter(widget, false);
62 if (enter.failed())
63 return;
64 enter.object()->SetScale(scale);
67 const PPB_Widget_Dev_0_3 g_ppb_widget_dev_thunk_0_3 = {&IsWidget,
68 &Paint,
69 &HandleEvent,
70 &GetLocation,
71 &SetLocation};
73 const PPB_Widget_Dev_0_4 g_ppb_widget_dev_thunk_0_4 =
74 {&IsWidget, &Paint, &HandleEvent, &GetLocation, &SetLocation, &SetScale};
76 } // namespace
78 PPAPI_THUNK_EXPORT const PPB_Widget_Dev_0_3* GetPPB_Widget_Dev_0_3_Thunk() {
79 return &g_ppb_widget_dev_thunk_0_3;
82 PPAPI_THUNK_EXPORT const PPB_Widget_Dev_0_4* GetPPB_Widget_Dev_0_4_Thunk() {
83 return &g_ppb_widget_dev_thunk_0_4;
86 } // namespace thunk
87 } // namespace ppapi