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

Side by Side Diff: src/core/SkGeometry.cpp

Issue 455043002: use conics (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: address comments Created 6 years 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
« no previous file with comments | « src/core/SkGeometry.h ('k') | src/core/SkPath.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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkGeometry.h" 8 #include "SkGeometry.h"
9 #include "SkMatrix.h" 9 #include "SkMatrix.h"
10 10
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 } 1528 }
1529 1529
1530 void SkConic::computeFastBounds(SkRect* bounds) const { 1530 void SkConic::computeFastBounds(SkRect* bounds) const {
1531 bounds->set(fPts, 3); 1531 bounds->set(fPts, 3);
1532 } 1532 }
1533 1533
1534 bool SkConic::findMaxCurvature(SkScalar* t) const { 1534 bool SkConic::findMaxCurvature(SkScalar* t) const {
1535 // TODO: Implement me 1535 // TODO: Implement me
1536 return false; 1536 return false;
1537 } 1537 }
1538
1539 SkScalar SkConic::TransformW(const SkPoint pts[], SkScalar w,
1540 const SkMatrix& matrix) {
1541 if (!matrix.hasPerspective()) {
1542 return w;
1543 }
1544
1545 SkP3D src[3], dst[3];
1546
1547 ratquad_mapTo3D(pts, w, src);
1548
1549 matrix.mapHomogeneousPoints(&dst[0].fX, &src[0].fX, 3);
1550
1551 // w' = sqrt(w1*w1/w0*w2)
1552 SkScalar w0 = dst[0].fZ;
1553 SkScalar w1 = dst[1].fZ;
1554 SkScalar w2 = dst[2].fZ;
1555 w = SkScalarSqrt((w1 * w1) / (w0 * w2));
1556 return w;
1557 }
OLDNEW
« no previous file with comments | « src/core/SkGeometry.h ('k') | src/core/SkPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698