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

Unified Diff: ppapi/cpp/graphics_2d.cc

Issue 12989006: Move HiDPI-related Pepper interfaces to stable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Win build, add test Created 7 years, 9 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
Index: ppapi/cpp/graphics_2d.cc
diff --git a/ppapi/cpp/graphics_2d.cc b/ppapi/cpp/graphics_2d.cc
index f4cd6451babf5c73c4a271f09fd9edbc021eba94..0cb4ef6b284c9a178a3ea08446d2a44b73bd203e 100644
--- a/ppapi/cpp/graphics_2d.cc
+++ b/ppapi/cpp/graphics_2d.cc
@@ -22,6 +22,10 @@ template <> const char* interface_name<PPB_Graphics2D_1_0>() {
return PPB_GRAPHICS_2D_INTERFACE_1_0;
}
+template <> const char* interface_name<PPB_Graphics2D_1_1>() {
+ return PPB_GRAPHICS_2D_INTERFACE_1_1;
+}
+
} // namespace
Graphics2D::Graphics2D() : Resource() {
@@ -104,4 +108,22 @@ int32_t Graphics2D::Flush(const CompletionCallback& cc) {
pp_resource(), cc.pp_completion_callback());
}
+// static
+bool Graphics2D::SupportsScale() {
+ return has_interface<PPB_Graphics2D_1_1>();
+}
+
+bool Graphics2D::SetScale(float scale) {
+ if (!has_interface<PPB_Graphics2D_1_1>())
+ return false;
+ return PP_ToBool(get_interface<PPB_Graphics2D_1_1>()->SetScale(pp_resource(),
+ scale));
+}
+
+float Graphics2D::GetScale() {
+ if (!has_interface<PPB_Graphics2D_1_1>())
+ return 1.0f;
+ return get_interface<PPB_Graphics2D_1_1>()->GetScale(pp_resource());
+}
+
} // namespace pp

Powered by Google App Engine
This is Rietveld 408576698