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

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

Issue 12772003: Removed unused parameters (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « src/core/SkPtrRecorder.h ('k') | src/gpu/effects/GrEllipseEdgeEffect.h » ('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 /* 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 #include "SkScan.h" 10 #include "SkScan.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 blitter->blitRect(r.fLeft, r.fTop + 1, 1, height - 2); // left 186 blitter->blitRect(r.fLeft, r.fTop + 1, 1, height - 2); // left
187 blitter->blitRect(r.fRight - 1, r.fTop + 1, 1, height - 2); // right 187 blitter->blitRect(r.fRight - 1, r.fTop + 1, 1, height - 2); // right
188 blitter->blitH(r.fLeft, r.fBottom - 1, width); // bottom 188 blitter->blitH(r.fLeft, r.fBottom - 1, width); // bottom
189 } 189 }
190 190
191 /////////////////////////////////////////////////////////////////////////////// 191 ///////////////////////////////////////////////////////////////////////////////
192 192
193 #include "SkPath.h" 193 #include "SkPath.h"
194 #include "SkGeometry.h" 194 #include "SkGeometry.h"
195 195
196 static bool quad_too_curvy(const SkPoint pts[3]) {
197 return true;
198 }
199
200 static int compute_int_quad_dist(const SkPoint pts[3]) { 196 static int compute_int_quad_dist(const SkPoint pts[3]) {
201 // compute the vector between the control point ([1]) and the middle of the 197 // compute the vector between the control point ([1]) and the middle of the
202 // line connecting the start and end ([0] and [2]) 198 // line connecting the start and end ([0] and [2])
203 SkScalar dx = SkScalarHalf(pts[0].fX + pts[2].fX) - pts[1].fX; 199 SkScalar dx = SkScalarHalf(pts[0].fX + pts[2].fX) - pts[1].fX;
204 SkScalar dy = SkScalarHalf(pts[0].fY + pts[2].fY) - pts[1].fY; 200 SkScalar dy = SkScalarHalf(pts[0].fY + pts[2].fY) - pts[1].fY;
205 // we want everyone to be positive 201 // we want everyone to be positive
206 dx = SkScalarAbs(dx); 202 dx = SkScalarAbs(dx);
207 dy = SkScalarAbs(dy); 203 dy = SkScalarAbs(dy);
208 // convert to whole pixel values (use ceiling to be conservative) 204 // convert to whole pixel values (use ceiling to be conservative)
209 int idx = SkScalarCeil(dx); 205 int idx = SkScalarCeil(dx);
210 int idy = SkScalarCeil(dy); 206 int idy = SkScalarCeil(dy);
211 // use the cheap approx for distance 207 // use the cheap approx for distance
212 if (idx > idy) { 208 if (idx > idy) {
213 return idx + (idy >> 1); 209 return idx + (idy >> 1);
214 } else { 210 } else {
215 return idy + (idx >> 1); 211 return idy + (idx >> 1);
216 } 212 }
217 } 213 }
218 214
219 static void hairquad(const SkPoint pts[3], const SkRegion* clip, SkBlitter* blit ter, int level, 215 static void hairquad(const SkPoint pts[3], const SkRegion* clip, SkBlitter* blit ter, int level,
220 void (*lineproc)(const SkPoint&, const SkPoint&, const SkRe gion* clip, SkBlitter*)) 216 void (*lineproc)(const SkPoint&, const SkPoint&, const SkRe gion* clip, SkBlitter*))
221 { 217 {
222 #if 1 218 #if 1
223 if (level > 0 && quad_too_curvy(pts)) 219 if (level > 0)
224 { 220 {
225 SkPoint tmp[5]; 221 SkPoint tmp[5];
226 222
227 SkChopQuadAtHalf(pts, tmp); 223 SkChopQuadAtHalf(pts, tmp);
228 hairquad(tmp, clip, blitter, level - 1, lineproc); 224 hairquad(tmp, clip, blitter, level - 1, lineproc);
229 hairquad(&tmp[2], clip, blitter, level - 1, lineproc); 225 hairquad(&tmp[2], clip, blitter, level - 1, lineproc);
230 } 226 }
231 else 227 else
232 lineproc(pts[0], pts[2], clip, blitter); 228 lineproc(pts[0], pts[2], clip, blitter);
233 #else 229 #else
234 int count = 1 << level; 230 int count = 1 << level;
235 const SkScalar dt = SkFixedToScalar(SK_Fixed1 >> level); 231 const SkScalar dt = SkFixedToScalar(SK_Fixed1 >> level);
236 SkScalar t = dt; 232 SkScalar t = dt;
237 SkPoint prevPt = pts[0]; 233 SkPoint prevPt = pts[0];
238 for (int i = 1; i < count; i++) { 234 for (int i = 1; i < count; i++) {
239 SkPoint nextPt; 235 SkPoint nextPt;
240 SkEvalQuadAt(pts, t, &nextPt); 236 SkEvalQuadAt(pts, t, &nextPt);
241 lineproc(prevPt, nextPt, clip, blitter); 237 lineproc(prevPt, nextPt, clip, blitter);
242 t += dt; 238 t += dt;
243 prevPt = nextPt; 239 prevPt = nextPt;
244 } 240 }
245 // draw the last line explicitly to 1.0, in case t didn't match that exactly 241 // draw the last line explicitly to 1.0, in case t didn't match that exactly
246 lineproc(prevPt, pts[2], clip, blitter); 242 lineproc(prevPt, pts[2], clip, blitter);
247 #endif 243 #endif
248 } 244 }
249 245
250 static bool cubic_too_curvy(const SkPoint pts[4])
251 {
252 return true;
253 }
254
255 static void haircubic(const SkPoint pts[4], const SkRegion* clip, SkBlitter* bli tter, int level, 246 static void haircubic(const SkPoint pts[4], const SkRegion* clip, SkBlitter* bli tter, int level,
256 void (*lineproc)(const SkPoint&, const SkPoint&, const SkR egion*, SkBlitter*)) 247 void (*lineproc)(const SkPoint&, const SkPoint&, const SkR egion*, SkBlitter*))
257 { 248 {
258 if (level > 0 && cubic_too_curvy(pts)) 249 if (level > 0)
259 { 250 {
260 SkPoint tmp[7]; 251 SkPoint tmp[7];
261 252
262 SkChopCubicAt(pts, tmp, SK_Scalar1/2); 253 SkChopCubicAt(pts, tmp, SK_Scalar1/2);
263 haircubic(tmp, clip, blitter, level - 1, lineproc); 254 haircubic(tmp, clip, blitter, level - 1, lineproc);
264 haircubic(&tmp[3], clip, blitter, level - 1, lineproc); 255 haircubic(&tmp[3], clip, blitter, level - 1, lineproc);
265 } 256 }
266 else 257 else
267 lineproc(pts[0], pts[3], clip, blitter); 258 lineproc(pts[0], pts[3], clip, blitter);
268 } 259 }
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 409
419 SkAAClipBlitterWrapper wrap; 410 SkAAClipBlitterWrapper wrap;
420 if (!clip.quickContains(ir)) { 411 if (!clip.quickContains(ir)) {
421 wrap.init(clip, blitter); 412 wrap.init(clip, blitter);
422 blitter = wrap.getBlitter(); 413 blitter = wrap.getBlitter();
423 clipRgn = &wrap.getRgn(); 414 clipRgn = &wrap.getRgn();
424 } 415 }
425 AntiHairLineRgn(p0, p1, clipRgn, blitter); 416 AntiHairLineRgn(p0, p1, clipRgn, blitter);
426 } 417 }
427 } 418 }
OLDNEW
« no previous file with comments | « src/core/SkPtrRecorder.h ('k') | src/gpu/effects/GrEllipseEdgeEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698