Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(109)

Side by Side Diff: webkit/compositor_bindings/web_layer_impl.cc

Issue 12035029: Finish migrating cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix nits Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "webkit/compositor_bindings/web_layer_impl.h" 5 #include "webkit/compositor_bindings/web_layer_impl.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "cc/animation.h" 8 #include "cc/animation.h"
9 #include "cc/layer.h" 9 #include "cc/layer.h"
10 #include "cc/region.h" 10 #include "cc/region.h"
11 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h" 11 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatPoint.h"
12 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h" 12 #include "third_party/WebKit/Source/Platform/chromium/public/WebFloatRect.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h" 13 #include "third_party/WebKit/Source/Platform/chromium/public/WebSize.h"
14 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa trix.h" 14 #include "third_party/WebKit/Source/Platform/chromium/public/WebTransformationMa trix.h"
15 #include "third_party/skia/include/utils/SkMatrix44.h" 15 #include "third_party/skia/include/utils/SkMatrix44.h"
16 #include "webkit/compositor_bindings/web_animation_impl.h" 16 #include "webkit/compositor_bindings/web_animation_impl.h"
17 #include "webkit/compositor_bindings/web_transformation_matrix_util.h"
17 18
18 using cc::Animation; 19 using cc::Animation;
19 using cc::Layer; 20 using cc::Layer;
20 21 using webkit::WebTransformationMatrixUtil;
21 namespace {
22 gfx::Transform convertWebTransformationMatrixToTransform(const WebKit::WebTransf ormationMatrix& matrix)
23 {
24 // TODO(jamesr): When gfx::Transform provides a constructor that does not
25 // initialize the matrix, use that.
26 gfx::Transform transform;
27 transform.matrix().setDouble(0, 0, matrix.m11());
28 transform.matrix().setDouble(0, 1, matrix.m21());
29 transform.matrix().setDouble(0, 2, matrix.m31());
30 transform.matrix().setDouble(0, 3, matrix.m41());
31 transform.matrix().setDouble(1, 0, matrix.m12());
32 transform.matrix().setDouble(1, 1, matrix.m22());
33 transform.matrix().setDouble(1, 2, matrix.m32());
34 transform.matrix().setDouble(1, 3, matrix.m42());
35 transform.matrix().setDouble(2, 0, matrix.m13());
36 transform.matrix().setDouble(2, 1, matrix.m23());
37 transform.matrix().setDouble(2, 2, matrix.m33());
38 transform.matrix().setDouble(2, 3, matrix.m43());
39 transform.matrix().setDouble(3, 0, matrix.m14());
40 transform.matrix().setDouble(3, 1, matrix.m24());
41 transform.matrix().setDouble(3, 2, matrix.m34());
42 transform.matrix().setDouble(3, 3, matrix.m44());
43 return transform;
44 }
45 } // namespace
46
47 22
48 namespace WebKit { 23 namespace WebKit {
49 24
50 WebLayerImpl::WebLayerImpl() 25 WebLayerImpl::WebLayerImpl()
51 : m_layer(Layer::create()) 26 : m_layer(Layer::create())
52 { 27 {
53 } 28 }
54 29
55 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) 30 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer)
56 : m_layer(layer) 31 : m_layer(layer)
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 161
187 void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix) 162 void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix)
188 { 163 {
189 gfx::Transform subLayerTransform; 164 gfx::Transform subLayerTransform;
190 subLayerTransform.matrix() = matrix; 165 subLayerTransform.matrix() = matrix;
191 m_layer->setSublayerTransform(subLayerTransform); 166 m_layer->setSublayerTransform(subLayerTransform);
192 } 167 }
193 168
194 void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix) 169 void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix)
195 { 170 {
196 m_layer->setSublayerTransform(convertWebTransformationMatrixToTransform(matr ix)); 171 m_layer->setSublayerTransform(WebTransformationMatrixUtil::ToTransform(matri x));
197 } 172 }
198 173
199 SkMatrix44 WebLayerImpl::sublayerTransform() const 174 SkMatrix44 WebLayerImpl::sublayerTransform() const
200 { 175 {
201 return m_layer->sublayerTransform().matrix(); 176 return m_layer->sublayerTransform().matrix();
202 } 177 }
203 178
204 void WebLayerImpl::setTransform(const SkMatrix44& matrix) 179 void WebLayerImpl::setTransform(const SkMatrix44& matrix)
205 { 180 {
206 gfx::Transform transform; 181 gfx::Transform transform;
207 transform.matrix() = matrix; 182 transform.matrix() = matrix;
208 m_layer->setTransform(transform); 183 m_layer->setTransform(transform);
209 } 184 }
210 185
211 void WebLayerImpl::setTransform(const WebTransformationMatrix& matrix) 186 void WebLayerImpl::setTransform(const WebTransformationMatrix& matrix)
212 { 187 {
213 m_layer->setTransform(convertWebTransformationMatrixToTransform(matrix)); 188 m_layer->setTransform(WebTransformationMatrixUtil::ToTransform(matrix));
214 } 189 }
215 190
216 SkMatrix44 WebLayerImpl::transform() const 191 SkMatrix44 WebLayerImpl::transform() const
217 { 192 {
218 return m_layer->transform().matrix(); 193 return m_layer->transform().matrix();
219 } 194 }
220 195
221 void WebLayerImpl::setDrawsContent(bool drawsContent) 196 void WebLayerImpl::setDrawsContent(bool drawsContent)
222 { 197 {
223 m_layer->setIsDrawable(drawsContent); 198 m_layer->setIsDrawable(drawsContent);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 { 416 {
442 m_layer->setLayerScrollClient(scrollClient); 417 m_layer->setLayerScrollClient(scrollClient);
443 } 418 }
444 419
445 Layer* WebLayerImpl::layer() const 420 Layer* WebLayerImpl::layer() const
446 { 421 {
447 return m_layer.get(); 422 return m_layer.get();
448 } 423 }
449 424
450 } // namespace WebKit 425 } // namespace WebKit
OLDNEW
« no previous file with comments | « webkit/compositor_bindings/compositor_bindings.gyp ('k') | webkit/compositor_bindings/web_transform_animation_curve_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698