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

Unified Diff: cc/contents_scaling_layer.cc

Issue 11276060: Pass accurate contentsScale to LayerImpl. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 2 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 | « cc/contents_scaling_layer.h ('k') | cc/contents_scaling_layer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/contents_scaling_layer.cc
diff --git a/cc/contents_scaling_layer.cc b/cc/contents_scaling_layer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2e041a1ee0b18c5e12ac8cec4b25134043e8969a
--- /dev/null
+++ b/cc/contents_scaling_layer.cc
@@ -0,0 +1,38 @@
+// Copyright 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 "config.h"
+
+#include "cc/contents_scaling_layer.h"
+
+namespace cc {
+
+ContentsScalingLayer::ContentsScalingLayer()
+ : m_contentsScale(1.0) {
+}
+
+ContentsScalingLayer::~ContentsScalingLayer() {
+}
+
+IntSize ContentsScalingLayer::contentBounds() const {
+ return IntSize(ceil(bounds().width() * contentsScaleX()),
+ ceil(bounds().height() * contentsScaleY()));
+}
+
+float ContentsScalingLayer::contentsScaleX() const {
+ return m_contentsScale;
+}
+
+float ContentsScalingLayer::contentsScaleY() const {
+ return m_contentsScale;
+}
+
+void ContentsScalingLayer::setContentsScale(float contentsScale) {
+ if (m_contentsScale == contentsScale)
+ return;
+ m_contentsScale = contentsScale;
+ setNeedsDisplay();
+}
+
+} // namespace cc
« no previous file with comments | « cc/contents_scaling_layer.h ('k') | cc/contents_scaling_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698