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

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

Issue 1703943003: add interp path (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add test to error if conics don't match Created 4 years, 10 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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 SkTSwap<uint8_t>(fFillType, that.fFillType); 186 SkTSwap<uint8_t>(fFillType, that.fFillType);
187 SkTSwap<uint8_t>(fConvexity, that.fConvexity); 187 SkTSwap<uint8_t>(fConvexity, that.fConvexity);
188 // Simulate SkTSwap<uint8_t>(fFirstDirection, that.fFirstDirection); 188 // Simulate SkTSwap<uint8_t>(fFirstDirection, that.fFirstDirection);
189 uint8_t temp = fFirstDirection; 189 uint8_t temp = fFirstDirection;
190 fFirstDirection.store(that.fFirstDirection.load()); 190 fFirstDirection.store(that.fFirstDirection.load());
191 that.fFirstDirection.store(temp); 191 that.fFirstDirection.store(temp);
192 SkTSwap<SkBool8>(fIsVolatile, that.fIsVolatile); 192 SkTSwap<SkBool8>(fIsVolatile, that.fIsVolatile);
193 } 193 }
194 } 194 }
195 195
196 bool SkPath::isInterpolatable(const SkPath& compare) const {
197 int count = fPathRef->countVerbs();
198 if (count != compare.fPathRef->countVerbs()) {
199 return false;
200 }
201 if (!count) {
202 return true;
203 }
204 if (memcmp(fPathRef->verbsMemBegin(), compare.fPathRef->verbsMemBegin(),
205 count)) {
206 return false;
207 }
208 return !SkToBool(memcmp(fPathRef->conicWeights(), compare.fPathRef->conicWei ghts(),
209 fPathRef->countWeights() * sizeof(*fPathRef->conicWeights())));
210 }
211
212 bool SkPath::interpolate(const SkPath& ending, SkScalar weight, SkPath* out) con st {
213 int verbCount = fPathRef->countVerbs();
214 if (verbCount != ending.fPathRef->countVerbs()) {
215 return false;
216 }
217 out->reset();
218 out->addPath(*this);
219 fPathRef->interpolate(*ending.fPathRef, weight, out->fPathRef);
220 return true;
221 }
222
196 static inline bool check_edge_against_rect(const SkPoint& p0, 223 static inline bool check_edge_against_rect(const SkPoint& p0,
197 const SkPoint& p1, 224 const SkPoint& p1,
198 const SkRect& rect, 225 const SkRect& rect,
199 SkPathPriv::FirstDirection dir) { 226 SkPathPriv::FirstDirection dir) {
200 const SkPoint* edgeBegin; 227 const SkPoint* edgeBegin;
201 SkVector v; 228 SkVector v;
202 if (SkPathPriv::kCW_FirstDirection == dir) { 229 if (SkPathPriv::kCW_FirstDirection == dir) {
203 v = p1 - p0; 230 v = p1 - p0;
204 edgeBegin = &p0; 231 edgeBegin = &p0;
205 } else { 232 } else {
(...skipping 2969 matching lines...) Expand 10 before | Expand all | Expand 10 after
3175 } 3202 }
3176 } while (!done); 3203 } while (!done);
3177 return SkToBool(tangents.count()) ^ isInverse; 3204 return SkToBool(tangents.count()) ^ isInverse;
3178 } 3205 }
3179 3206
3180 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo int& p2, 3207 int SkPath::ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPo int& p2,
3181 SkScalar w, SkPoint pts[], int pow2) { 3208 SkScalar w, SkPoint pts[], int pow2) {
3182 const SkConic conic(p0, p1, p2, w); 3209 const SkConic conic(p0, p1, p2, w);
3183 return conic.chopIntoQuadsPOW2(pts, pow2); 3210 return conic.chopIntoQuadsPOW2(pts, pow2);
3184 } 3211 }
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