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

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: 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
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..fcfaebd6960e00a07b5c2a4e3f121efcf6c26faf
--- /dev/null
+++ b/cc/contents_scaling_layer.cc
@@ -0,0 +1,30 @@
+// 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()));
+}
+
+void ContentsScalingLayer::setContentsScale(float contentsScale) {
+ if (m_contentsScale == contentsScale)
+ return;
+ m_contentsScale = contentsScale;
+ setNeedsDisplay();
+}
+
+} // namespace cc

Powered by Google App Engine
This is Rietveld 408576698