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

Side by Side Diff: src/core/SkPathRef.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 | « src/core/SkPath.cpp ('k') | tests/PathTest.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 2013 Google Inc. 2 * Copyright 2013 Google Inc.
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 "SkOncePtr.h" 9 #include "SkOncePtr.h"
10 #include "SkPath.h" 10 #include "SkPath.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 if (!fBoundsIsDirty) { 292 if (!fBoundsIsDirty) {
293 fBounds = ref.fBounds; 293 fBounds = ref.fBounds;
294 fIsFinite = ref.fIsFinite; 294 fIsFinite = ref.fIsFinite;
295 } 295 }
296 fSegmentMask = ref.fSegmentMask; 296 fSegmentMask = ref.fSegmentMask;
297 fIsOval = ref.fIsOval; 297 fIsOval = ref.fIsOval;
298 fIsRRect = ref.fIsRRect; 298 fIsRRect = ref.fIsRRect;
299 SkDEBUGCODE(this->validate();) 299 SkDEBUGCODE(this->validate();)
300 } 300 }
301 301
302
303 void SkPathRef::interpolate(const SkPathRef& ending, SkScalar weight, SkPathRef* out) const {
304 const SkScalar* inValues = &ending.getPoints()->fX;
305 SkScalar* outValues = &out->getPoints()->fX;
306 int count = out->countPoints() * 2;
307 for (int index = 0; index < count; ++index) {
308 outValues[index] = outValues[index] * weight + inValues[index] * (1 - we ight);
309 }
310 out->fBoundsIsDirty = true;
311 out->fIsOval = false;
312 out->fIsRRect = false;
313 }
314
302 SkPoint* SkPathRef::growForRepeatedVerb(int /*SkPath::Verb*/ verb, 315 SkPoint* SkPathRef::growForRepeatedVerb(int /*SkPath::Verb*/ verb,
303 int numVbs, 316 int numVbs,
304 SkScalar** weights) { 317 SkScalar** weights) {
305 // This value is just made-up for now. When count is 4, calling memset was m uch 318 // This value is just made-up for now. When count is 4, calling memset was m uch
306 // slower than just writing the loop. This seems odd, and hopefully in the 319 // slower than just writing the loop. This seems odd, and hopefully in the
307 // future this will appear to have been a fluke... 320 // future this will appear to have been a fluke...
308 static const unsigned int kMIN_COUNT_FOR_MEMSET_TO_BE_FAST = 16; 321 static const unsigned int kMIN_COUNT_FOR_MEMSET_TO_BE_FAST = 16;
309 322
310 SkDEBUGCODE(this->validate();) 323 SkDEBUGCODE(this->validate();)
311 int pCnt; 324 int pCnt;
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 break; 667 break;
655 default: 668 default:
656 SkDEBUGFAIL("Unknown Verb"); 669 SkDEBUGFAIL("Unknown Verb");
657 break; 670 break;
658 } 671 }
659 } 672 }
660 SkASSERT(mask == fSegmentMask); 673 SkASSERT(mask == fSegmentMask);
661 #endif // SK_DEBUG_PATH 674 #endif // SK_DEBUG_PATH
662 } 675 }
663 #endif 676 #endif
OLDNEW
« no previous file with comments | « src/core/SkPath.cpp ('k') | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698