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

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

Issue 11308153: Migrate most of cc/ from WebKit::WebTransformationMatrix to gfx::Transform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased to tip of tree and addressed feedback Created 8 years, 1 month 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 | Annotate | Revision Log
« cc/tiled_layer_impl.h ('K') | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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 WebKit { 24 namespace WebKit {
25 25
26 namespace {
27
28 WebTransformationMatrix transformationMatrixFromSkMatrix44(const SkMatrix44& mat rix)
29 {
30 double data[16];
31 matrix.asColMajord(data);
32 return WebTransformationMatrix(data[0], data[1], data[2], data[3],
33 data[4], data[5], data[6], data[7],
34 data[8], data[9], data[10], data[11],
35 data[12], data[13], data[14], data[15]);
36 }
37
38 SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& mat rix)
39 {
40 SkMatrix44 skMatrix;
41 skMatrix.set(0, 0, SkDoubleToMScalar(matrix.m11()));
42 skMatrix.set(1, 0, SkDoubleToMScalar(matrix.m12()));
43 skMatrix.set(2, 0, SkDoubleToMScalar(matrix.m13()));
44 skMatrix.set(3, 0, SkDoubleToMScalar(matrix.m14()));
45 skMatrix.set(0, 1, SkDoubleToMScalar(matrix.m21()));
46 skMatrix.set(1, 1, SkDoubleToMScalar(matrix.m22()));
47 skMatrix.set(2, 1, SkDoubleToMScalar(matrix.m23()));
48 skMatrix.set(3, 1, SkDoubleToMScalar(matrix.m24()));
49 skMatrix.set(0, 2, SkDoubleToMScalar(matrix.m31()));
50 skMatrix.set(1, 2, SkDoubleToMScalar(matrix.m32()));
51 skMatrix.set(2, 2, SkDoubleToMScalar(matrix.m33()));
52 skMatrix.set(3, 2, SkDoubleToMScalar(matrix.m34()));
53 skMatrix.set(0, 3, SkDoubleToMScalar(matrix.m41()));
54 skMatrix.set(1, 3, SkDoubleToMScalar(matrix.m42()));
55 skMatrix.set(2, 3, SkDoubleToMScalar(matrix.m43()));
56 skMatrix.set(3, 3, SkDoubleToMScalar(matrix.m44()));
57 return skMatrix;
58 }
59
60 }
61
62 WebLayer* WebLayer::create() 26 WebLayer* WebLayer::create()
63 { 27 {
64 return new WebLayerImpl(); 28 return new WebLayerImpl();
65 } 29 }
66 30
67 WebLayerImpl::WebLayerImpl() 31 WebLayerImpl::WebLayerImpl()
68 : m_layer(Layer::create()) 32 : m_layer(Layer::create())
69 { 33 {
70 } 34 }
71 35
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 m_layer->setPosition(position); 160 m_layer->setPosition(position);
197 } 161 }
198 162
199 WebFloatPoint WebLayerImpl::position() const 163 WebFloatPoint WebLayerImpl::position() const
200 { 164 {
201 return m_layer->position(); 165 return m_layer->position();
202 } 166 }
203 167
204 void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix) 168 void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix)
205 { 169 {
206 m_layer->setSublayerTransform(transformationMatrixFromSkMatrix44(matrix)); 170 gfx::Transform subLayerTransform;
171 subLayerTransform.matrix() = matrix;
172 m_layer->setSublayerTransform(subLayerTransform);
207 } 173 }
208 174
209 void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix) 175 void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix)
210 { 176 {
211 m_layer->setSublayerTransform(matrix); 177 m_layer->setSublayerTransform(matrix.toTransform());
212 } 178 }
213 179
214 SkMatrix44 WebLayerImpl::sublayerTransform() const 180 SkMatrix44 WebLayerImpl::sublayerTransform() const
215 { 181 {
216 return skMatrix44FromTransformationMatrix(m_layer->sublayerTransform()); 182 return m_layer->sublayerTransform().matrix();
217 } 183 }
218 184
219 void WebLayerImpl::setTransform(const SkMatrix44& matrix) 185 void WebLayerImpl::setTransform(const SkMatrix44& matrix)
220 { 186 {
221 m_layer->setTransform(transformationMatrixFromSkMatrix44(matrix)); 187 gfx::Transform transform;
188 transform.matrix() = matrix;
189 m_layer->setTransform(transform);
222 } 190 }
223 191
224 void WebLayerImpl::setTransform(const WebTransformationMatrix& matrix) 192 void WebLayerImpl::setTransform(const WebTransformationMatrix& matrix)
225 { 193 {
226 m_layer->setTransform(matrix); 194 m_layer->setTransform(matrix.toTransform());
227 } 195 }
228 196
229 SkMatrix44 WebLayerImpl::transform() const 197 SkMatrix44 WebLayerImpl::transform() const
230 { 198 {
231 return skMatrix44FromTransformationMatrix(m_layer->transform()); 199 return m_layer->transform().matrix();
232 } 200 }
233 201
234 void WebLayerImpl::setDrawsContent(bool drawsContent) 202 void WebLayerImpl::setDrawsContent(bool drawsContent)
235 { 203 {
236 m_layer->setIsDrawable(drawsContent); 204 m_layer->setIsDrawable(drawsContent);
237 } 205 }
238 206
239 bool WebLayerImpl::drawsContent() const 207 bool WebLayerImpl::drawsContent() const
240 { 208 {
241 return m_layer->drawsContent(); 209 return m_layer->drawsContent();
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 { 421 {
454 m_layer->setLayerScrollClient(scrollClient); 422 m_layer->setLayerScrollClient(scrollClient);
455 } 423 }
456 424
457 Layer* WebLayerImpl::layer() const 425 Layer* WebLayerImpl::layer() const
458 { 426 {
459 return m_layer.get(); 427 return m_layer.get();
460 } 428 }
461 429
462 } // namespace WebKit 430 } // namespace WebKit
OLDNEW
« cc/tiled_layer_impl.h ('K') | « ui/compositor/layer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698