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

Side by Side Diff: include/gpu/effects/GrAdvancedEquationXferProcessor.h

Issue 1037123003: Implement support for KHR_blend_equation_advanced (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_zzz2_barriers
Patch Set: Addressed comments Created 5 years, 8 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
OLDNEW
(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 SVG/PDF blend modes in hardw are, without the
16 * 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(SkXfermode::Mode);
22
23 bool canTweakAlphaForCoverage() const override;
24 bool supportsRGBCoverage(GrColor, uint32_t) const override;
25
26 void getInvariantOutput(const GrProcOptInfo&, const GrProcOptInfo&,
27 GrXPFactory::InvariantOutput* output) const override {
28 // Advanced blend modes all use the dst color, even when src alpha is 1, so we can't make
29 // any conclusions about the output without knowing something about the dst.
30 output->fWillBlendWithDst = true;
31 output->fBlendedColorFlags = 0;
32 }
33
34 private:
35 template<GrBlendEquation> static GrXPFactory* RefFactory();
36
37 GrAdvancedEquationXPFactory(GrBlendEquation equation) : fEquation(equation) {}
38
39 GrXferProcessor* onCreateXferProcessor(const GrDrawTargetCaps& caps,
40 const GrProcOptInfo& colorPOI,
41 const GrProcOptInfo& coveragePOI,
42 const GrDeviceCoordTexture* dstCopy) const override;
43
44 bool willReadDstColor(const GrDrawTargetCaps&, const GrProcOptInfo&,
45 const GrProcOptInfo&) const override {
46 return false;
47 }
48
49 bool onIsEqual(const GrXPFactory& xpfBase) const override {
50 const GrAdvancedEquationXPFactory& xpf = xpfBase.cast<GrAdvancedEquation XPFactory>();
51 return fEquation == xpf.fEquation;
52 }
53
54 const GrBlendEquation fEquation;
55
56 GR_DECLARE_XP_FACTORY_TEST;
57
58 typedef GrXPFactory INHERITED;
59 };
60
61 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698