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

Side by Side Diff: src/effects/SkColorMatrixFilter.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 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 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 #include "SkColorMatrixFilter.h" 8 #include "SkColorMatrixFilter.h"
9 #include "SkColorMatrix.h" 9 #include "SkColorMatrix.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 GrContext*, 487 GrContext*,
488 const GrDrawTargetCaps&, 488 const GrDrawTargetCaps&,
489 GrTexture* dummyTextures[2]) { 489 GrTexture* dummyTextures[2]) {
490 SkColorMatrix colorMatrix; 490 SkColorMatrix colorMatrix;
491 for (size_t i = 0; i < SK_ARRAY_COUNT(colorMatrix.fMat); ++i) { 491 for (size_t i = 0; i < SK_ARRAY_COUNT(colorMatrix.fMat); ++i) {
492 colorMatrix.fMat[i] = random->nextSScalar1(); 492 colorMatrix.fMat[i] = random->nextSScalar1();
493 } 493 }
494 return ColorMatrixEffect::Create(colorMatrix); 494 return ColorMatrixEffect::Create(colorMatrix);
495 } 495 }
496 496
497 GrFragmentProcessor* SkColorMatrixFilter::asFragmentProcessor(GrContext*) const { 497 bool SkColorMatrixFilter::asFragmentProcessors(GrContext*,
498 return ColorMatrixEffect::Create(fMatrix); 498 SkTDArray<GrFragmentProcessor*>* array) const {
499 GrFragmentProcessor* frag = ColorMatrixEffect::Create(fMatrix);
500 if (frag) {
501 if (array) {
502 *array->append() = frag;
503 }
504 return true;
505 }
506 return false;
499 } 507 }
500 508
501 #endif 509 #endif
502 510
503 #ifndef SK_IGNORE_TO_STRING 511 #ifndef SK_IGNORE_TO_STRING
504 void SkColorMatrixFilter::toString(SkString* str) const { 512 void SkColorMatrixFilter::toString(SkString* str) const {
505 str->append("SkColorMatrixFilter: "); 513 str->append("SkColorMatrixFilter: ");
506 514
507 str->append("matrix: ("); 515 str->append("matrix: (");
508 for (int i = 0; i < 20; ++i) { 516 for (int i = 0; i < 20; ++i) {
509 str->appendScalar(fMatrix.fMat[i]); 517 str->appendScalar(fMatrix.fMat[i]);
510 if (i < 19) { 518 if (i < 19) {
511 str->append(", "); 519 str->append(", ");
512 } 520 }
513 } 521 }
514 str->append(")"); 522 str->append(")");
515 } 523 }
516 #endif 524 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698