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

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

Issue 2006383002: preserve rrect/oval dir (Closed) Base URL: https://chromium.googlesource.com/skia.git@SkTypes
Patch Set: Improve tests Created 4 years, 6 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 | « include/core/SkPathRef.h ('k') | src/core/SkPathRef.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 "SkBuffer.h" 8 #include "SkBuffer.h"
9 #include "SkCubicClipper.h" 9 #include "SkCubicClipper.h"
10 #include "SkErrorInternals.h" 10 #include "SkErrorInternals.h"
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 // final lineTo handled by close(). 1154 // final lineTo handled by close().
1155 } else { 1155 } else {
1156 for (unsigned i = 0; i < 4; ++i) { 1156 for (unsigned i = 0; i < 4; ++i) {
1157 this->lineTo(rrectIter.next()); 1157 this->lineTo(rrectIter.next());
1158 this->conicTo(rectIter.next(), rrectIter.next(), weight); 1158 this->conicTo(rectIter.next(), rrectIter.next(), weight);
1159 } 1159 }
1160 } 1160 }
1161 this->close(); 1161 this->close();
1162 1162
1163 SkPathRef::Editor ed(&fPathRef); 1163 SkPathRef::Editor ed(&fPathRef);
1164 ed.setIsRRect(isRRect); 1164 ed.setIsRRect(isRRect, dir, startIndex);
1165 1165
1166 SkASSERT(this->countVerbs() == initialVerbCount + kVerbs); 1166 SkASSERT(this->countVerbs() == initialVerbCount + kVerbs);
1167 } 1167 }
1168 1168
1169 SkDEBUGCODE(fPathRef->validate();) 1169 SkDEBUGCODE(fPathRef->validate();)
1170 } 1170 }
1171 1171
1172 bool SkPath::hasOnlyMoveTos() const { 1172 bool SkPath::hasOnlyMoveTos() const {
1173 int count = fPathRef->countVerbs(); 1173 int count = fPathRef->countVerbs();
1174 const uint8_t* verbs = const_cast<const SkPathRef*>(fPathRef.get())->verbsMe mBegin(); 1174 const uint8_t* verbs = const_cast<const SkPathRef*>(fPathRef.get())->verbsMe mBegin();
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 this->moveTo(ovalIter.current()); 1252 this->moveTo(ovalIter.current());
1253 for (unsigned i = 0; i < 4; ++i) { 1253 for (unsigned i = 0; i < 4; ++i) {
1254 this->conicTo(rectIter.next(), ovalIter.next(), weight); 1254 this->conicTo(rectIter.next(), ovalIter.next(), weight);
1255 } 1255 }
1256 this->close(); 1256 this->close();
1257 1257
1258 SkASSERT(this->countVerbs() == initialVerbCount + kVerbs); 1258 SkASSERT(this->countVerbs() == initialVerbCount + kVerbs);
1259 1259
1260 SkPathRef::Editor ed(&fPathRef); 1260 SkPathRef::Editor ed(&fPathRef);
1261 1261
1262 ed.setIsOval(isOval); 1262 ed.setIsOval(isOval, kCCW_Direction == dir, startPointIndex);
1263 } 1263 }
1264 1264
1265 void SkPath::addCircle(SkScalar x, SkScalar y, SkScalar r, Direction dir) { 1265 void SkPath::addCircle(SkScalar x, SkScalar y, SkScalar r, Direction dir) {
1266 if (r > 0) { 1266 if (r > 0) {
1267 this->addOval(SkRect::MakeLTRB(x - r, y - r, x + r, y + r), dir); 1267 this->addOval(SkRect::MakeLTRB(x - r, y - r, x + r, y + r), dir);
1268 } 1268 }
1269 } 1269 }
1270 1270
1271 void SkPath::arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, 1271 void SkPath::arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle,
1272 bool forceMoveTo) { 1272 bool forceMoveTo) {
(...skipping 1953 matching lines...) Expand 10 before | Expand all | Expand 10 after
3226 } 3226 }
3227 } while (!done); 3227 } while (!done);
3228 return SkToBool(tangents.count()) ^ isInverse; 3228 return SkToBool(tangents.count()) ^ isInverse;
3229 } 3229 }
3230 3230
3231 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo int& p2, 3231 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo int& p2,
3232 SkScalar w, SkPoint pts[], int pow2) { 3232 SkScalar w, SkPoint pts[], int pow2) {
3233 const SkConic conic(p0, p1, p2, w); 3233 const SkConic conic(p0, p1, p2, w);
3234 return conic.chopIntoQuadsPOW2(pts, pow2); 3234 return conic.chopIntoQuadsPOW2(pts, pow2);
3235 } 3235 }
OLDNEW
« 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