| 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 "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "cc/blink/web_layer_impl.h" | 9 #include "cc/blink/web_layer_impl.h" |
| 10 #include "ui/gfx/geometry/size.h" | 10 #include "ui/gfx/geometry/size.h" |
| 11 #include "ui/gfx/transform.h" | 11 #include "ui/gfx/transform.h" |
| 12 | 12 |
| 13 namespace cc_blink { | 13 namespace cc_blink { |
| 14 | 14 |
| 15 // A special implementation of WebLayerImpl for layers that its contents | 15 // A special implementation of WebLayerImpl for layers that its contents |
| 16 // need to be automatically scaled when the bounds changes. The compositor | 16 // need to be automatically scaled when the bounds changes. The compositor |
| 17 // can efficiently handle the bounds change of such layers if the bounds | 17 // can efficiently handle the bounds change of such layers if the bounds |
| 18 // is fixed to a given value and the change of bounds are converted to | 18 // is fixed to a given value and the change of bounds are converted to |
| 19 // transformation scales. | 19 // transformation scales. |
| 20 class WebLayerImplFixedBounds : public WebLayerImpl { | 20 class CC_BLINK_EXPORT WebLayerImplFixedBounds : public WebLayerImpl { |
| 21 public: | 21 public: |
| 22 CC_BLINK_EXPORT WebLayerImplFixedBounds(); | 22 WebLayerImplFixedBounds(); |
| 23 CC_BLINK_EXPORT explicit WebLayerImplFixedBounds( | 23 explicit WebLayerImplFixedBounds(scoped_refptr<cc::Layer> layer); |
| 24 scoped_refptr<cc::Layer> layer); | |
| 25 ~WebLayerImplFixedBounds() override; | 24 ~WebLayerImplFixedBounds() override; |
| 26 | 25 |
| 27 // WebLayerImpl overrides. | 26 // WebLayerImpl overrides. |
| 28 void invalidateRect(const blink::WebRect& rect) override; | 27 void invalidateRect(const blink::WebRect& rect) override; |
| 29 void setTransformOrigin( | 28 void setTransformOrigin( |
| 30 const blink::WebFloatPoint3D& transform_origin) override; | 29 const blink::WebFloatPoint3D& transform_origin) override; |
| 31 void setBounds(const blink::WebSize& bounds) override; | 30 void setBounds(const blink::WebSize& bounds) override; |
| 32 blink::WebSize bounds() const override; | 31 blink::WebSize bounds() const override; |
| 33 void setTransform(const SkMatrix44& transform) override; | 32 void setTransform(const SkMatrix44& transform) override; |
| 34 SkMatrix44 transform() const override; | 33 SkMatrix44 transform() const override; |
| 35 | 34 |
| 36 CC_BLINK_EXPORT void SetFixedBounds(gfx::Size bounds); | 35 void SetFixedBounds(gfx::Size bounds); |
| 37 | 36 |
| 38 protected: | 37 protected: |
| 39 void SetTransformInternal(const gfx::Transform& transform); | 38 void SetTransformInternal(const gfx::Transform& transform); |
| 40 void UpdateLayerBoundsAndTransform(); | 39 void UpdateLayerBoundsAndTransform(); |
| 41 | 40 |
| 42 gfx::Transform original_transform_; | 41 gfx::Transform original_transform_; |
| 43 gfx::Size original_bounds_; | 42 gfx::Size original_bounds_; |
| 44 gfx::Size fixed_bounds_; | 43 gfx::Size fixed_bounds_; |
| 45 | 44 |
| 46 private: | 45 private: |
| 47 DISALLOW_COPY_AND_ASSIGN(WebLayerImplFixedBounds); | 46 DISALLOW_COPY_AND_ASSIGN(WebLayerImplFixedBounds); |
| 48 }; | 47 }; |
| 49 | 48 |
| 50 } // namespace cc_blink | 49 } // namespace cc_blink |
| 51 | 50 |
| 52 #endif // CC_BLINK_WEB_LAYER_IMPL_FIXED_BOUNDS_H_ | 51 #endif // CC_BLINK_WEB_LAYER_IMPL_FIXED_BOUNDS_H_ |
| OLD | NEW |