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

Side by Side Diff: src/effects/SkColorFilters.cpp

Issue 973593002: change colorfilter to return an array of frag processors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update gm Created 5 years, 9 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 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkBlitRow.h" 8 #include "SkBlitRow.h"
9 #include "SkColorFilter.h" 9 #include "SkColorFilter.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 359
360 // pick a random premul color 360 // pick a random premul color
361 uint8_t alpha = rand->nextULessThan(256); 361 uint8_t alpha = rand->nextULessThan(256);
362 GrColor color = GrColorPackRGBA(rand->nextRangeU(0, alpha), 362 GrColor color = GrColorPackRGBA(rand->nextRangeU(0, alpha),
363 rand->nextRangeU(0, alpha), 363 rand->nextRangeU(0, alpha),
364 rand->nextRangeU(0, alpha), 364 rand->nextRangeU(0, alpha),
365 alpha); 365 alpha);
366 return ModeColorFilterEffect::Create(color, mode); 366 return ModeColorFilterEffect::Create(color, mode);
367 } 367 }
368 368
369 GrFragmentProcessor* SkModeColorFilter::asFragmentProcessor(GrContext*) const { 369 bool SkModeColorFilter::asFragmentProcessors(GrContext*,
370 SkTDArray<GrFragmentProcessor*>* ar ray) const {
370 if (SkXfermode::kDst_Mode != fMode) { 371 if (SkXfermode::kDst_Mode != fMode) {
371 return ModeColorFilterEffect::Create(SkColor2GrColor(fColor), fMode); 372 GrFragmentProcessor* frag = ModeColorFilterEffect::Create(SkColor2GrColo r(fColor), fMode);
373 if (frag) {
374 if (array) {
375 *array->append() = frag;
376 }
377 return true;
378 }
372 } 379 }
373 return NULL; 380 return false;
374 } 381 }
375 382
376 #endif 383 #endif
377 384
378 /////////////////////////////////////////////////////////////////////////////// 385 ///////////////////////////////////////////////////////////////////////////////
379 386
380 class Src_SkModeColorFilter : public SkModeColorFilter { 387 class Src_SkModeColorFilter : public SkModeColorFilter {
381 public: 388 public:
382 Src_SkModeColorFilter(SkColor color) : INHERITED(color, SkXfermode::kSrc_Mod e) {} 389 Src_SkModeColorFilter(SkColor color) : INHERITED(color, SkXfermode::kSrc_Mod e) {}
383 390
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 byte_to_scale(SkColorGetG(mul)), 506 byte_to_scale(SkColorGetG(mul)),
500 byte_to_scale(SkColorGetB(mul)), 507 byte_to_scale(SkColorGetB(mul)),
501 1); 508 1);
502 matrix.postTranslate(SkIntToScalar(SkColorGetR(add)), 509 matrix.postTranslate(SkIntToScalar(SkColorGetR(add)),
503 SkIntToScalar(SkColorGetG(add)), 510 SkIntToScalar(SkColorGetG(add)),
504 SkIntToScalar(SkColorGetB(add)), 511 SkIntToScalar(SkColorGetB(add)),
505 0); 512 0);
506 return SkColorMatrixFilter::Create(matrix); 513 return SkColorMatrixFilter::Create(matrix);
507 } 514 }
508 515
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698