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

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

Issue 544233002: "NULL !=" = NULL (Closed) Base URL: https://skia.googlesource.com/skia.git@are
Patch Set: rebase Created 6 years, 3 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
« no previous file with comments | « src/core/SkPictureStateTree.cpp ('k') | src/core/SkRTree.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 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkMathPriv.h" 10 #include "SkMathPriv.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 217
218 SkScalar SkPoint::distanceToLineBetweenSqd(const SkPoint& a, 218 SkScalar SkPoint::distanceToLineBetweenSqd(const SkPoint& a,
219 const SkPoint& b, 219 const SkPoint& b,
220 Side* side) const { 220 Side* side) const {
221 221
222 SkVector u = b - a; 222 SkVector u = b - a;
223 SkVector v = *this - a; 223 SkVector v = *this - a;
224 224
225 SkScalar uLengthSqd = u.lengthSqd(); 225 SkScalar uLengthSqd = u.lengthSqd();
226 SkScalar det = u.cross(v); 226 SkScalar det = u.cross(v);
227 if (NULL != side) { 227 if (side) {
228 SkASSERT(-1 == SkPoint::kLeft_Side && 228 SkASSERT(-1 == SkPoint::kLeft_Side &&
229 0 == SkPoint::kOn_Side && 229 0 == SkPoint::kOn_Side &&
230 1 == kRight_Side); 230 1 == kRight_Side);
231 *side = (Side) SkScalarSignAsInt(det); 231 *side = (Side) SkScalarSignAsInt(det);
232 } 232 }
233 return SkScalarMulDiv(det, det, uLengthSqd); 233 return SkScalarMulDiv(det, det, uLengthSqd);
234 } 234 }
235 235
236 SkScalar SkPoint::distanceToLineSegmentBetweenSqd(const SkPoint& a, 236 SkScalar SkPoint::distanceToLineSegmentBetweenSqd(const SkPoint& a,
237 const SkPoint& b) const { 237 const SkPoint& b) const {
(...skipping 21 matching lines...) Expand all
259 259
260 if (uDotV <= 0) { 260 if (uDotV <= 0) {
261 return v.lengthSqd(); 261 return v.lengthSqd();
262 } else if (uDotV > uLengthSqd) { 262 } else if (uDotV > uLengthSqd) {
263 return b.distanceToSqd(*this); 263 return b.distanceToSqd(*this);
264 } else { 264 } else {
265 SkScalar det = u.cross(v); 265 SkScalar det = u.cross(v);
266 return SkScalarMulDiv(det, det, uLengthSqd); 266 return SkScalarMulDiv(det, det, uLengthSqd);
267 } 267 }
268 } 268 }
OLDNEW
« no previous file with comments | « src/core/SkPictureStateTree.cpp ('k') | src/core/SkRTree.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698