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

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

Issue 11762003: Avoid depending on WebTransformationMatrix::toTransform (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add TODO 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 | Annotate | Revision Log
« no previous file with comments | « cc/layer_animation_controller.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 {
25 gfx::Transform convertWebTransformationMatrixToTransform(const WebKit::WebTransf ormationMatrix& matrix)
26 {
27 // TODO(jamesr): When gfx::Transform provides a constructor that does not
28 // initialize the matrix, use that.
29 gfx::Transform transform;
30 transform.matrix().setDouble(0, 0, matrix.m11());
31 transform.matrix().setDouble(0, 1, matrix.m21());
32 transform.matrix().setDouble(0, 2, matrix.m31());
33 transform.matrix().setDouble(0, 3, matrix.m41());
34 transform.matrix().setDouble(1, 0, matrix.m12());
35 transform.matrix().setDouble(1, 1, matrix.m22());
36 transform.matrix().setDouble(1, 2, matrix.m32());
37 transform.matrix().setDouble(1, 3, matrix.m42());
38 transform.matrix().setDouble(2, 0, matrix.m13());
39 transform.matrix().setDouble(2, 1, matrix.m23());
40 transform.matrix().setDouble(2, 2, matrix.m33());
41 transform.matrix().setDouble(2, 3, matrix.m43());
42 transform.matrix().setDouble(3, 0, matrix.m14());
43 transform.matrix().setDouble(3, 1, matrix.m24());
44 transform.matrix().setDouble(3, 2, matrix.m34());
45 transform.matrix().setDouble(3, 3, matrix.m44());
46 return transform;
47 }
48 } // namespace
49
50
24 namespace WebKit { 51 namespace WebKit {
25 52
26 WebLayerImpl::WebLayerImpl() 53 WebLayerImpl::WebLayerImpl()
27 : m_layer(Layer::create()) 54 : m_layer(Layer::create())
28 { 55 {
29 } 56 }
30 57
31 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer) 58 WebLayerImpl::WebLayerImpl(scoped_refptr<Layer> layer)
32 : m_layer(layer) 59 : m_layer(layer)
33 { 60 {
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 189
163 void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix) 190 void WebLayerImpl::setSublayerTransform(const SkMatrix44& matrix)
164 { 191 {
165 gfx::Transform subLayerTransform; 192 gfx::Transform subLayerTransform;
166 subLayerTransform.matrix() = matrix; 193 subLayerTransform.matrix() = matrix;
167 m_layer->setSublayerTransform(subLayerTransform); 194 m_layer->setSublayerTransform(subLayerTransform);
168 } 195 }
169 196
170 void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix) 197 void WebLayerImpl::setSublayerTransform(const WebTransformationMatrix& matrix)
171 { 198 {
172 m_layer->setSublayerTransform(matrix.toTransform()); 199 m_layer->setSublayerTransform(convertWebTransformationMatrixToTransform(matr ix));
173 } 200 }
174 201
175 SkMatrix44 WebLayerImpl::sublayerTransform() const 202 SkMatrix44 WebLayerImpl::sublayerTransform() const
176 { 203 {
177 return m_layer->sublayerTransform().matrix(); 204 return m_layer->sublayerTransform().matrix();
178 } 205 }
179 206
180 void WebLayerImpl::setTransform(const SkMatrix44& matrix) 207 void WebLayerImpl::setTransform(const SkMatrix44& matrix)
181 { 208 {
182 gfx::Transform transform; 209 gfx::Transform transform;
183 transform.matrix() = matrix; 210 transform.matrix() = matrix;
184 m_layer->setTransform(transform); 211 m_layer->setTransform(transform);
185 } 212 }
186 213
187 void WebLayerImpl::setTransform(const WebTransformationMatrix& matrix) 214 void WebLayerImpl::setTransform(const WebTransformationMatrix& matrix)
188 { 215 {
189 m_layer->setTransform(matrix.toTransform()); 216 m_layer->setTransform(convertWebTransformationMatrixToTransform(matrix));
190 } 217 }
191 218
192 SkMatrix44 WebLayerImpl::transform() const 219 SkMatrix44 WebLayerImpl::transform() const
193 { 220 {
194 return m_layer->transform().matrix(); 221 return m_layer->transform().matrix();
195 } 222 }
196 223
197 void WebLayerImpl::setDrawsContent(bool drawsContent) 224 void WebLayerImpl::setDrawsContent(bool drawsContent)
198 { 225 {
199 m_layer->setIsDrawable(drawsContent); 226 m_layer->setIsDrawable(drawsContent);
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 { 444 {
418 m_layer->setLayerScrollClient(scrollClient); 445 m_layer->setLayerScrollClient(scrollClient);
419 } 446 }
420 447
421 Layer* WebLayerImpl::layer() const 448 Layer* WebLayerImpl::layer() const
422 { 449 {
423 return m_layer.get(); 450 return m_layer.get();
424 } 451 }
425 452
426 } // namespace WebKit 453 } // namespace WebKit
OLDNEW
« no previous file with comments | « cc/layer_animation_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698