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 #include "webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h" | 5 #include "webkit/renderer/compositor_bindings/web_layer_impl_fixed_bounds.h" |
6 | 6 |
7 #include "cc/layers/layer.h" | 7 #include "cc/layers/layer.h" |
8 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 8 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
9 #include "third_party/WebKit/public/platform/WebSize.h" | 9 #include "third_party/WebKit/public/platform/WebSize.h" |
10 #include "third_party/skia/include/utils/SkMatrix44.h" | 10 #include "third_party/skia/include/utils/SkMatrix44.h" |
11 | 11 |
12 using cc::Layer; | 12 using cc::Layer; |
13 | 13 |
14 namespace webkit { | 14 namespace webkit { |
15 | 15 |
16 WebLayerImplFixedBounds::WebLayerImplFixedBounds() { | 16 WebLayerImplFixedBounds::WebLayerImplFixedBounds() { |
17 } | 17 } |
18 | 18 |
19 WebLayerImplFixedBounds::WebLayerImplFixedBounds(scoped_refptr<Layer> layer) | 19 WebLayerImplFixedBounds::WebLayerImplFixedBounds(scoped_refptr<Layer> layer) |
20 : WebLayerImpl(layer) { | 20 : WebLayerImpl(layer) { |
21 } | 21 } |
22 | 22 |
23 | 23 |
24 WebLayerImplFixedBounds::~WebLayerImplFixedBounds() { | 24 WebLayerImplFixedBounds::~WebLayerImplFixedBounds() { |
25 } | 25 } |
26 | 26 |
27 void WebLayerImplFixedBounds::invalidateRect(const WebKit::WebFloatRect& rect) { | 27 void WebLayerImplFixedBounds::invalidateRect(const blink::WebFloatRect& rect) { |
28 // Partial invalidations seldom occur for such layers. | 28 // Partial invalidations seldom occur for such layers. |
29 // Simply invalidate the whole layer to avoid transformation of coordinates. | 29 // Simply invalidate the whole layer to avoid transformation of coordinates. |
30 invalidate(); | 30 invalidate(); |
31 } | 31 } |
32 | 32 |
33 void WebLayerImplFixedBounds::setAnchorPoint( | 33 void WebLayerImplFixedBounds::setAnchorPoint( |
34 const WebKit::WebFloatPoint& anchor_point) { | 34 const blink::WebFloatPoint& anchor_point) { |
35 if (anchor_point != this->anchorPoint()) { | 35 if (anchor_point != this->anchorPoint()) { |
36 layer_->SetAnchorPoint(anchor_point); | 36 layer_->SetAnchorPoint(anchor_point); |
37 UpdateLayerBoundsAndTransform(); | 37 UpdateLayerBoundsAndTransform(); |
38 } | 38 } |
39 } | 39 } |
40 | 40 |
41 void WebLayerImplFixedBounds::setBounds(const WebKit::WebSize& bounds) { | 41 void WebLayerImplFixedBounds::setBounds(const blink::WebSize& bounds) { |
42 if (original_bounds_ != gfx::Size(bounds)) { | 42 if (original_bounds_ != gfx::Size(bounds)) { |
43 original_bounds_ = bounds; | 43 original_bounds_ = bounds; |
44 UpdateLayerBoundsAndTransform(); | 44 UpdateLayerBoundsAndTransform(); |
45 } | 45 } |
46 } | 46 } |
47 | 47 |
48 WebKit::WebSize WebLayerImplFixedBounds::bounds() const { | 48 blink::WebSize WebLayerImplFixedBounds::bounds() const { |
49 return original_bounds_; | 49 return original_bounds_; |
50 } | 50 } |
51 | 51 |
52 void WebLayerImplFixedBounds::setSublayerTransform(const SkMatrix44& matrix) { | 52 void WebLayerImplFixedBounds::setSublayerTransform(const SkMatrix44& matrix) { |
53 gfx::Transform transform; | 53 gfx::Transform transform; |
54 transform.matrix() = matrix; | 54 transform.matrix() = matrix; |
55 SetSublayerTransformInternal(transform); | 55 SetSublayerTransformInternal(transform); |
56 } | 56 } |
57 | 57 |
58 SkMatrix44 WebLayerImplFixedBounds::sublayerTransform() const { | 58 SkMatrix44 WebLayerImplFixedBounds::sublayerTransform() const { |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 // As we apply extra scale transform on this layer which will propagate to the | 118 // As we apply extra scale transform on this layer which will propagate to the |
119 // sublayers, here undo the scale on sublayers. | 119 // sublayers, here undo the scale on sublayers. |
120 gfx::Transform sublayer_transform_with_inverse_bounds_scale; | 120 gfx::Transform sublayer_transform_with_inverse_bounds_scale; |
121 sublayer_transform_with_inverse_bounds_scale.Scale(1.f / bounds_scale_x, | 121 sublayer_transform_with_inverse_bounds_scale.Scale(1.f / bounds_scale_x, |
122 1.f / bounds_scale_y); | 122 1.f / bounds_scale_y); |
123 sublayer_transform_with_inverse_bounds_scale.PreconcatTransform( | 123 sublayer_transform_with_inverse_bounds_scale.PreconcatTransform( |
124 original_sublayer_transform_); | 124 original_sublayer_transform_); |
125 layer_->SetSublayerTransform(sublayer_transform_with_inverse_bounds_scale); | 125 layer_->SetSublayerTransform(sublayer_transform_with_inverse_bounds_scale); |
126 } | 126 } |
127 | 127 |
128 } // namespace WebKit | 128 } // namespace webkit |
OLD | NEW |