OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 CC_BLINK_WEB_LAYER_IMPL_FIXED_BOUNDS_H_ | 5 #ifndef CC_BLINK_WEB_LAYER_IMPL_FIXED_BOUNDS_H_ |
6 #define CC_BLINK_WEB_LAYER_IMPL_FIXED_BOUNDS_H_ | 6 #define CC_BLINK_WEB_LAYER_IMPL_FIXED_BOUNDS_H_ |
7 | 7 |
8 #include "cc/blink/web_layer_impl.h" | 8 #include "cc/blink/web_layer_impl.h" |
9 #include "ui/gfx/size.h" | 9 #include "ui/gfx/size.h" |
10 #include "ui/gfx/transform.h" | 10 #include "ui/gfx/transform.h" |
11 | 11 |
12 namespace cc_blink { | 12 namespace cc_blink { |
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 CC_BLINK_EXPORT WebLayerImplFixedBounds(); | 21 CC_BLINK_EXPORT WebLayerImplFixedBounds(); |
22 CC_BLINK_EXPORT explicit WebLayerImplFixedBounds(scoped_refptr<cc::Layer>); | 22 CC_BLINK_EXPORT explicit WebLayerImplFixedBounds( |
23 scoped_refptr<cc::Layer> layer); | |
23 virtual ~WebLayerImplFixedBounds(); | 24 virtual ~WebLayerImplFixedBounds(); |
24 | 25 |
25 // WebLayerImpl overrides. | 26 // WebLayerImpl overrides. |
26 virtual void invalidateRect(const blink::WebFloatRect& rect) override; | |
27 virtual void invalidateRect(const blink::WebRect& rect) override; | 27 virtual void invalidateRect(const blink::WebRect& rect) override; |
28 virtual void setTransformOrigin( | 28 virtual void setTransformOrigin( |
29 const blink::WebFloatPoint3D& transform_origin); | 29 const blink::WebFloatPoint3D& transform_origin) override; |
danakj
2014/10/14 18:00:56
I left the override on invalidateRect and added th
| |
30 virtual void setBounds(const blink::WebSize& bounds); | 30 virtual void setBounds(const blink::WebSize& bounds) override; |
31 virtual blink::WebSize bounds() const; | 31 virtual blink::WebSize bounds() const override; |
32 virtual void setTransform(const SkMatrix44& transform); | 32 virtual void setTransform(const SkMatrix44& transform); |
enne (OOO)
2014/10/14 19:27:27
This doesn't need an override?
danakj
2014/10/14 19:28:21
oops missed
| |
33 virtual SkMatrix44 transform() const; | 33 virtual SkMatrix44 transform() const override; |
34 | 34 |
35 CC_BLINK_EXPORT void SetFixedBounds(gfx::Size bounds); | 35 CC_BLINK_EXPORT void SetFixedBounds(gfx::Size bounds); |
36 | 36 |
37 protected: | 37 protected: |
38 void SetTransformInternal(const gfx::Transform& transform); | 38 void SetTransformInternal(const gfx::Transform& transform); |
39 void UpdateLayerBoundsAndTransform(); | 39 void UpdateLayerBoundsAndTransform(); |
40 | 40 |
41 gfx::Transform original_transform_; | 41 gfx::Transform original_transform_; |
42 gfx::Size original_bounds_; | 42 gfx::Size original_bounds_; |
43 gfx::Size fixed_bounds_; | 43 gfx::Size fixed_bounds_; |
44 | 44 |
45 private: | 45 private: |
46 DISALLOW_COPY_AND_ASSIGN(WebLayerImplFixedBounds); | 46 DISALLOW_COPY_AND_ASSIGN(WebLayerImplFixedBounds); |
47 }; | 47 }; |
48 | 48 |
49 } // namespace cc_blink | 49 } // namespace cc_blink |
50 | 50 |
51 #endif // CC_BLINK_WEB_LAYER_IMPL_FIXED_BOUNDS_H_ | 51 #endif // CC_BLINK_WEB_LAYER_IMPL_FIXED_BOUNDS_H_ |
OLD | NEW |