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

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

Issue 1553103003: remove 565 effects shaders (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove more hasspan16 checks Created 4 years, 11 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
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 #include "SkSweepGradient.h" 9 #include "SkSweepGradient.h"
10 10
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 } else { // perspective case 112 } else { // perspective case
113 for (int stop = x + count; x < stop; x++) { 113 for (int stop = x + count; x < stop; x++) {
114 proc(matrix, SkIntToScalar(x) + SK_ScalarHalf, 114 proc(matrix, SkIntToScalar(x) + SK_ScalarHalf,
115 SkIntToScalar(y) + SK_ScalarHalf, &srcPt); 115 SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
116 *dstC++ = cache[toggle + SkATan2_255(srcPt.fY, srcPt.fX)]; 116 *dstC++ = cache[toggle + SkATan2_255(srcPt.fY, srcPt.fX)];
117 toggle = next_dither_toggle(toggle); 117 toggle = next_dither_toggle(toggle);
118 } 118 }
119 } 119 }
120 } 120 }
121 121
122 void SkSweepGradient::SweepGradientContext::shadeSpan16(int x, int y, uint16_t* SK_RESTRICT dstC,
123 int count) {
124 SkMatrix::MapXYProc proc = fDstToIndexProc;
125 const SkMatrix& matrix = fDstToIndex;
126 const uint16_t* SK_RESTRICT cache = fCache->getCache16();
127 int toggle = init_dither_toggle16(x, y);
128 SkPoint srcPt;
129
130 if (fDstToIndexClass != kPerspective_MatrixClass) {
131 proc(matrix, SkIntToScalar(x) + SK_ScalarHalf,
132 SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
133 SkScalar dx, fx = srcPt.fX;
134 SkScalar dy, fy = srcPt.fY;
135
136 if (fDstToIndexClass == kFixedStepInX_MatrixClass) {
137 SkFixed storage[2];
138 (void)matrix.fixedStepInX(SkIntToScalar(y) + SK_ScalarHalf,
139 &storage[0], &storage[1]);
140 dx = SkFixedToScalar(storage[0]);
141 dy = SkFixedToScalar(storage[1]);
142 } else {
143 SkASSERT(fDstToIndexClass == kLinear_MatrixClass);
144 dx = matrix.getScaleX();
145 dy = matrix.getSkewY();
146 }
147
148 for (; count > 0; --count) {
149 int index = SkATan2_255(fy, fx) >> (8 - kCache16Bits);
150 *dstC++ = cache[toggle + index];
151 toggle = next_dither_toggle16(toggle);
152 fx += dx;
153 fy += dy;
154 }
155 } else { // perspective case
156 for (int stop = x + count; x < stop; x++) {
157 proc(matrix, SkIntToScalar(x) + SK_ScalarHalf,
158 SkIntToScalar(y) + SK_ScalarHalf, &srcPt);
159
160 int index = SkATan2_255(srcPt.fY, srcPt.fX);
161 index >>= (8 - kCache16Bits);
162 *dstC++ = cache[toggle + index];
163 toggle = next_dither_toggle16(toggle);
164 }
165 }
166 }
167
168 ///////////////////////////////////////////////////////////////////// 122 /////////////////////////////////////////////////////////////////////
169 123
170 #if SK_SUPPORT_GPU 124 #if SK_SUPPORT_GPU
171 125
172 #include "SkGr.h" 126 #include "SkGr.h"
173 #include "gl/GrGLContext.h" 127 #include "gl/GrGLContext.h"
174 #include "glsl/GrGLSLCaps.h" 128 #include "glsl/GrGLSLCaps.h"
175 #include "glsl/GrGLSLFragmentShaderBuilder.h" 129 #include "glsl/GrGLSLFragmentShaderBuilder.h"
176 130
177 class GrGLSweepGradient : public GrGLGradientEffect { 131 class GrGLSweepGradient : public GrGLGradientEffect {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 str->appendScalar(fCenter.fX); 263 str->appendScalar(fCenter.fX);
310 str->append(", "); 264 str->append(", ");
311 str->appendScalar(fCenter.fY); 265 str->appendScalar(fCenter.fY);
312 str->append(") "); 266 str->append(") ");
313 267
314 this->INHERITED::toString(str); 268 this->INHERITED::toString(str);
315 269
316 str->append(")"); 270 str->append(")");
317 } 271 }
318 #endif 272 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkSweepGradient.h ('k') | src/effects/gradients/SkTwoPointConicalGradient.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698