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

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

Issue 1601103006: Add SkPath::isLastContourClosed() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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
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 "SkBuffer.h" 8 #include "SkBuffer.h"
9 #include "SkCubicClipper.h" 9 #include "SkCubicClipper.h"
10 #include "SkErrorInternals.h" 10 #include "SkErrorInternals.h"
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 this->resetFields(); 311 this->resetFields();
312 } 312 }
313 313
314 void SkPath::rewind() { 314 void SkPath::rewind() {
315 SkDEBUGCODE(this->validate();) 315 SkDEBUGCODE(this->validate();)
316 316
317 SkPathRef::Rewind(&fPathRef); 317 SkPathRef::Rewind(&fPathRef);
318 this->resetFields(); 318 this->resetFields();
319 } 319 }
320 320
321 bool SkPath::isClosed() const {
322 int verbCount = fPathRef->countVerbs();
323 if (0 == verbCount)
reed1 2016/01/20 16:41:41 nit: skia always uses { } if (0 == verbCount) {
fs 2016/01/20 17:24:43 Done.
324 return false;
325 return kClose_Verb == fPathRef->atVerb(verbCount - 1);
326 }
327
321 bool SkPath::isLine(SkPoint line[2]) const { 328 bool SkPath::isLine(SkPoint line[2]) const {
322 int verbCount = fPathRef->countVerbs(); 329 int verbCount = fPathRef->countVerbs();
323 330
324 if (2 == verbCount) { 331 if (2 == verbCount) {
325 SkASSERT(kMove_Verb == fPathRef->atVerb(0)); 332 SkASSERT(kMove_Verb == fPathRef->atVerb(0));
326 if (kLine_Verb == fPathRef->atVerb(1)) { 333 if (kLine_Verb == fPathRef->atVerb(1)) {
327 SkASSERT(2 == fPathRef->countPoints()); 334 SkASSERT(2 == fPathRef->countPoints());
328 if (line) { 335 if (line) {
329 const SkPoint* pts = fPathRef->points(); 336 const SkPoint* pts = fPathRef->points();
330 line[0] = pts[0]; 337 line[0] = pts[0];
(...skipping 2753 matching lines...) Expand 10 before | Expand all | Expand 10 after
3084 } 3091 }
3085 } while (!done); 3092 } while (!done);
3086 return SkToBool(tangents.count()) ^ isInverse; 3093 return SkToBool(tangents.count()) ^ isInverse;
3087 } 3094 }
3088 3095
3089 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo int& p2, 3096 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo int& p2,
3090 SkScalar w, SkPoint pts[], int pow2) { 3097 SkScalar w, SkPoint pts[], int pow2) {
3091 const SkConic conic(p0, p1, p2, w); 3098 const SkConic conic(p0, p1, p2, w);
3092 return conic.chopIntoQuadsPOW2(pts, pow2); 3099 return conic.chopIntoQuadsPOW2(pts, pow2);
3093 } 3100 }
OLDNEW
« include/core/SkPath.h ('K') | « include/core/SkPath.h ('k') | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698