OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WebLayerImplFixedBounds_h | 5 #ifndef WEBKIT_COMPOSITOR_BINDINGS_WEB_LAYER_IMPL_FIXED_BOUNDS_H_ |
6 #define WebLayerImplFixedBounds_h | 6 #define WEBKIT_COMPOSITOR_BINDINGS_WEB_LAYER_IMPL_FIXED_BOUNDS_H_ |
7 | 7 |
8 #include "ui/gfx/size.h" | 8 #include "ui/gfx/size.h" |
9 #include "ui/gfx/transform.h" | 9 #include "ui/gfx/transform.h" |
10 #include "webkit/compositor_bindings/web_layer_impl.h" | 10 #include "webkit/compositor_bindings/web_layer_impl.h" |
11 | 11 |
12 namespace WebKit { | 12 namespace webkit { |
13 | 13 |
14 // A special implementation of WebLayerImpl for layers that its contents | 14 // A special implementation of WebLayerImpl for layers that its contents |
15 // need to be automatically scaled when the bounds changes. The compositor | 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 | 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 | 17 // is fixed to a given value and the change of bounds are converted to |
18 // transformation scales. | 18 // transformation scales. |
19 class WebLayerImplFixedBounds : public WebLayerImpl { | 19 class WebLayerImplFixedBounds : public WebLayerImpl { |
20 public: | 20 public: |
21 WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebLayerImplFixedBounds(); | 21 WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebLayerImplFixedBounds(); |
22 WEBKIT_COMPOSITOR_BINDINGS_EXPORT explicit WebLayerImplFixedBounds( | 22 WEBKIT_COMPOSITOR_BINDINGS_EXPORT explicit WebLayerImplFixedBounds( |
23 scoped_refptr<cc::Layer>); | 23 scoped_refptr<cc::Layer>); |
24 virtual ~WebLayerImplFixedBounds(); | 24 virtual ~WebLayerImplFixedBounds(); |
25 | 25 |
26 // WebLayerImpl overrides. | 26 // WebLayerImpl overrides. |
27 virtual void invalidateRect(const WebFloatRect&); | 27 virtual void invalidateRect(const WebKit::WebFloatRect& rect); |
28 virtual void setAnchorPoint(const WebFloatPoint&); | 28 virtual void setAnchorPoint(const WebKit::WebFloatPoint& anchor_point); |
29 virtual void setBounds(const WebSize&); | 29 virtual void setBounds(const WebKit::WebSize& bounds); |
30 virtual WebSize bounds() const; | 30 virtual WebKit::WebSize bounds() const; |
31 virtual void setSublayerTransform(const SkMatrix44&); | 31 virtual void setSublayerTransform(const SkMatrix44& transform); |
32 virtual SkMatrix44 sublayerTransform() const; | 32 virtual SkMatrix44 sublayerTransform() const; |
33 virtual void setTransform(const SkMatrix44&); | 33 virtual void setTransform(const SkMatrix44& transform); |
34 virtual SkMatrix44 transform() const; | 34 virtual SkMatrix44 transform() const; |
35 | 35 |
36 WEBKIT_COMPOSITOR_BINDINGS_EXPORT void SetFixedBounds(const gfx::Size&); | 36 WEBKIT_COMPOSITOR_BINDINGS_EXPORT void SetFixedBounds(gfx::Size bounds); |
37 | 37 |
38 protected: | 38 protected: |
39 void SetTransformInternal(const gfx::Transform&); | 39 void SetTransformInternal(const gfx::Transform& transform); |
40 void SetSublayerTransformInternal(const gfx::Transform&); | 40 void SetSublayerTransformInternal(const gfx::Transform& transform); |
41 void UpdateLayerBoundsAndTransform(); | 41 void UpdateLayerBoundsAndTransform(); |
42 | 42 |
43 gfx::Transform original_sublayer_transform_; | 43 gfx::Transform original_sublayer_transform_; |
44 gfx::Transform original_transform_; | 44 gfx::Transform original_transform_; |
45 gfx::Size original_bounds_; | 45 gfx::Size original_bounds_; |
46 gfx::Size fixed_bounds_; | 46 gfx::Size fixed_bounds_; |
| 47 |
| 48 private: |
| 49 DISALLOW_COPY_AND_ASSIGN(WebLayerImplFixedBounds); |
47 }; | 50 }; |
48 | 51 |
49 } // namespace WebKit | 52 } // namespace webkit |
50 | 53 |
51 #endif // WebLayerImplFixedBounds_h | 54 #endif // WEBKIT_COMPOSITOR_BINDINGS_WEB_LAYER_IMPL_FIXED_BOUNDS_H_ |
OLD | NEW |