Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / cc / layers / contents_scaling_layer.h
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.
4
5 #ifndef CC_LAYERS_CONTENTS_SCALING_LAYER_H_
6 #define CC_LAYERS_CONTENTS_SCALING_LAYER_H_
7
8 #include "cc/base/cc_export.h"
9 #include "cc/layers/layer.h"
10
11 namespace cc {
12
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 {
16  public:
17   virtual void CalculateContentsScale(float ideal_contents_scale,
18                                       float device_scale_factor,
19                                       float page_scale_factor,
20                                       float maximum_animation_contents_scale,
21                                       bool animating_transform_to_screen,
22                                       float* contents_scale_x,
23                                       float* contents_scale_y,
24                                       gfx::Size* content_bounds) OVERRIDE;
25
26   virtual bool Update(ResourceUpdateQueue* queue,
27                       const OcclusionTracker<Layer>* occlusion) OVERRIDE;
28
29  protected:
30   ContentsScalingLayer();
31   virtual ~ContentsScalingLayer();
32
33   gfx::Size ComputeContentBoundsForScale(float scale_x, float scale_y) const;
34
35  private:
36   float last_update_contents_scale_x_;
37   float last_update_contents_scale_y_;
38
39   DISALLOW_COPY_AND_ASSIGN(ContentsScalingLayer);
40 };
41
42 }  // namespace cc
43
44 #endif  // CC_LAYERS_CONTENTS_SCALING_LAYER_H__