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

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

Issue 117053002: remove SK_SCALAR_IS_[FLOAT,FIXED] and assume floats (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | Annotate | Revision Log
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 since they are in our 2-bit field 15 // these must be 0,1,2 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 }; 20 };
21 21
22 #define kMaxTValue 32767 22 #define kMaxTValue 32767
23 23
24 static inline SkScalar tValue2Scalar(int t) { 24 static inline SkScalar tValue2Scalar(int t) {
25 SkASSERT((unsigned)t <= kMaxTValue); 25 SkASSERT((unsigned)t <= kMaxTValue);
26
27 #ifdef SK_SCALAR_IS_FLOAT
28 return t * 3.05185e-5f; // t / 32767 26 return t * 3.05185e-5f; // t / 32767
29 #else
30 return (t + (t >> 14)) << 1;
31 #endif
32 } 27 }
33 28
34 SkScalar SkPathMeasure::Segment::getScalarT() const { 29 SkScalar SkPathMeasure::Segment::getScalarT() const {
35 return tValue2Scalar(fTValue); 30 return tValue2Scalar(fTValue);
36 } 31 }
37 32
38 const SkPathMeasure::Segment* SkPathMeasure::NextSegment(const Segment* seg) { 33 const SkPathMeasure::Segment* SkPathMeasure::NextSegment(const Segment* seg) {
39 unsigned ptIndex = seg->fPtIndex; 34 unsigned ptIndex = seg->fPtIndex;
40 35
41 do { 36 do {
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 528
534 for (int i = 0; i < fSegments.count(); i++) { 529 for (int i = 0; i < fSegments.count(); i++) {
535 const Segment* seg = &fSegments[i]; 530 const Segment* seg = &fSegments[i];
536 SkDebugf("pathmeas: seg[%d] distance=%g, point=%d, t=%g, type=%d\n", 531 SkDebugf("pathmeas: seg[%d] distance=%g, point=%d, t=%g, type=%d\n",
537 i, seg->fDistance, seg->fPtIndex, seg->getScalarT(), 532 i, seg->fDistance, seg->fPtIndex, seg->getScalarT(),
538 seg->fType); 533 seg->fType);
539 } 534 }
540 } 535 }
541 536
542 #endif 537 #endif
OLDNEW
« src/core/SkCanvas.cpp ('K') | « src/core/SkPaint.cpp ('k') | src/core/SkPicture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698