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

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

Issue 1674673002: Alter SkXfermode's asFragmentProcessor & asXPFactory contracts (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix unit test bug Created 4 years, 10 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/SkArithmeticMode.cpp ('k') | src/effects/SkPixelXorXfermode.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 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 "SkAvoidXfermode.h" 8 #include "SkAvoidXfermode.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
514 const GrXPFactory* GrAvoidXPFactory::TestCreate(GrProcessorTestData* d) { 514 const GrXPFactory* GrAvoidXPFactory::TestCreate(GrProcessorTestData* d) {
515 SkColor opColor = d->fRandom->nextU(); 515 SkColor opColor = d->fRandom->nextU();
516 uint8_t tolerance = d->fRandom->nextBits(8); 516 uint8_t tolerance = d->fRandom->nextBits(8);
517 SkAvoidXfermode::Mode mode = d->fRandom->nextBool() ? SkAvoidXfermode::kAvoi dColor_Mode 517 SkAvoidXfermode::Mode mode = d->fRandom->nextBool() ? SkAvoidXfermode::kAvoi dColor_Mode
518 : SkAvoidXfermode::kTarg etColor_Mode; 518 : SkAvoidXfermode::kTarg etColor_Mode;
519 return GrAvoidXPFactory::Create(opColor, tolerance, mode); 519 return GrAvoidXPFactory::Create(opColor, tolerance, mode);
520 } 520 }
521 521
522 /////////////////////////////////////////////////////////////////////////////// 522 ///////////////////////////////////////////////////////////////////////////////
523 523
524 bool SkAvoidXfermode::asFragmentProcessor(const GrFragmentProcessor** output, 524 const GrFragmentProcessor* SkAvoidXfermode::getFragmentProcessorForImageFilter(
525 const GrFragmentProcessor* dst) const { 525 const GrFragmentProc essor* dst) const {
526 if (output) { 526 return AvoidFP::Create(fOpColor, fTolerance, fMode, dst);
527 *output = AvoidFP::Create(fOpColor, fTolerance, fMode, dst);
528 }
529 return true;
530 } 527 }
531 528
532 bool SkAvoidXfermode::asXPFactory(GrXPFactory** xpf) const { 529 GrXPFactory* SkAvoidXfermode::asXPFactory() const {
533 if (xpf) { 530 return GrAvoidXPFactory::Create(fOpColor, fTolerance, fMode);
534 *xpf = GrAvoidXPFactory::Create(fOpColor, fTolerance, fMode);
535 }
536 return true;
537 } 531 }
538 #endif 532 #endif
539 533
540 #ifndef SK_IGNORE_TO_STRING 534 #ifndef SK_IGNORE_TO_STRING
541 void SkAvoidXfermode::toString(SkString* str) const { 535 void SkAvoidXfermode::toString(SkString* str) const {
542 str->append("AvoidXfermode: opColor: "); 536 str->append("AvoidXfermode: opColor: ");
543 str->appendHex(fOpColor); 537 str->appendHex(fOpColor);
544 str->appendf("tolerance: %d ", fTolerance); 538 str->appendf("tolerance: %d ", fTolerance);
545 539
546 static const char* gModeStrings[] = { "Avoid", "Target" }; 540 static const char* gModeStrings[] = { "Avoid", "Target" };
547 541
548 str->appendf("mode: %s", gModeStrings[fMode]); 542 str->appendf("mode: %s", gModeStrings[fMode]);
549 } 543 }
550 #endif 544 #endif
OLDNEW
« no previous file with comments | « src/effects/SkArithmeticMode.cpp ('k') | src/effects/SkPixelXorXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698