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

Side by Side Diff: src/effects/SkDashPathEffect.cpp

Issue 111353003: deprecate SkScalarRound (and its ilk), use SkScalarRound[ToInt,ToScalar]. #define SK_SUPPORT_DEPREC… (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
« no previous file with comments | « src/effects/SkBlurMask.cpp ('k') | src/effects/SkDiscretePathEffect.cpp » ('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 "SkDashPathEffect.h" 10 #include "SkDashPathEffect.h"
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 if (dashCount > kMaxDashCount) { 270 if (dashCount > kMaxDashCount) {
271 dst->reset(); 271 dst->reset();
272 return false; 272 return false;
273 } 273 }
274 274
275 if (fScaleToFit) { 275 if (fScaleToFit) {
276 if (fIntervalLength >= length) { 276 if (fIntervalLength >= length) {
277 scale = SkScalarDiv(length, fIntervalLength); 277 scale = SkScalarDiv(length, fIntervalLength);
278 } else { 278 } else {
279 SkScalar div = SkScalarDiv(length, fIntervalLength); 279 SkScalar div = SkScalarDiv(length, fIntervalLength);
280 int n = SkScalarFloor(div); 280 int n = SkScalarFloorToInt(div);
281 scale = SkScalarDiv(length, n * fIntervalLength); 281 scale = SkScalarDiv(length, n * fIntervalLength);
282 } 282 }
283 } 283 }
284 284
285 // Using double precision to avoid looping indefinitely due to single pr ecision rounding 285 // Using double precision to avoid looping indefinitely due to single pr ecision rounding
286 // (for extreme path_length/dash_length ratios). See test_infinite_dash( ) unittest. 286 // (for extreme path_length/dash_length ratios). See test_infinite_dash( ) unittest.
287 double distance = 0; 287 double distance = 0;
288 double dlen = SkScalarMul(fInitialDashLength, scale); 288 double dlen = SkScalarMul(fInitialDashLength, scale);
289 289
290 while (distance < length) { 290 while (distance < length) {
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 SkDashPathEffect::SkDashPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED( buffer) { 550 SkDashPathEffect::SkDashPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED( buffer) {
551 fInitialDashIndex = buffer.readInt(); 551 fInitialDashIndex = buffer.readInt();
552 fInitialDashLength = buffer.readScalar(); 552 fInitialDashLength = buffer.readScalar();
553 fIntervalLength = buffer.readScalar(); 553 fIntervalLength = buffer.readScalar();
554 fScaleToFit = buffer.readBool(); 554 fScaleToFit = buffer.readBool();
555 555
556 fCount = buffer.getArrayCount(); 556 fCount = buffer.getArrayCount();
557 fIntervals = (SkScalar*)sk_malloc_throw(sizeof(SkScalar) * fCount); 557 fIntervals = (SkScalar*)sk_malloc_throw(sizeof(SkScalar) * fCount);
558 buffer.readScalarArray(fIntervals, fCount); 558 buffer.readScalarArray(fIntervals, fCount);
559 } 559 }
OLDNEW
« no previous file with comments | « src/effects/SkBlurMask.cpp ('k') | src/effects/SkDiscretePathEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698