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 |