OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WebLayerImplFixedBounds_h |
| 6 #define WebLayerImplFixedBounds_h |
| 7 |
| 8 #include "ui/gfx/size.h" |
| 9 #include "ui/gfx/transform.h" |
| 10 #include "webkit/compositor_bindings/web_layer_impl.h" |
| 11 |
| 12 namespace WebKit { |
| 13 |
| 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 WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebLayerImplFixedBounds(); |
| 22 WEBKIT_COMPOSITOR_BINDINGS_EXPORT explicit WebLayerImplFixedBounds( |
| 23 scoped_refptr<cc::Layer>); |
| 24 virtual ~WebLayerImplFixedBounds(); |
| 25 |
| 26 // WebLayerImpl overrides. |
| 27 virtual void invalidateRect(const WebFloatRect&) OVERRIDE; |
| 28 virtual void setAnchorPoint(const WebFloatPoint&) OVERRIDE; |
| 29 virtual void setBounds(const WebSize&) OVERRIDE; |
| 30 virtual WebSize bounds() const OVERRIDE; |
| 31 virtual void setSublayerTransform(const SkMatrix44&) OVERRIDE; |
| 32 virtual void setSublayerTransform(const WebTransformationMatrix&) OVERRIDE; |
| 33 virtual SkMatrix44 sublayerTransform() const OVERRIDE; |
| 34 virtual void setTransform(const SkMatrix44&) OVERRIDE; |
| 35 virtual void setTransform(const WebTransformationMatrix&) OVERRIDE; |
| 36 virtual SkMatrix44 transform() const OVERRIDE; |
| 37 |
| 38 WEBKIT_COMPOSITOR_BINDINGS_EXPORT void SetFixedBounds(const gfx::Size&); |
| 39 |
| 40 protected: |
| 41 void SetTransformInternal(const gfx::Transform&); |
| 42 void SetSublayerTransformInternal(const gfx::Transform&); |
| 43 void UpdateLayerBoundsAndTransform(); |
| 44 |
| 45 gfx::Transform original_sublayer_transform_; |
| 46 gfx::Transform original_transform_; |
| 47 gfx::Size original_bounds_; |
| 48 gfx::Size fixed_bounds_; |
| 49 }; |
| 50 |
| 51 } // namespace WebKit |
| 52 |
| 53 #endif // WebLayerImplFixedBounds_h |
OLD | NEW |