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

Side by Side Diff: ppapi/cpp/view.cc

Issue 12989006: Move HiDPI-related Pepper interfaces to stable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase after spelling-correction CL Created 7 years, 8 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/cpp/view.h" 5 #include "ppapi/cpp/view.h"
6 6
7 #include "ppapi/c/ppb_view.h" 7 #include "ppapi/c/ppb_view.h"
8 #include "ppapi/cpp/module_impl.h" 8 #include "ppapi/cpp/module_impl.h"
9 9
10 namespace pp { 10 namespace pp {
11 11
12 namespace { 12 namespace {
13 13
14 template <> const char* interface_name<PPB_View_1_0>() { 14 template <> const char* interface_name<PPB_View_1_0>() {
15 return PPB_VIEW_INTERFACE_1_0; 15 return PPB_VIEW_INTERFACE_1_0;
16 } 16 }
17 17
18 template <> const char* interface_name<PPB_View_1_1>() {
19 return PPB_VIEW_INTERFACE_1_1;
20 }
21
18 } // namespace 22 } // namespace
19 23
20 View::View() : Resource() { 24 View::View() : Resource() {
21 } 25 }
22 26
23 View::View(PP_Resource view_resource) : Resource(view_resource) { 27 View::View(PP_Resource view_resource) : Resource(view_resource) {
24 } 28 }
25 29
26 Rect View::GetRect() const { 30 Rect View::GetRect() const {
27 if (!has_interface<PPB_View_1_0>()) 31 if (!has_interface<PPB_View_1_0>())
(...skipping 25 matching lines...) Expand all
53 Rect View::GetClipRect() const { 57 Rect View::GetClipRect() const {
54 if (!has_interface<PPB_View_1_0>()) 58 if (!has_interface<PPB_View_1_0>())
55 return Rect(); 59 return Rect();
56 PP_Rect out; 60 PP_Rect out;
57 if (PP_ToBool(get_interface<PPB_View_1_0>()->GetClipRect(pp_resource(), 61 if (PP_ToBool(get_interface<PPB_View_1_0>()->GetClipRect(pp_resource(),
58 &out))) 62 &out)))
59 return Rect(out); 63 return Rect(out);
60 return Rect(); 64 return Rect();
61 } 65 }
62 66
67 float View::GetDeviceScale() const {
68 if (!has_interface<PPB_View_1_1>())
69 return 1.0f;
70 return get_interface<PPB_View_1_1>()->GetDeviceScale(pp_resource());
71 }
72
73 float View::GetCSSScale() const {
74 if (!has_interface<PPB_View_1_1>())
75 return 1.0f;
76 return get_interface<PPB_View_1_1>()->GetCSSScale(pp_resource());
77 }
78
63 } // namespace pp 79 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698