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 #ifndef CC_LAYERS_CONTENTS_SCALING_LAYER_H_
6 #define CC_LAYERS_CONTENTS_SCALING_LAYER_H_
8 #include "cc/base/cc_export.h"
9 #include "cc/layers/layer.h"
13 // Base class for layers that need contents scale.
14 // The content bounds are determined by bounds and scale of the contents.
15 class CC_EXPORT ContentsScalingLayer
: public Layer
{
17 void CalculateContentsScale(float ideal_contents_scale
,
18 float* contents_scale_x
,
19 float* contents_scale_y
,
20 gfx::Size
* content_bounds
) override
;
22 bool Update(ResourceUpdateQueue
* queue
,
23 const OcclusionTracker
<Layer
>* occlusion
) override
;
26 explicit ContentsScalingLayer(const LayerSettings
& settings
);
27 ~ContentsScalingLayer() override
;
29 gfx::Size
ComputeContentBoundsForScale(float scale_x
, float scale_y
) const;
32 float last_update_contents_scale_x_
;
33 float last_update_contents_scale_y_
;
35 DISALLOW_COPY_AND_ASSIGN(ContentsScalingLayer
);
40 #endif // CC_LAYERS_CONTENTS_SCALING_LAYER_H__