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

Side by Side Diff: src/gpu/effects/GrCustomXfermode.cpp

Issue 1213623022: fix up test create functions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup Created 5 years, 5 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/gpu/effects/GrCoverageSetOpXP.cpp ('k') | src/gpu/effects/GrDashingEffect.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 2015 Google Inc. 2 * Copyright 2015 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 "effects/GrCustomXfermode.h" 8 #include "effects/GrCustomXfermode.h"
9 #include "effects/GrCustomXfermodePriv.h" 9 #include "effects/GrCustomXfermodePriv.h"
10 10
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 bool GrCustomXferFP::onIsEqual(const GrFragmentProcessor& other) const { 502 bool GrCustomXferFP::onIsEqual(const GrFragmentProcessor& other) const {
503 const GrCustomXferFP& s = other.cast<GrCustomXferFP>(); 503 const GrCustomXferFP& s = other.cast<GrCustomXferFP>();
504 return fMode == s.fMode; 504 return fMode == s.fMode;
505 } 505 }
506 506
507 void GrCustomXferFP::onComputeInvariantOutput(GrInvariantOutput* inout) const { 507 void GrCustomXferFP::onComputeInvariantOutput(GrInvariantOutput* inout) const {
508 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput); 508 inout->setToUnknown(GrInvariantOutput::kWill_ReadInput);
509 } 509 }
510 510
511 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCustomXferFP); 511 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCustomXferFP);
512 GrFragmentProcessor* GrCustomXferFP::TestCreate(SkRandom* rand, 512 GrFragmentProcessor* GrCustomXferFP::TestCreate(GrProcessorTestData* d) {
513 GrContext*, 513 int mode = d->fRandom->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode ::kLastSeparableMode);
514 const GrCaps&,
515 GrTexture* textures[]) {
516 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas tSeparableMode);
517 514
518 GrShaderDataManager shaderDataManager; 515 return SkNEW_ARGS(GrCustomXferFP, (d->fShaderDataManager, static_cast<SkXfer mode::Mode>(mode),
519 return SkNEW_ARGS(GrCustomXferFP, (&shaderDataManager, static_cast<SkXfermod e::Mode>(mode), 516 d->fTextures[0]));
520 textures[0]));
521 } 517 }
522 518
523 /////////////////////////////////////////////////////////////////////////////// 519 ///////////////////////////////////////////////////////////////////////////////
524 // Xfer Processor 520 // Xfer Processor
525 /////////////////////////////////////////////////////////////////////////////// 521 ///////////////////////////////////////////////////////////////////////////////
526 522
527 class CustomXP : public GrXferProcessor { 523 class CustomXP : public GrXferProcessor {
528 public: 524 public:
529 CustomXP(SkXfermode::Mode mode, GrBlendEquation hwBlendEquation) 525 CustomXP(SkXfermode::Mode mode, GrBlendEquation hwBlendEquation)
530 : fMode(mode), 526 : fMode(mode),
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
810 return !can_use_hw_blend_equation(fHWBlendEquation, coveragePOI, caps); 806 return !can_use_hw_blend_equation(fHWBlendEquation, coveragePOI, caps);
811 } 807 }
812 808
813 void GrCustomXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI, 809 void GrCustomXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI,
814 InvariantBlendedColor* blendedC olor) const { 810 InvariantBlendedColor* blendedC olor) const {
815 blendedColor->fWillBlendWithDst = true; 811 blendedColor->fWillBlendWithDst = true;
816 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags; 812 blendedColor->fKnownColorFlags = kNone_GrColorComponentFlags;
817 } 813 }
818 814
819 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory); 815 GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory);
820 GrXPFactory* GrCustomXPFactory::TestCreate(SkRandom* rand, 816 GrXPFactory* GrCustomXPFactory::TestCreate(GrProcessorTestData* d) {
821 GrContext*, 817 int mode = d->fRandom->nextRangeU(SkXfermode::kLastCoeffMode + 1,
822 const GrCaps&, 818 SkXfermode::kLastSeparableMode);
823 GrTexture*[]) {
824 int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLas tSeparableMode);
825 819
826 return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode))); 820 return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode)));
827 } 821 }
828 822
OLDNEW
« no previous file with comments | « src/gpu/effects/GrCoverageSetOpXP.cpp ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698