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

Side by Side Diff: Source/platform/transforms/TransformationMatrix.cpp

Issue 25494003: Move geometry classes from core/platform/graphics to platform/geometry (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 2 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 | « Source/platform/transforms/TransformationMatrix.h ('k') | Source/web/ChromeClientImpl.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved. 2 * Copyright (C) 2005, 2006 Apple Computer, Inc. All rights reserved.
3 * Copyright (C) 2009 Torch Mobile, Inc. 3 * Copyright (C) 2009 Torch Mobile, Inc.
4 * Copyright (C) 2013 Google Inc. All rights reserved. 4 * Copyright (C) 2013 Google Inc. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
15 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY 15 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR 18 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 19 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 20 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 22 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28 #include "config.h" 28 #include "config.h"
29 #include "core/platform/graphics/transforms/TransformationMatrix.h" 29 #include "platform/transforms/TransformationMatrix.h"
30 30
31 #include "core/platform/graphics/FloatQuad.h" 31 #include "platform/geometry/FloatQuad.h"
32 #include "core/platform/graphics/FloatRect.h" 32 #include "platform/geometry/FloatRect.h"
33 #include "core/platform/graphics/IntRect.h" 33 #include "platform/geometry/IntRect.h"
34 #include "core/platform/graphics/LayoutRect.h" 34 #include "platform/geometry/LayoutRect.h"
35 #include "core/platform/graphics/skia/SkiaUtils.h" 35 #include "platform/transforms/AffineTransform.h"
36 #include "core/platform/graphics/transforms/AffineTransform.h"
37 36
38 #include "wtf/Assertions.h" 37 #include "wtf/Assertions.h"
39 #include "wtf/MathExtras.h" 38 #include "wtf/MathExtras.h"
40 39
41 #if CPU(X86_64) 40 #if CPU(X86_64)
42 #include <emmintrin.h> 41 #include <emmintrin.h>
43 #endif 42 #endif
44 43
45 using namespace std; 44 using namespace std;
46 45
(...skipping 1274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1321 m_matrix[3][2] = 0; 1320 m_matrix[3][2] = 0;
1322 m_matrix[3][3] = 1; 1321 m_matrix[3][3] = 1;
1323 } 1322 }
1324 1323
1325 AffineTransform TransformationMatrix::toAffineTransform() const 1324 AffineTransform TransformationMatrix::toAffineTransform() const
1326 { 1325 {
1327 return AffineTransform(m_matrix[0][0], m_matrix[0][1], m_matrix[1][0], 1326 return AffineTransform(m_matrix[0][0], m_matrix[0][1], m_matrix[1][0],
1328 m_matrix[1][1], m_matrix[3][0], m_matrix[3][1]); 1327 m_matrix[1][1], m_matrix[3][0], m_matrix[3][1]);
1329 } 1328 }
1330 1329
1330 static inline SkScalar WebCoreDoubleToSkScalar(double d)
1331 {
1332 return SkDoubleToScalar(std::isfinite(d) ? d : 0);
1333 }
1334
1331 TransformationMatrix::operator SkMatrix() const 1335 TransformationMatrix::operator SkMatrix() const
1332 { 1336 {
1333 SkMatrix result; 1337 SkMatrix result;
1334 1338
1335 result.setScaleX(WebCoreDoubleToSkScalar(a())); 1339 result.setScaleX(WebCoreDoubleToSkScalar(a()));
1336 result.setSkewX(WebCoreDoubleToSkScalar(c())); 1340 result.setSkewX(WebCoreDoubleToSkScalar(c()));
1337 result.setTranslateX(WebCoreDoubleToSkScalar(e())); 1341 result.setTranslateX(WebCoreDoubleToSkScalar(e()));
1338 1342
1339 result.setScaleY(WebCoreDoubleToSkScalar(d())); 1343 result.setScaleY(WebCoreDoubleToSkScalar(d()));
1340 result.setSkewY(WebCoreDoubleToSkScalar(b())); 1344 result.setSkewY(WebCoreDoubleToSkScalar(b()));
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 if (fabs(determinant) < SMALL_NUMBER) 1526 if (fabs(determinant) < SMALL_NUMBER)
1523 return false; 1527 return false;
1524 1528
1525 double cofactor33 = determinant3x3(m11(), m12(), m14(), m21(), m22(), m24(), m41(), m42(), m44()); 1529 double cofactor33 = determinant3x3(m11(), m12(), m14(), m21(), m22(), m24(), m41(), m42(), m44());
1526 double zComponentOfTransformedNormal = cofactor33 / determinant; 1530 double zComponentOfTransformedNormal = cofactor33 / determinant;
1527 1531
1528 return zComponentOfTransformedNormal < 0; 1532 return zComponentOfTransformedNormal < 0;
1529 } 1533 }
1530 1534
1531 } 1535 }
OLDNEW
« no previous file with comments | « Source/platform/transforms/TransformationMatrix.h ('k') | Source/web/ChromeClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698