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

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

Issue 1334293003: Create fragment processor for performing input color blend with child processor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix Created 5 years, 3 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/SkColorFilters.cpp ('k') | src/effects/SkLumaColorFilter.cpp » ('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 2011 Google Inc. 2 * Copyright 2011 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 "SkColorMatrixFilter.h" 8 #include "SkColorMatrixFilter.h"
9 #include "SkColorMatrix.h" 9 #include "SkColorMatrix.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 530
531 const GrFragmentProcessor* ColorMatrixEffect::TestCreate(GrProcessorTestData* d) { 531 const GrFragmentProcessor* ColorMatrixEffect::TestCreate(GrProcessorTestData* d) {
532 SkColorMatrix colorMatrix; 532 SkColorMatrix colorMatrix;
533 for (size_t i = 0; i < SK_ARRAY_COUNT(colorMatrix.fMat); ++i) { 533 for (size_t i = 0; i < SK_ARRAY_COUNT(colorMatrix.fMat); ++i) {
534 colorMatrix.fMat[i] = d->fRandom->nextSScalar1(); 534 colorMatrix.fMat[i] = d->fRandom->nextSScalar1();
535 } 535 }
536 return ColorMatrixEffect::Create(colorMatrix); 536 return ColorMatrixEffect::Create(colorMatrix);
537 } 537 }
538 538
539 bool SkColorMatrixFilter::asFragmentProcessors(GrContext*, GrProcessorDataManage r*, 539 bool SkColorMatrixFilter::asFragmentProcessors(GrContext*, GrProcessorDataManage r*,
540 SkTDArray<GrFragmentProcessor*>* array) const { 540 SkTDArray<const GrFragmentProcess or*>* array) const {
541 GrFragmentProcessor* frag = ColorMatrixEffect::Create(fMatrix); 541 GrFragmentProcessor* frag = ColorMatrixEffect::Create(fMatrix);
542 if (frag) { 542 if (frag) {
543 if (array) { 543 if (array) {
544 *array->append() = frag; 544 *array->append() = frag;
545 } else { 545 } else {
546 frag->unref(); 546 frag->unref();
547 SkDEBUGCODE(frag = nullptr;) 547 SkDEBUGCODE(frag = nullptr;)
548 } 548 }
549 return true; 549 return true;
550 } 550 }
551 return false; 551 return false;
552 } 552 }
553 553
554 #endif 554 #endif
555 555
556 #ifndef SK_IGNORE_TO_STRING 556 #ifndef SK_IGNORE_TO_STRING
557 void SkColorMatrixFilter::toString(SkString* str) const { 557 void SkColorMatrixFilter::toString(SkString* str) const {
558 str->append("SkColorMatrixFilter: "); 558 str->append("SkColorMatrixFilter: ");
559 559
560 str->append("matrix: ("); 560 str->append("matrix: (");
561 for (int i = 0; i < 20; ++i) { 561 for (int i = 0; i < 20; ++i) {
562 str->appendScalar(fMatrix.fMat[i]); 562 str->appendScalar(fMatrix.fMat[i]);
563 if (i < 19) { 563 if (i < 19) {
564 str->append(", "); 564 str->append(", ");
565 } 565 }
566 } 566 }
567 str->append(")"); 567 str->append(")");
568 } 568 }
569 #endif 569 #endif
OLDNEW
« no previous file with comments | « src/effects/SkColorFilters.cpp ('k') | src/effects/SkLumaColorFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698