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

Unified Diff: ppapi/cpp/private/graphics_2d_private.cc

Issue 10544168: Implement HiDPI support in Pepper dev interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/cpp/private/graphics_2d_private.cc
diff --git a/ppapi/cpp/private/graphics_2d_private.cc b/ppapi/cpp/private/graphics_2d_private.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4caa91fd4318d09eb7bfc692faf5fc44409db090
--- /dev/null
+++ b/ppapi/cpp/private/graphics_2d_private.cc
@@ -0,0 +1,67 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ppapi/cpp/private/graphics_2d_private.h"
+
+#include "ppapi/c/private/ppb_graphics_2d_private.h"
+#include "ppapi/cpp/module_impl.h"
+
+namespace pp {
+
+namespace {
+
+template <> const char* interface_name<PPB_Graphics2D_Private_0_1>() {
+ return PPB_GRAPHICS2D_PRIVATE_INTERFACE_0_1;
+}
+
+} // namespace
+
+Graphics2DPrivate::Graphics2DPrivate()
+ : Graphics2D(),
+ scale_(1.0f) {
+}
+
+Graphics2DPrivate::Graphics2DPrivate(const Graphics2DPrivate& other)
+ : Graphics2D(other),
+ scale_(other.scale_) {
+}
+
+Graphics2DPrivate::Graphics2DPrivate(const InstanceHandle& instance,
+ const Size& size,
+ bool is_always_opaque)
+ : Graphics2D(instance, size, is_always_opaque),
+ scale_(1.0f) {
+}
+
+Graphics2DPrivate::Graphics2DPrivate(const InstanceHandle& instance,
+ const Size& size,
+ bool is_always_opaque,
+ float scale)
+ : Graphics2D(),
+ scale_(1.0f) {
+ if (!has_interface<PPB_Graphics2D_Private_0_1>())
+ return;
+ PassRefFromConstructor(get_interface<PPB_Graphics2D_Private_0_1>()->Create(
+ instance.pp_instance(),
+ &size.pp_size(),
+ PP_FromBool(is_always_opaque),
+ scale));
+ if (!is_null()) {
+ // Only save size and scale if allocation succeeded
+ size_ = size;
+ scale_ = scale;
+ }
+}
+
+Graphics2DPrivate::~Graphics2DPrivate() {
+}
+
+Graphics2DPrivate& Graphics2DPrivate::operator=(const Graphics2DPrivate& other)
+{
+ Graphics2D::operator=(other);
+ scale_ = other.scale_;
+ return *this;
+}
+
+} // namespace pp

Powered by Google App Engine
This is Rietveld 408576698