Index: include/gpu/GrProcessor.h |
diff --git a/include/gpu/GrProcessor.h b/include/gpu/GrProcessor.h |
index c1755a895472a9973315de9bc575fc90fb928eca..c8ea02084a1026b45ac8a8aa48d477a559294221 100644 |
--- a/include/gpu/GrProcessor.h |
+++ b/include/gpu/GrProcessor.h |
@@ -44,6 +44,45 @@ public: |
InvariantOutput() : fColor(0), fValidFlags(0), fIsSingleComponent(false) {} |
+ void mulByUnknownOpaqueColor() { |
+ 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(); |
+ } |
+ } |
+ |
+ void mulByUnknownColor() { |
+ if (this->hasZeroAlpha()) { |
+ this->transparentBlackOutput(); |
+ } else { |
+ this->unknownOutput(); |
+ } |
+ } |
+ |
+ void mulByUnknownAlpha() { |
+ if (this->hasZeroAlpha()) { |
+ this->transparentBlackOutput(); |
+ } else { |
+ // We don't need to change fIsSingleComponent in this case |
+ fValidFlags = 0; |
+ } |
+ } |
+ |
+ void transparentBlackOutput() { |
bsalomon
2014/10/10 19:48:16
setToTransparentBlack() ?
egdaniel
2014/10/13 16:44:57
Done.
|
+ fValidFlags = kRGBA_GrColorComponentFlags; |
+ fColor = 0; |
+ fIsSingleComponent = true; |
+ } |
+ |
+ void unknownOutput() { |
bsalomon
2014/10/10 19:48:16
setUnknownOutput?
(just trying to avoid confusion
egdaniel
2014/10/13 16:44:57
Done.
|
+ fValidFlags = 0; |
+ fIsSingleComponent = false; |
+ } |
+ |
bool isOpaque() const { |
return ((fValidFlags & kA_GrColorComponentFlag) && 0xFF == GrColorUnpackA(fColor)); |
} |
@@ -59,8 +98,11 @@ public: |
SkDEBUGCODE(void validate() const;) |
private: |
- SkDEBUGCODE(bool colorComponentsAllEqual() const;) |
+ bool hasZeroAlpha() const { |
+ return ((fValidFlags & kA_GrColorComponentFlag) && 0 == GrColorUnpackA(fColor)); |
+ } |
+ SkDEBUGCODE(bool colorComponentsAllEqual() const;) |
/** |
* If alpha is valid, check that any valid R,G,B values are <= A |
*/ |