summaryrefslogtreecommitdiffstats
path: root/cc/contents_scaling_layer.h
blob: 4f0fcdb9bcdcf852e1cc269ccceb12420ed0931c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// 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.

#ifndef CC_CONTENTS_SCALING_LAYER_H_
#define CC_CONTENTS_SCALING_LAYER_H_

#include "cc/cc_export.h"
#include "cc/layer.h"

namespace cc {

// Base class for layers that need contents scale.
// The content bounds are determined by bounds and scale of the contents.
class CC_EXPORT ContentsScalingLayer : public Layer {
 public:
  virtual gfx::Size contentBounds() const OVERRIDE;
  virtual float contentsScaleX() const OVERRIDE;
  virtual float contentsScaleY() const OVERRIDE;
  virtual void setContentsScale(float contentsScale) OVERRIDE;

 protected:
  ContentsScalingLayer();
  virtual ~ContentsScalingLayer();

  gfx::Size computeContentBoundsForScale(float scaleX, float scaleY) const;

 private:
  float m_contentsScale;
};

}  // namespace cc

#endif  // CC_CONTENTS_SCALING_LAYER_H__