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

Unified 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 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/cpp/view.h ('k') | ppapi/examples/scaling/scaling.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/cpp/view.cc
diff --git a/ppapi/cpp/view.cc b/ppapi/cpp/view.cc
index 68c6e311f20d957b51460acff4dfab0efe677d51..ce347859d70f3cc33db4cb15af28fd6672f8488e 100644
--- a/ppapi/cpp/view.cc
+++ b/ppapi/cpp/view.cc
@@ -15,6 +15,10 @@ template <> const char* interface_name<PPB_View_1_0>() {
return PPB_VIEW_INTERFACE_1_0;
}
+template <> const char* interface_name<PPB_View_1_1>() {
+ return PPB_VIEW_INTERFACE_1_1;
+}
+
} // namespace
View::View() : Resource() {
@@ -24,40 +28,71 @@ View::View(PP_Resource view_resource) : Resource(view_resource) {
}
Rect View::GetRect() const {
- if (!has_interface<PPB_View_1_0>())
- return Rect();
PP_Rect out;
- if (PP_ToBool(get_interface<PPB_View_1_0>()->GetRect(pp_resource(), &out)))
- return Rect(out);
+ if (has_interface<PPB_View_1_1>()) {
+ if (PP_ToBool(get_interface<PPB_View_1_1>()->GetRect(pp_resource(), &out)))
+ return Rect(out);
+ } else if (has_interface<PPB_View_1_0>()) {
+ if (PP_ToBool(get_interface<PPB_View_1_0>()->GetRect(pp_resource(), &out)))
+ return Rect(out);
+ }
return Rect();
}
bool View::IsFullscreen() const {
- if (!has_interface<PPB_View_1_0>())
- return false;
- return PP_ToBool(get_interface<PPB_View_1_0>()->IsFullscreen(pp_resource()));
+ if (has_interface<PPB_View_1_1>()) {
+ return PP_ToBool(get_interface<PPB_View_1_1>()->IsFullscreen(
+ pp_resource()));
+ } else if (has_interface<PPB_View_1_0>()) {
+ return PP_ToBool(get_interface<PPB_View_1_0>()->IsFullscreen(
+ pp_resource()));
+ }
+ return false;
}
bool View::IsVisible() const {
- if (!has_interface<PPB_View_1_0>())
- return false;
- return PP_ToBool(get_interface<PPB_View_1_0>()->IsVisible(pp_resource()));
+ if (has_interface<PPB_View_1_1>())
+ return PP_ToBool(get_interface<PPB_View_1_1>()->IsVisible(pp_resource()));
+ else if (has_interface<PPB_View_1_0>())
+ return PP_ToBool(get_interface<PPB_View_1_0>()->IsVisible(pp_resource()));
+ return false;
}
bool View::IsPageVisible() const {
- if (!has_interface<PPB_View_1_0>())
- return true;
- return PP_ToBool(get_interface<PPB_View_1_0>()->IsPageVisible(pp_resource()));
+ if (has_interface<PPB_View_1_1>()) {
+ return PP_ToBool(get_interface<PPB_View_1_1>()->IsPageVisible(
+ pp_resource()));
+ } else if (has_interface<PPB_View_1_0>()) {
+ return PP_ToBool(get_interface<PPB_View_1_0>()->IsPageVisible(
+ pp_resource()));
+ }
+ return true;
}
Rect View::GetClipRect() const {
- if (!has_interface<PPB_View_1_0>())
- return Rect();
PP_Rect out;
- if (PP_ToBool(get_interface<PPB_View_1_0>()->GetClipRect(pp_resource(),
- &out)))
- return Rect(out);
+ if (has_interface<PPB_View_1_1>()) {
+ if (PP_ToBool(get_interface<PPB_View_1_1>()->GetClipRect(pp_resource(),
+ &out)))
+ return Rect(out);
+ } else if (has_interface<PPB_View_1_0>()) {
+ if (PP_ToBool(get_interface<PPB_View_1_0>()->GetClipRect(pp_resource(),
+ &out)))
+ return Rect(out);
+ }
return Rect();
}
+float View::GetDeviceScale() const {
+ if (has_interface<PPB_View_1_1>())
+ return get_interface<PPB_View_1_1>()->GetDeviceScale(pp_resource());
+ return 1.0f;
+}
+
+float View::GetCSSScale() const {
+ if (has_interface<PPB_View_1_1>())
+ return get_interface<PPB_View_1_1>()->GetCSSScale(pp_resource());
+ return 1.0f;
+}
+
} // namespace pp
« no previous file with comments | « ppapi/cpp/view.h ('k') | ppapi/examples/scaling/scaling.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698