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

Side by Side Diff: src/core/SkEdge.h

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 2006 The Android Open Source Project 3 * Copyright 2006 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 #ifndef SkEdge_DEFINED 10 #ifndef SkEdge_DEFINED
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 SkFixed fCLastX, fCLastY; 82 SkFixed fCLastX, fCLastY;
83 83
84 int setCubic(const SkPoint pts[4], const SkIRect* clip, int shiftUp); 84 int setCubic(const SkPoint pts[4], const SkIRect* clip, int shiftUp);
85 int updateCubic(); 85 int updateCubic();
86 }; 86 };
87 87
88 int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, int shift) { 88 int SkEdge::setLine(const SkPoint& p0, const SkPoint& p1, int shift) {
89 SkFDot6 x0, y0, x1, y1; 89 SkFDot6 x0, y0, x1, y1;
90 90
91 { 91 {
92 #ifdef SK_SCALAR_IS_FLOAT
93 float scale = float(1 << (shift + 6)); 92 float scale = float(1 << (shift + 6));
94 x0 = int(p0.fX * scale); 93 x0 = int(p0.fX * scale);
95 y0 = int(p0.fY * scale); 94 y0 = int(p0.fY * scale);
96 x1 = int(p1.fX * scale); 95 x1 = int(p1.fX * scale);
97 y1 = int(p1.fY * scale); 96 y1 = int(p1.fY * scale);
98 #else
99 shift = 10 - shift;
100 x0 = p0.fX >> shift;
101 y0 = p0.fY >> shift;
102 x1 = p1.fX >> shift;
103 y1 = p1.fY >> shift;
104 #endif
105 } 97 }
106 98
107 int winding = 1; 99 int winding = 1;
108 100
109 if (y0 > y1) { 101 if (y0 > y1) {
110 SkTSwap(x0, x1); 102 SkTSwap(x0, x1);
111 SkTSwap(y0, y1); 103 SkTSwap(y0, y1);
112 winding = -1; 104 winding = -1;
113 } 105 }
114 106
(...skipping 13 matching lines...) Expand all
128 fFirstY = top; 120 fFirstY = top;
129 fLastY = bot - 1; 121 fLastY = bot - 1;
130 fCurveCount = 0; 122 fCurveCount = 0;
131 fWinding = SkToS8(winding); 123 fWinding = SkToS8(winding);
132 fCurveShift = 0; 124 fCurveShift = 0;
133 return 1; 125 return 1;
134 } 126 }
135 127
136 128
137 #endif 129 #endif
OLDNEW
« src/core/SkCanvas.cpp ('K') | « src/core/SkCubicClipper.cpp ('k') | src/core/SkEdge.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698