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

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

Issue 1534223002: fix large dashed paths (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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/SkPathMeasure.h ('k') | no next file » | 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 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkPathMeasure.h" 10 #include "SkPathMeasure.h"
11 #include "SkGeometry.h" 11 #include "SkGeometry.h"
12 #include "SkPath.h" 12 #include "SkPath.h"
13 #include "SkTSearch.h" 13 #include "SkTSearch.h"
14 14
15 // these must be 0,1,2,3 since they are in our 2-bit field 15 // these must be 0,1,2,3 since they are in our 2-bit field
16 enum { 16 enum {
17 kLine_SegType, 17 kLine_SegType,
18 kQuad_SegType, 18 kQuad_SegType,
19 kCubic_SegType, 19 kCubic_SegType,
20 kConic_SegType, 20 kConic_SegType,
21 }; 21 };
22 22
23 #ifdef SK_SUPPORT_LEGACY_PATH_MEASURE_TVALUE
23 #define kMaxTValue 32767 24 #define kMaxTValue 32767
25 #else
26 #define kMaxTValue 0x3FFFFFFF
27 #endif
24 28
25 static inline SkScalar tValue2Scalar(int t) { 29 static inline SkScalar tValue2Scalar(int t) {
26 SkASSERT((unsigned)t <= kMaxTValue); 30 SkASSERT((unsigned)t <= kMaxTValue);
31 #ifdef SK_SUPPORT_LEGACY_PATH_MEASURE_TVALUE
27 return t * 3.05185e-5f; // t / 32767 32 return t * 3.05185e-5f; // t / 32767
33 #else
34 const SkScalar kMaxTReciprocal = 1.0f / kMaxTValue;
35 return t * kMaxTReciprocal;
36 #endif
28 } 37 }
29 38
30 SkScalar SkPathMeasure::Segment::getScalarT() const { 39 SkScalar SkPathMeasure::Segment::getScalarT() const {
31 return tValue2Scalar(fTValue); 40 return tValue2Scalar(fTValue);
32 } 41 }
33 42
34 const SkPathMeasure::Segment* SkPathMeasure::NextSegment(const Segment* seg) { 43 const SkPathMeasure::Segment* SkPathMeasure::NextSegment(const Segment* seg) {
35 unsigned ptIndex = seg->fPtIndex; 44 unsigned ptIndex = seg->fPtIndex;
36 45
37 do { 46 do {
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 633
625 for (int i = 0; i < fSegments.count(); i++) { 634 for (int i = 0; i < fSegments.count(); i++) {
626 const Segment* seg = &fSegments[i]; 635 const Segment* seg = &fSegments[i];
627 SkDebugf("pathmeas: seg[%d] distance=%g, point=%d, t=%g, type=%d\n", 636 SkDebugf("pathmeas: seg[%d] distance=%g, point=%d, t=%g, type=%d\n",
628 i, seg->fDistance, seg->fPtIndex, seg->getScalarT(), 637 i, seg->fDistance, seg->fPtIndex, seg->getScalarT(),
629 seg->fType); 638 seg->fType);
630 } 639 }
631 } 640 }
632 641
633 #endif 642 #endif
OLDNEW
« no previous file with comments | « include/core/SkPathMeasure.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698