OLD | NEW |
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 Loading... |
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 |
OLD | NEW |