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

Side by Side Diff: src/effects/gradients/SkLinearGradient.cpp

Issue 1692013002: Change SkMatrix::fixedStepInX to return SkVector rather than SkFixed. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Split fixedStepInX into bool isFixedStepInX and SkVector fixedStepInX. Created 4 years, 10 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/core/SkShader.cpp ('k') | src/effects/gradients/SkRadialGradient.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 2012 Google Inc. 2 * Copyright 2012 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 "SkLinearGradient.h" 8 #include "SkLinearGradient.h"
9 9
10 static const float kInv255Float = 1.0f / 255; 10 static const float kInv255Float = 1.0f / 255;
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 TileProc proc = linearGradient.fTileProc; 280 TileProc proc = linearGradient.fTileProc;
281 const SkPMColor* SK_RESTRICT cache = fCache->getCache32(); 281 const SkPMColor* SK_RESTRICT cache = fCache->getCache32();
282 int toggle = init_dither_toggle(x, y); 282 int toggle = init_dither_toggle(x, y);
283 283
284 if (fDstToIndexClass != kPerspective_MatrixClass) { 284 if (fDstToIndexClass != kPerspective_MatrixClass) {
285 dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf, 285 dstProc(fDstToIndex, SkIntToScalar(x) + SK_ScalarHalf,
286 SkIntToScalar(y) + SK_ScalarHalf, &srcPt); 286 SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
287 SkGradFixed dx, fx = SkScalarToGradFixed(srcPt.fX); 287 SkGradFixed dx, fx = SkScalarToGradFixed(srcPt.fX);
288 288
289 if (fDstToIndexClass == kFixedStepInX_MatrixClass) { 289 if (fDstToIndexClass == kFixedStepInX_MatrixClass) {
290 SkFixed dxStorage[1]; 290 const auto step = fDstToIndex.fixedStepInX(SkIntToScalar(y));
291 (void)fDstToIndex.fixedStepInX(SkIntToScalar(y), dxStorage, nullptr) ;
292 // todo: do we need a real/high-precision value for dx here? 291 // todo: do we need a real/high-precision value for dx here?
293 dx = SkFixedToGradFixed(dxStorage[0]); 292 dx = SkScalarToGradFixed(step.fX);
294 } else { 293 } else {
295 SkASSERT(fDstToIndexClass == kLinear_MatrixClass); 294 SkASSERT(fDstToIndexClass == kLinear_MatrixClass);
296 dx = SkScalarToGradFixed(fDstToIndex.getScaleX()); 295 dx = SkScalarToGradFixed(fDstToIndex.getScaleX());
297 } 296 }
298 297
299 LinearShadeProc shadeProc = shadeSpan_linear_repeat; 298 LinearShadeProc shadeProc = shadeSpan_linear_repeat;
300 if (0 == dx) { 299 if (0 == dx) {
301 shadeProc = shadeSpan_linear_vertical_lerp; 300 shadeProc = shadeSpan_linear_vertical_lerp;
302 } else if (SkShader::kClamp_TileMode == linearGradient.fTileMode) { 301 } else if (SkShader::kClamp_TileMode == linearGradient.fTileMode) {
303 shadeProc = shadeSpan_linear_clamp; 302 shadeProc = shadeSpan_linear_clamp;
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe r); 739 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe r);
741 } 740 }
742 } else { 741 } else {
743 if (fApplyAlphaAfterInterp) { 742 if (fApplyAlphaAfterInterp) {
744 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe r); 743 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe r);
745 } else { 744 } else {
746 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith er); 745 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith er);
747 } 746 }
748 } 747 }
749 } 748 }
750
OLDNEW
« no previous file with comments | « src/core/SkShader.cpp ('k') | src/effects/gradients/SkRadialGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698