Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: ppapi/thunk/ppb_view_thunk.cc

Issue 10544168: Implement HiDPI support in Pepper dev interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comments to Graphics2DDev C++ header Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/c/dev/ppb_view_dev.h"
5 #include "ppapi/c/ppb_view.h" 6 #include "ppapi/c/ppb_view.h"
6 #include "ppapi/shared_impl/ppb_view_shared.h" 7 #include "ppapi/shared_impl/ppb_view_shared.h"
7 #include "ppapi/thunk/enter.h" 8 #include "ppapi/thunk/enter.h"
8 #include "ppapi/thunk/ppb_view_api.h" 9 #include "ppapi/thunk/ppb_view_api.h"
9 #include "ppapi/thunk/thunk.h" 10 #include "ppapi/thunk/thunk.h"
10 11
11 namespace ppapi { 12 namespace ppapi {
12 namespace thunk { 13 namespace thunk {
13 14
14 namespace { 15 namespace {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 71 }
71 72
72 PP_Bool GetClipRect(PP_Resource resource, PP_Rect* clip) { 73 PP_Bool GetClipRect(PP_Resource resource, PP_Rect* clip) {
73 EnterView enter(resource, true); 74 EnterView enter(resource, true);
74 if (enter.failed() || !clip) 75 if (enter.failed() || !clip)
75 return PP_FALSE; 76 return PP_FALSE;
76 *clip = enter.object()->GetData().clip_rect; 77 *clip = enter.object()->GetData().clip_rect;
77 return PP_TRUE; 78 return PP_TRUE;
78 } 79 }
79 80
81 float GetDeviceScale(PP_Resource resource) {
82 EnterView enter(resource, true);
83 if (enter.failed())
84 return 0.0f;
85 return enter.object()->GetData().device_scale;
86 }
87
88 float GetCSSScale(PP_Resource resource) {
89 EnterView enter(resource, true);
90 if (enter.failed())
91 return 0.0f;
92 return enter.object()->GetData().css_scale;
93 }
94
80 const PPB_View g_ppb_view_thunk = { 95 const PPB_View g_ppb_view_thunk = {
81 &IsView, 96 &IsView,
82 &GetRect, 97 &GetRect,
83 &IsFullscreen, 98 &IsFullscreen,
84 &IsUserVisible, 99 &IsUserVisible,
85 &IsPageVisible, 100 &IsPageVisible,
86 &GetClipRect 101 &GetClipRect
87 }; 102 };
88 103
104 const PPB_View_Dev g_ppb_view_dev_thunk = {
105 &GetDeviceScale,
106 &GetCSSScale
107 };
108
89 } // namespace 109 } // namespace
90 110
91 const PPB_View* GetPPB_View_1_0_Thunk() { 111 const PPB_View* GetPPB_View_1_0_Thunk() {
92 return &g_ppb_view_thunk; 112 return &g_ppb_view_thunk;
93 } 113 }
94 114
115 const PPB_View_Dev* GetPPB_View_Dev_0_1_Thunk() {
116 return &g_ppb_view_dev_thunk;
117 }
118
95 } // namespace thunk 119 } // namespace thunk
96 } // namespace ppapi 120 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698