Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* | |
| 2 * Copyright 2015 Google Inc. | |
| 3 * | |
| 4 * Use of this source code is governed by a BSD-style license that can be | |
| 5 * found in the LICENSE file. | |
| 6 */ | |
| 7 | |
| 8 #ifndef GrAdvancedEquationXferProcessor_DEFINED | |
| 9 #define GrAdvancedEquationXferProcessor_DEFINED | |
| 10 | |
| 11 #include "GrTypes.h" | |
| 12 #include "GrXferProcessor.h" | |
| 13 | |
| 14 /** | |
| 15 * Provides Xfer processors that implement advanced blend modes in hardware, | |
| 16 * without the need for a dst texture. Can only be used if supported by the GPU. | |
| 17 */ | |
| 18 class GrAdvancedEquationXPFactory : public GrXPFactory { | |
| 19 public: | |
| 20 static bool IsSupported(const GrContext*, SkXfermode::Mode); | |
| 21 static GrXPFactory* Create(const GrContext*, SkXfermode::Mode); | |
| 22 | |
| 23 bool canTweakAlphaForCoverage() const override; | |
| 24 bool supportsRGBCoverage(GrColor = 0, uint32_t = 0) const override; | |
| 25 | |
| 26 void getInvariantOutput(const GrProcOptInfo&, const GrProcOptInfo&, | |
| 27 GrXPFactory::InvariantOutput* output) const override { | |
| 28 output->fWillBlendWithDst = true; | |
| 29 output->fBlendedColorFlags = 0; | |
|
egdaniel
2015/04/21 18:59:12
I'm assuming there are cases where these are not a
Chris Dalton
2015/04/21 20:39:31
The KHR_blend_equation_advanced extension only add
egdaniel
2015/04/21 20:53:49
Okay that makes sense. Yeah since this is implemen
| |
| 30 } | |
| 31 | |
| 32 private: | |
| 33 template<GrBlendEquation> static GrXPFactory* RefFactory(); | |
| 34 | |
| 35 GrAdvancedEquationXPFactory(GrBlendEquation equation); | |
| 36 ~GrAdvancedEquationXPFactory() override; | |
| 37 | |
| 38 GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps, | |
| 39 const GrProcOptInfo& colorPOI, | |
| 40 const GrProcOptInfo& coveragePOI, | |
| 41 const GrDeviceCoordTexture* dstCopy) const override; | |
| 42 | |
| 43 bool willReadDstColor(const GrDrawTargetCaps&, const GrProcOptInfo&, | |
| 44 const GrProcOptInfo&) const override { | |
| 45 return false; | |
| 46 } | |
| 47 | |
| 48 bool onIsEqual(const GrXPFactory& xpfBase) const override { | |
| 49 const GrAdvancedEquationXPFactory& xpf = xpfBase.cast<GrAdvancedEquation XPFactory>(); | |
| 50 return fEquation == xpf.fEquation; | |
| 51 } | |
| 52 | |
| 53 const GrBlendEquation fEquation; | |
| 54 SkAutoTUnref<GrXferProcessor> fXferProcessor; | |
| 55 SkAutoTUnref<GrXferProcessor> fXferProcessorWithCoverage; | |
| 56 | |
| 57 GR_DECLARE_XP_FACTORY_TEST; | |
| 58 | |
| 59 typedef GrXPFactory INHERITED; | |
| 60 }; | |
| 61 | |
| 62 #endif | |
| OLD | NEW |