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

Unified Diff: src/core/SkPath.cpp

Issue 1461763004: add SkPath::isRRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: incorporated Rob's comments Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkPathRef.h ('k') | src/core/SkPathRef.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPath.cpp
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index a3f5e13d7fa924f29a639ecc9fd6d10fff64a21c..2d4976a82acef77e3b08823e359f087d3f21ddb2 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1072,6 +1072,7 @@ void SkPath::addRRect(const SkRRect &rrect, Direction dir, unsigned startIndex)
return;
}
+ bool isRRect = hasOnlyMoveTos();
const SkRect& bounds = rrect.getBounds();
if (rrect.isRect()) {
@@ -1119,6 +1120,9 @@ void SkPath::addRRect(const SkRRect &rrect, Direction dir, unsigned startIndex)
}
this->close();
+ SkPathRef::Editor ed(&fPathRef);
+ ed.setIsRRect(isRRect);
+
SkASSERT(this->countVerbs() == initialVerbCount + kVerbs);
}
@@ -1861,75 +1865,6 @@ SkPath::Verb SkPath::Iter::doNext(SkPoint ptsParam[4]) {
///////////////////////////////////////////////////////////////////////////////
-SkPath::RawIter::RawIter() {
-#ifdef SK_DEBUG
- fPts = nullptr;
- fConicWeights = nullptr;
-#endif
- // need to init enough to make next() harmlessly return kDone_Verb
- fVerbs = nullptr;
- fVerbStop = nullptr;
-}
-
-SkPath::RawIter::RawIter(const SkPath& path) {
- this->setPath(path);
-}
-
-void SkPath::RawIter::setPath(const SkPath& path) {
- fPts = path.fPathRef->points();
- fVerbs = path.fPathRef->verbs();
- fVerbStop = path.fPathRef->verbsMemBegin();
- fConicWeights = path.fPathRef->conicWeights() - 1; // begin one behind
-}
-
-SkPath::Verb SkPath::RawIter::next(SkPoint pts[4]) {
- SkASSERT(pts);
- if (fVerbs == fVerbStop) {
- return kDone_Verb;
- }
-
- // fVerbs points one beyond next verb so decrement first.
- unsigned verb = *(--fVerbs);
- const SkPoint* srcPts = fPts;
-
- switch (verb) {
- case kMove_Verb:
- pts[0] = srcPts[0];
- srcPts += 1;
- break;
- case kLine_Verb:
- pts[0] = srcPts[-1];
- pts[1] = srcPts[0];
- srcPts += 1;
- break;
- case kConic_Verb:
- fConicWeights += 1;
- // fall-through
- case kQuad_Verb:
- pts[0] = srcPts[-1];
- pts[1] = srcPts[0];
- pts[2] = srcPts[1];
- srcPts += 2;
- break;
- case kCubic_Verb:
- pts[0] = srcPts[-1];
- pts[1] = srcPts[0];
- pts[2] = srcPts[1];
- pts[3] = srcPts[2];
- srcPts += 3;
- break;
- case kClose_Verb:
- break;
- case kDone_Verb:
- SkASSERT(fVerbs == fVerbStop);
- break;
- }
- fPts = srcPts;
- return (Verb)verb;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
/*
Format in compressed buffer: [ptCount, verbCount, pts[], verbs[]]
*/
« no previous file with comments | « include/core/SkPathRef.h ('k') | src/core/SkPathRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698