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

Side by Side Diff: src/gpu/effects/GrDashingEffect.cpp

Issue 1135053002: stop calling SkScalarDiv (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix xpsdevice Created 5 years, 7 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
« no previous file with comments | « src/gpu/GrPathUtils.cpp ('k') | src/pdf/SkPDFDevice.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 * Copyright 2014 Google Inc. 2 * Copyright 2014 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 "GrDashingEffect.h" 8 #include "GrDashingEffect.h"
9 9
10 #include "GrBatch.h" 10 #include "GrBatch.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 return 0; 128 return 0;
129 } 129 }
130 130
131 static SkScalar calc_end_adjustment(const SkScalar intervals[2], const SkPoint p ts[2], 131 static SkScalar calc_end_adjustment(const SkScalar intervals[2], const SkPoint p ts[2],
132 SkScalar phase, SkScalar* endingInt) { 132 SkScalar phase, SkScalar* endingInt) {
133 if (pts[1].fX <= pts[0].fX) { 133 if (pts[1].fX <= pts[0].fX) {
134 return 0; 134 return 0;
135 } 135 }
136 SkScalar srcIntervalLen = intervals[0] + intervals[1]; 136 SkScalar srcIntervalLen = intervals[0] + intervals[1];
137 SkScalar totalLen = pts[1].fX - pts[0].fX; 137 SkScalar totalLen = pts[1].fX - pts[0].fX;
138 SkScalar temp = SkScalarDiv(totalLen, srcIntervalLen); 138 SkScalar temp = totalLen / srcIntervalLen;
139 SkScalar numFullIntervals = SkScalarFloorToScalar(temp); 139 SkScalar numFullIntervals = SkScalarFloorToScalar(temp);
140 *endingInt = totalLen - numFullIntervals * srcIntervalLen + phase; 140 *endingInt = totalLen - numFullIntervals * srcIntervalLen + phase;
141 temp = SkScalarDiv(*endingInt, srcIntervalLen); 141 temp = *endingInt / srcIntervalLen;
142 *endingInt = *endingInt - SkScalarFloorToScalar(temp) * srcIntervalLen; 142 *endingInt = *endingInt - SkScalarFloorToScalar(temp) * srcIntervalLen;
143 if (0 == *endingInt) { 143 if (0 == *endingInt) {
144 *endingInt = srcIntervalLen; 144 *endingInt = srcIntervalLen;
145 } 145 }
146 if (*endingInt > intervals[0]) { 146 if (*endingInt > intervals[0]) {
147 if (0 == intervals[0]) { 147 if (0 == intervals[0]) {
148 *endingInt -= 0.01f; // make sure we capture the last zero size pnt (used if has caps) 148 *endingInt -= 0.01f; // make sure we capture the last zero size pnt (used if has caps)
149 } 149 }
150 return *endingInt - intervals[0]; 150 return *endingInt - intervals[0];
151 } 151 }
(...skipping 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after
1343 info.fIntervals = intervals; 1343 info.fIntervals = intervals;
1344 info.fCount = 2; 1344 info.fCount = 2;
1345 info.fPhase = phase; 1345 info.fPhase = phase;
1346 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); 1346 SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info);
1347 SkASSERT(success); 1347 SkASSERT(success);
1348 1348
1349 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); 1349 return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT);
1350 } 1350 }
1351 1351
1352 #endif 1352 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrPathUtils.cpp ('k') | src/pdf/SkPDFDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698