Rename Animate as Begin(Main)Frame
[chromium-blink-merge.git] / content / renderer / compositor_bindings / web_layer_impl_fixed_bounds.h
blob2048666fd18a1898ce216bccd5cc6566cb874767
1 // Copyright 2014 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 CONTENT_RENDERER_COMPOSITOR_BINDINGS_WEB_LAYER_IMPL_FIXED_BOUNDS_H_
6 #define CONTENT_RENDERER_COMPOSITOR_BINDINGS_WEB_LAYER_IMPL_FIXED_BOUNDS_H_
8 #include "content/renderer/compositor_bindings/web_layer_impl.h"
9 #include "ui/gfx/size.h"
10 #include "ui/gfx/transform.h"
12 namespace content {
14 // A special implementation of WebLayerImpl for layers that its contents
15 // need to be automatically scaled when the bounds changes. The compositor
16 // can efficiently handle the bounds change of such layers if the bounds
17 // is fixed to a given value and the change of bounds are converted to
18 // transformation scales.
19 class WebLayerImplFixedBounds : public WebLayerImpl {
20 public:
21 CONTENT_EXPORT WebLayerImplFixedBounds();
22 CONTENT_EXPORT explicit WebLayerImplFixedBounds(
23 scoped_refptr<cc::Layer>);
24 virtual ~WebLayerImplFixedBounds();
26 // WebLayerImpl overrides.
27 virtual void invalidateRect(const blink::WebFloatRect& rect);
28 virtual void setTransformOrigin(
29 const blink::WebFloatPoint3D& transform_origin);
30 virtual void setBounds(const blink::WebSize& bounds);
31 virtual blink::WebSize bounds() const;
32 virtual void setTransform(const SkMatrix44& transform);
33 virtual SkMatrix44 transform() const;
35 CONTENT_EXPORT void SetFixedBounds(gfx::Size bounds);
37 protected:
38 void SetTransformInternal(const gfx::Transform& transform);
39 void UpdateLayerBoundsAndTransform();
41 gfx::Transform original_transform_;
42 gfx::Size original_bounds_;
43 gfx::Size fixed_bounds_;
45 private:
46 DISALLOW_COPY_AND_ASSIGN(WebLayerImplFixedBounds);
49 } // namespace content
51 #endif // CONTENT_RENDERER_COMPOSITOR_BINDINGS_WEB_LAYER_IMPL_FIXED_BOUNDS_H_