OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 "web_layer_impl.h" | 5 #include "web_layer_impl.h" |
6 | 6 |
7 #include "SkMatrix44.h" | 7 #include "SkMatrix44.h" |
8 #ifdef LOG | 8 #ifdef LOG |
9 #undef LOG | 9 #undef LOG |
10 #endif | 10 #endif |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "cc/active_animation.h" | 12 #include "cc/active_animation.h" |
13 #include "cc/layer.h" | 13 #include "cc/layer.h" |
14 #include "cc/region.h" | 14 #include "cc/region.h" |
15 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" | 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" |
16 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" | 16 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" |
17 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" | 17 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" |
18 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa trix.h" | 18 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa trix.h" |
19 #include "web_animation_impl.h" | 19 #include "web_animation_impl.h" |
20 | 20 |
21 using cc::ActiveAnimation; | 21 using cc::ActiveAnimation; |
22 using cc::Layer; | 22 using cc::Layer; |
23 | 23 |
24 namespace { | |
25 gfx::Transform convertWebTransformationMatrixToTransform(const WebKit::WebTransf ormationMatrix& matrix) | |
26 { | |
27 gfx::Transform transform; | |
danakj
2013/01/03 21:08:40
Can you throw a TODO here to use the initialized c
| |
28 transform.matrix().setDouble(0, 0, matrix.m11()); | |
29 transform.matrix().setDouble(0, 1, matrix.m21()); | |
30 transform.matrix().setDouble(0, 2, matrix.m31()); | |
31 transform.matrix().setDouble(0, 3, matrix.m41()); | |
32 transform.matrix().setDouble(1, 0, matrix.m12()); | |
33 transform.matrix().setDouble(1, 1, matrix.m22()); | |
34 transform.matrix().setDouble(1, 2, matrix.m32()); | |
35 transform.matrix().setDouble(1, 3, matrix.m42()); | |
36 transform.matrix().setDouble(2, 0, matrix.m13()); | |
37 transform.matrix().setDouble(2, 1, matrix.m23()); | |
38 transform.matrix().setDouble(2, 2, matrix.m33()); | |
39 transform.matrix().setDouble(2, 3, matrix.m43()); | |
40 transform.matrix().setDouble(3, 0, matrix.m14()); | |
41 transform.matrix().setDouble(3, 1, matrix.m24()); | |
42 transform.matrix().setDouble(3, 2, matrix.m34()); | |
43 transform.matrix().setDouble(3, 3, matrix.m44()); | |
44 return transform; | |
45 } | |
46 } // namespace | |
47 | |
48 | |
24 namespace WebKit { | 49 namespace WebKit { |
25 | 50 |
26 WebLayerImpl::WebLayerImpl() | 51 WebLayerImpl::WebLayerImpl() |
27 : m_layer(Layer::create()) | 52 : m_layer(Layer::create()) |
28 { | 53 { |
29 } | 54 } |
30 | 55 |
31 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) | 56 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) |
32 : m_layer(layer) | 57 : m_layer(layer) |
33 { | 58 { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 | 187 |
163 void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix) | 188 void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix) |
164 { | 189 { |
165 gfx::Transform subLayerTransform; | 190 gfx::Transform subLayerTransform; |
166 subLayerTransform.matrix() = matrix; | 191 subLayerTransform.matrix() = matrix; |
167 m_layer->setSublayerTransform(subLayerTransform); | 192 m_layer->setSublayerTransform(subLayerTransform); |
168 } | 193 } |
169 | 194 |
170 void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix) | 195 void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix) |
171 { | 196 { |
172 m_layer->setSublayerTransform(matrix.toTransform()); | 197 m_layer->setSublayerTransform(convertWebTransformationMatrixToTransform(matr ix)); |
173 } | 198 } |
174 | 199 |
175 SkMatrix44 WebLayerImpl::sublayerTransform() const | 200 SkMatrix44 WebLayerImpl::sublayerTransform() const |
176 { | 201 { |
177 return m_layer->sublayerTransform().matrix(); | 202 return m_layer->sublayerTransform().matrix(); |
178 } | 203 } |
179 | 204 |
180 void WebLayerImpl::setTransform(const SkMatrix44& matrix) | 205 void WebLayerImpl::setTransform(const SkMatrix44& matrix) |
181 { | 206 { |
182 gfx::Transform transform; | 207 gfx::Transform transform; |
183 transform.matrix() = matrix; | 208 transform.matrix() = matrix; |
184 m_layer->setTransform(transform); | 209 m_layer->setTransform(transform); |
185 } | 210 } |
186 | 211 |
187 void WebLayerImpl::setTransform(const WebTransformationMatrix& matrix) | 212 void WebLayerImpl::setTransform(const WebTransformationMatrix& matrix) |
188 { | 213 { |
189 m_layer->setTransform(matrix.toTransform()); | 214 m_layer->setTransform(convertWebTransformationMatrixToTransform(matrix)); |
190 } | 215 } |
191 | 216 |
192 SkMatrix44 WebLayerImpl::transform() const | 217 SkMatrix44 WebLayerImpl::transform() const |
193 { | 218 { |
194 return m_layer->transform().matrix(); | 219 return m_layer->transform().matrix(); |
195 } | 220 } |
196 | 221 |
197 void WebLayerImpl::setDrawsContent(bool drawsContent) | 222 void WebLayerImpl::setDrawsContent(bool drawsContent) |
198 { | 223 { |
199 m_layer->setIsDrawable(drawsContent); | 224 m_layer->setIsDrawable(drawsContent); |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
417 { | 442 { |
418 m_layer->setLayerScrollClient(scrollClient); | 443 m_layer->setLayerScrollClient(scrollClient); |
419 } | 444 } |
420 | 445 |
421 Layer* WebLayerImpl::layer() const | 446 Layer* WebLayerImpl::layer() const |
422 { | 447 { |
423 return m_layer.get(); | 448 return m_layer.get(); |
424 } | 449 } |
425 | 450 |
426 } // namespace WebKit | 451 } // namespace WebKit |
OLD | NEW |