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

Unified Diff: include/gpu/GrInvariantOutput.h

Issue 791743003: Remove GP from drawstate, revision of invariant output for GP (Closed) Base URL: https://skia.googlesource.com/skia.git@color-to-gp
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: include/gpu/GrInvariantOutput.h
diff --git a/include/gpu/GrInvariantOutput.h b/include/gpu/GrInvariantOutput.h
index 1d3eda1b2cd7f437dcc0345b2a9533e658871465..1e353cc7c157640d587bb7a8c047ed59508566e8 100644
--- a/include/gpu/GrInvariantOutput.h
+++ b/include/gpu/GrInvariantOutput.h
@@ -10,6 +10,44 @@
#include "GrColor.h"
+struct GrInitInvariantOutput {
+ GrInitInvariantOutput()
+ : fValidFlags(0)
+ , fColor(0)
+ , fIsSingleComponent(false) {}
+
+ void setKnownComponents(GrColor color) {
+ fColor = color;
+ fValidFlags = kRGBA_GrColorComponentFlags;
bsalomon 2014/12/09 20:39:50 fSingleComponent = (true if all the values the sam
+ }
+
+ void setKnownAlpha(uint8_t alpha) {
+ fColor |= (fColor >> GrColor_SHIFT_A) | alpha;
bsalomon 2014/12/09 20:39:50 fColor = (alpha << SHIFT_A); right?
+ fValidFlags |= kA_GrColorComponentFlag;
bsalomon 2014/12/09 20:39:50 = not |=, right?
+ }
bsalomon 2014/12/09 20:39:50 fSingleComponent = true;
+
+ void setUnknownAlpha() {
+ fValidFlags &= ~kA_GrColorComponentFlag;
bsalomon 2014/12/09 20:39:50 fValidFlags = 0; fSingleComponent = true;
+ }
+
+ void setUnknown() {
+ fValidFlags = 0;
bsalomon 2014/12/09 20:39:50 fSingleComponent = false; Should we make the name
+ }
+
+ void setOpaque() {
+ fColor |= (fColor >> GrColor_SHIFT_A) | 0xFF;
+ fValidFlags |= kA_GrColorComponentFlag;
bsalomon 2014/12/09 20:39:50 fSingleComponent = false
+ }
+
+ void setIsSingleComponent() { fIsSingleComponent = true; }
bsalomon 2014/12/09 20:39:50 Do we need this two helpers? seems always implied
+
+ void setHasFourComponents() { fIsSingleComponent = false; }
+
+ uint32_t fValidFlags;
+ GrColor fColor;
+ bool fIsSingleComponent;
+};
+
class GrInvariantOutput {
public:
GrInvariantOutput(GrColor color, GrColorComponentFlags flags, bool isSingleComponent)
@@ -20,6 +58,13 @@ public:
, fWillUseInputColor(true)
, fIsLCDCoverage(false) {}
+ GrInvariantOutput(const GrInitInvariantOutput& io)
+ : fColor(io.fColor)
+ , fValidFlags(io.fValidFlags)
+ , fIsSingleComponent(io.fIsSingleComponent)
+ , fNonMulStageFound(false)
+ , fWillUseInputColor(false) {}
+
virtual ~GrInvariantOutput() {}
enum ReadInput {
@@ -34,7 +79,7 @@ public:
} else {
// Since the current state is not opaque we no longer care if the color being
// multiplied is opaque.
- this->mulByUnknownColor();
+ this->mulByUnknownColor();
}
}
@@ -122,6 +167,14 @@ private:
fWillUseInputColor = true;
}
+ void reset(const GrInitInvariantOutput& io) {
+ fColor = io.fColor;
+ fValidFlags = io.fValidFlags;
+ fIsSingleComponent = io.fIsSingleComponent;
+ fNonMulStageFound = false;
+ fWillUseInputColor = true;
+ }
+
void internalSetToTransparentBlack() {
fValidFlags = kRGBA_GrColorComponentFlags;
fColor = 0;

Powered by Google App Engine
This is Rietveld 408576698