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

Side by Side Diff: src/gpu/GrAAHairLinePathRenderer.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 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "GrAAHairLinePathRenderer.h" 8 #include "GrAAHairLinePathRenderer.h"
9 9
10 #include "GrContext.h" 10 #include "GrContext.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 static const SkScalar gSubdivTol = 175 * SK_Scalar1; 293 static const SkScalar gSubdivTol = 175 * SK_Scalar1;
294 294
295 if (dsqd <= SkScalarMul(gSubdivTol, gSubdivTol)) { 295 if (dsqd <= SkScalarMul(gSubdivTol, gSubdivTol)) {
296 return 0; 296 return 0;
297 } else { 297 } else {
298 static const int kMaxSub = 4; 298 static const int kMaxSub = 4;
299 // subdividing the quad reduces d by 4. so we want x = log4(d/tol) 299 // subdividing the quad reduces d by 4. so we want x = log4(d/tol)
300 // = log4(d*d/tol*tol)/2 300 // = log4(d*d/tol*tol)/2
301 // = log2(d*d/tol*tol) 301 // = log2(d*d/tol*tol)
302 302
303 #ifdef SK_SCALAR_IS_FLOAT
304 // +1 since we're ignoring the mantissa contribution. 303 // +1 since we're ignoring the mantissa contribution.
305 int log = get_float_exp(dsqd/(gSubdivTol*gSubdivTol)) + 1; 304 int log = get_float_exp(dsqd/(gSubdivTol*gSubdivTol)) + 1;
306 log = GrMin(GrMax(0, log), kMaxSub); 305 log = GrMin(GrMax(0, log), kMaxSub);
307 return log; 306 return log;
308 #else
309 SkScalar log = SkScalarLog(
310 SkScalarDiv(dsqd,
311 SkScalarMul(gSubdivTol, gSubdivTol)));
312 static const SkScalar conv = SkScalarInvert(SkScalarLog(2));
313 log = SkScalarMul(log, conv);
314 return GrMin(GrMax(0, SkScalarCeilToInt(log)),kMaxSub);
315 #endif
316 } 307 }
317 } 308 }
318 309
319 /** 310 /**
320 * Generates the lines and quads to be rendered. Lines are always recorded in 311 * Generates the lines and quads to be rendered. Lines are always recorded in
321 * device space. We will do a device space bloat to account for the 1pixel 312 * device space. We will do a device space bloat to account for the 1pixel
322 * thickness. 313 * thickness.
323 * Quads are recorded in device space unless m contains 314 * Quads are recorded in device space unless m contains
324 * perspective, then in they are in src space. We do this because we will 315 * perspective, then in they are in src space. We do this because we will
325 * subdivide large quads to reduce over-fill. This subdivision has to be 316 * subdivide large quads to reduce over-fill. This subdivision has to be
(...skipping 716 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 &devBounds); 1033 &devBounds);
1043 conics += n; 1034 conics += n;
1044 } 1035 }
1045 } 1036 }
1046 } 1037 }
1047 1038
1048 target->resetIndexSource(); 1039 target->resetIndexSource();
1049 1040
1050 return true; 1041 return true;
1051 } 1042 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698