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 1287263005: change asABitmap to isABitmap on shader (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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/effects/gradients/SkLinearGradient.h ('k') | src/effects/gradients/SkRadialGradient.h » ('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 inline int repeat_bits(int x, const int bits) { 10 static inline int repeat_bits(int x, const int bits) {
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 do { 253 do {
254 dstProc(fDstToIndex, dstX, dstY, &srcPt); 254 dstProc(fDstToIndex, dstX, dstY, &srcPt);
255 unsigned fi = proc(SkScalarToFixed(srcPt.fX)); 255 unsigned fi = proc(SkScalarToFixed(srcPt.fX));
256 SkASSERT(fi <= 0xFFFF); 256 SkASSERT(fi <= 0xFFFF);
257 *dstC++ = cache[toggle + (fi >> kCache32Shift)]; 257 *dstC++ = cache[toggle + (fi >> kCache32Shift)];
258 toggle = next_dither_toggle(toggle); 258 toggle = next_dither_toggle(toggle);
259 dstX += SK_Scalar1; 259 dstX += SK_Scalar1;
260 } while (--count != 0); 260 } while (--count != 0);
261 } 261 }
262 } 262 }
263 263
robertphillips 2015/08/19 19:03:02 So we don't care about tracking gradients as bitma
264 SkShader::BitmapType SkLinearGradient::asABitmap(SkBitmap* bitmap,
265 SkMatrix* matrix,
266 TileMode xy[]) const {
267 if (bitmap) {
268 this->getGradientTableBitmap(bitmap);
269 }
270 if (matrix) {
271 matrix->preConcat(fPtsToUnit);
272 }
273 if (xy) {
274 xy[0] = fTileMode;
275 xy[1] = kClamp_TileMode;
276 }
277 return kLinear_BitmapType;
278 }
279
280 SkShader::GradientType SkLinearGradient::asAGradient(GradientInfo* info) const { 264 SkShader::GradientType SkLinearGradient::asAGradient(GradientInfo* info) const {
281 if (info) { 265 if (info) {
282 commonAsAGradient(info); 266 commonAsAGradient(info);
283 info->fPoint[0] = fStart; 267 info->fPoint[0] = fStart;
284 info->fPoint[1] = fEnd; 268 info->fPoint[1] = fEnd;
285 } 269 }
286 return kLinear_GradientType; 270 return kLinear_GradientType;
287 } 271 }
288 272
289 static void dither_memset16(uint16_t dst[], uint16_t value, uint16_t other, 273 static void dither_memset16(uint16_t dst[], uint16_t value, uint16_t other,
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 str->append("SkLinearGradient ("); 583 str->append("SkLinearGradient (");
600 584
601 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY); 585 str->appendf("start: (%f, %f)", fStart.fX, fStart.fY);
602 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY); 586 str->appendf(" end: (%f, %f) ", fEnd.fX, fEnd.fY);
603 587
604 this->INHERITED::toString(str); 588 this->INHERITED::toString(str);
605 589
606 str->append(")"); 590 str->append(")");
607 } 591 }
608 #endif 592 #endif
OLDNEW
« no previous file with comments | « src/effects/gradients/SkLinearGradient.h ('k') | src/effects/gradients/SkRadialGradient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698