1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "cc/contents_scaling_layer.h"
6 #include "ui/gfx/size_conversions.h"
10 gfx::Size
ContentsScalingLayer::computeContentBoundsForScale(float scaleX
, float scaleY
) const {
11 return gfx::ToCeiledSize(gfx::ScaleSize(bounds(), scaleX
, scaleY
));
14 ContentsScalingLayer::ContentsScalingLayer()
15 : m_contentsScale(1.0) {
18 ContentsScalingLayer::~ContentsScalingLayer() {
21 gfx::Size
ContentsScalingLayer::contentBounds() const {
22 return computeContentBoundsForScale(contentsScaleX(), contentsScaleY());
25 float ContentsScalingLayer::contentsScaleX() const {
26 return m_contentsScale
;
29 float ContentsScalingLayer::contentsScaleY() const {
30 return m_contentsScale
;
33 void ContentsScalingLayer::setContentsScale(float contentsScale
) {
34 if (m_contentsScale
== contentsScale
)
36 m_contentsScale
= contentsScale
;