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

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: more windows fix 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
« no previous file with comments | « include/gpu/GrFragmentProcessor.h ('k') | include/gpu/GrProcessor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrInvariantOutput.h
diff --git a/include/gpu/GrInvariantOutput.h b/include/gpu/GrInvariantOutput.h
index 1d3eda1b2cd7f437dcc0345b2a9533e658871465..269748a026c8f35b5b80cc02895b513f6c98d9de 100644
--- a/include/gpu/GrInvariantOutput.h
+++ b/include/gpu/GrInvariantOutput.h
@@ -10,6 +10,49 @@
#include "GrColor.h"
+struct GrInitInvariantOutput {
+ GrInitInvariantOutput()
+ : fValidFlags(0)
+ , fColor(0)
+ , fIsSingleComponent(false)
+ , fIsLCDCoverage(false) {}
+
+ void setKnownFourComponents(GrColor color) {
+ fColor = color;
+ fValidFlags = kRGBA_GrColorComponentFlags;
+ fIsSingleComponent = false;
+ }
+
+ void setUnknownFourComponents() {
+ fValidFlags = 0;
+ fIsSingleComponent = false;
+ }
+
+ void setUnknownOpaqueFourComponents() {
+ fColor = 0xff << GrColor_SHIFT_A;
+ fValidFlags = kA_GrColorComponentFlag;
+ fIsSingleComponent = false;
+ }
+
+ void setKnownSingleComponent(uint8_t alpha) {
+ fColor = GrColorPackRGBA(alpha, alpha, alpha, alpha);
+ fValidFlags = kRGBA_GrColorComponentFlags;
+ fIsSingleComponent = true;
+ }
+
+ void setUnknownSingleComponent() {
+ fValidFlags = 0;
+ fIsSingleComponent = true;
+ }
+
+ void setUsingLCDCoverage() { fIsLCDCoverage = true; }
+
+ uint32_t fValidFlags;
+ GrColor fColor;
+ bool fIsSingleComponent;
+ bool fIsLCDCoverage; // Temorary data member until texture pixel configs are updated
+};
+
class GrInvariantOutput {
public:
GrInvariantOutput(GrColor color, GrColorComponentFlags flags, bool isSingleComponent)
@@ -20,6 +63,14 @@ public:
, fWillUseInputColor(true)
, fIsLCDCoverage(false) {}
+ GrInvariantOutput(const GrInitInvariantOutput& io)
+ : fColor(io.fColor)
+ , fValidFlags(io.fValidFlags)
+ , fIsSingleComponent(io.fIsSingleComponent)
+ , fNonMulStageFound(false)
+ , fWillUseInputColor(false)
+ , fIsLCDCoverage(io.fIsLCDCoverage) {}
+
virtual ~GrInvariantOutput() {}
enum ReadInput {
@@ -27,18 +78,18 @@ public:
kWillNot_ReadInput,
};
- void mulByUnknownOpaqueColor() {
+ void mulByUnknownOpaqueFourComponents() {
if (this->isOpaque()) {
fValidFlags = kA_GrColorComponentFlag;
fIsSingleComponent = false;
} else {
// Since the current state is not opaque we no longer care if the color being
// multiplied is opaque.
- this->mulByUnknownColor();
+ this->mulByUnknownFourComponents();
}
}
- void mulByUnknownColor() {
+ void mulByUnknownFourComponents() {
if (this->hasZeroAlpha()) {
this->internalSetToTransparentBlack();
} else {
@@ -46,7 +97,7 @@ public:
}
}
- void mulByUnknownAlpha() {
+ void mulByUnknownSingleComponent() {
if (this->hasZeroAlpha()) {
this->internalSetToTransparentBlack();
} else {
@@ -55,7 +106,7 @@ public:
}
}
- void mulByKnownAlpha(uint8_t alpha) {
+ void mulByKnownSingleComponent(uint8_t alpha) {
if (this->hasZeroAlpha() || 0 == alpha) {
this->internalSetToTransparentBlack();
} else {
@@ -122,6 +173,15 @@ private:
fWillUseInputColor = true;
}
+ void reset(const GrInitInvariantOutput& io) {
+ fColor = io.fColor;
+ fValidFlags = io.fValidFlags;
+ fIsSingleComponent = io.fIsSingleComponent;
+ fNonMulStageFound = false;
+ fWillUseInputColor = true;
+ fIsLCDCoverage = io.fIsLCDCoverage;
+ }
+
void internalSetToTransparentBlack() {
fValidFlags = kRGBA_GrColorComponentFlags;
fColor = 0;
« no previous file with comments | « include/gpu/GrFragmentProcessor.h ('k') | include/gpu/GrProcessor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698