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

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

Issue 1471753004: Take span len into account when determining whether gradient is vertical (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 5 years, 1 month 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 | « no previous file | no next file » | 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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 const int rowIndex = (y & 1) << 1; 889 const int rowIndex = (y & 1) << 1;
890 dither0 = ditherCell[rowIndex]; 890 dither0 = ditherCell[rowIndex];
891 dither1 = ditherCell[rowIndex + 1]; 891 dither1 = ditherCell[rowIndex + 1];
892 if (x & 1) { 892 if (x & 1) {
893 SkTSwap(dither0, dither1); 893 SkTSwap(dither0, dither1);
894 } 894 }
895 } 895 }
896 const float dither[2] = { dither0, dither1 }; 896 const float dither[2] = { dither0, dither1 };
897 const float invDx = 1 / dx; 897 const float invDx = 1 / dx;
898 898
899 if (SkScalarNearlyZero(dx)) { // gradient is vertical 899 if (SkScalarNearlyZero(dx * count)) { // gradient is vertical
900 const float pinFx = SkTPin(fx, 0.0f, 1.0f); 900 const float pinFx = SkTPin(fx, 0.0f, 1.0f);
901 Sk4f c = lerp_color(pinFx, find_forward(fRecs.begin(), pinFx)); 901 Sk4f c = lerp_color(pinFx, find_forward(fRecs.begin(), pinFx));
902 if (fApplyAlphaAfterInterp) { 902 if (fApplyAlphaAfterInterp) {
903 fill<true>(dstC, count, c + dither0, c + dither1); 903 fill<true>(dstC, count, c + dither0, c + dither1);
904 } else { 904 } else {
905 fill<false>(dstC, count, c + dither0, c + dither1); 905 fill<false>(dstC, count, c + dither0, c + dither1);
906 } 906 }
907 return; 907 return;
908 } 908 }
909 909
910 if (dx > 0) { 910 if (dx > 0) {
911 if (fApplyAlphaAfterInterp) { 911 if (fApplyAlphaAfterInterp) {
912 this->shade4_dx_clamp<true, true>(dstC, count, fx, dx, invDx, dither ); 912 this->shade4_dx_clamp<true, true>(dstC, count, fx, dx, invDx, dither );
913 } else { 913 } else {
914 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe r); 914 this->shade4_dx_clamp<false, true>(dstC, count, fx, dx, invDx, dithe r);
915 } 915 }
916 } else { 916 } else {
917 if (fApplyAlphaAfterInterp) { 917 if (fApplyAlphaAfterInterp) {
918 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe r); 918 this->shade4_dx_clamp<true, false>(dstC, count, fx, dx, invDx, dithe r);
919 } else { 919 } else {
920 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith er); 920 this->shade4_dx_clamp<false, false>(dstC, count, fx, dx, invDx, dith er);
921 } 921 }
922 } 922 }
923 } 923 }
924 924
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698