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

Side by Side Diff: include/gpu/GrXferProcessor.h

Issue 751283002: Add XferProcessor factory in GrPaint and GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Review changes Created 6 years 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 2014 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 GrXferProcessor_DEFINED
9 #define GrXferProcessor_DEFINED
10
11 #include "GrColor.h"
12 #include "GrFragmentProcessor.h"
13 #include "GrTypes.h"
14 #include "SkXfermode.h"
15
16 /**
17 * GrXferProcessor is responsible for implementing the xfer mode that blends the src color and dst
18 * color. It does this by emitting fragment shader code and controlling the fixe d-function blend
19 * state. The inputs to its shader code are the final computed src color and fra ctional pixel
20 * coverage. The GrXferProcessor's shader code writes the fragment shader output color that coes
bsalomon 2014/12/02 15:36:32 coes->goes
egdaniel 2014/12/02 18:09:51 Done.
21 * into the fixed-function blend. When dual-source blending is available, it may also write a
22 * seconday fragment shader output color. When allowed by the backend API, the G rXferProcessor may
23 * read the destination color. The GrXferProcessor is responsible for setting th e blend coefficients
24 * and blend constant color.
25 */
26 class GrXferProcessor : public GrFragmentProcessor {
bsalomon 2014/12/02 15:36:32 Somewhere we need an explanation (from a subclass
egdaniel 2014/12/02 18:09:51 Added below before GrXPFactory.
27 private:
28
29 typedef GrFragmentProcessor INHERITED;
30 };
31
32 class GrXPFactory : public GrProgramElement {
33 public:
34 virtual const GrXferProcessor* createXferProcessor() const = 0;
35
36 /**
37 * This function returns true if the GrXferProcessor generated from this fac tory will be able to
38 * correctly blend when using RGB coverage. The knownColor and knownColorFla gs represent the
39 * final computed color from the color stages.
40 */
41 virtual bool supportsRGBCoverage(GrColor knownColor, uint32_t knownColorFlag s) const = 0;
42
43 private:
44 typedef GrProgramElement INHERITED;
45 };
46
47 ///////////////////////////////////////////////////////////////////////////////
48
49 /**
50 * This creates a factory outside of the effect memory pool. The factory's destr uctor will be called
51 * at global destruction time. NAME will be the name of the created GrXPFactory.
52 */
53 #define GR_CREATE_STATIC_XP_FACTORY(NAME, XPF_CLASS, ARGS) \
54 static SkAlignedSStorage<sizeof(XPF_CLASS)> g_##NAME##_Storage; \
55 static GrXPFactory* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), XPF_CLAS S, ARGS); \
56 static SkAutoTDestroy<GrXPFactory> NAME##_ad(NAME);
57
58 #endif
59
OLDNEW
« no previous file with comments | « include/gpu/GrPaint.h ('k') | src/core/SkXfermode.cpp » ('j') | src/core/SkXfermode.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698