diff options
author | Brian Salomon <bsalomon@google.com> | 2017-01-17 10:44:34 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-01-17 16:15:00 +0000 |
commit | aab259ea9ecabb3addcade3fba72d777bc7673e8 (patch) | |
tree | 0bff151c79e5833805792c8839207197f36f3d47 /src/gpu/GrProcOptInfo.h | |
parent | 46784be70c4712942163bb2ade9e7364bca47157 (diff) |
Simplify GrProcOptInfo initialization.
Removes unused single channel tracking.
Makes it so that only the op/gp can initiate lcd coverage.
Makes GrProcOptInfo fragment processor analysis continuable.
Change-Id: I003a8aa3836bb64d04b230ddee581dc500e613a9
Reviewed-on: https://skia-review.googlesource.com/7039
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrProcOptInfo.h')
-rw-r--r-- | src/gpu/GrProcOptInfo.h | 59 |
1 files changed, 35 insertions, 24 deletions
diff --git a/src/gpu/GrProcOptInfo.h b/src/gpu/GrProcOptInfo.h index d70ec46cc9..8149f2c1c6 100644 --- a/src/gpu/GrProcOptInfo.h +++ b/src/gpu/GrProcOptInfo.h @@ -22,33 +22,35 @@ class GrPrimitiveProcessor; */ class GrProcOptInfo { public: - GrProcOptInfo() - : fInOut(0, static_cast<GrColorComponentFlags>(0), false) - , fFirstEffectiveProcessorIndex(0) - , fInputColorIsUsed(true) - , fInputColor(0) {} + GrProcOptInfo() : fInOut(0, static_cast<GrColorComponentFlags>(0)) {} - void calcWithInitialValues(const GrFragmentProcessor* const *, int cnt, GrColor startColor, - GrColorComponentFlags, bool areCoverageStages, bool isLCD = false); - void initFromPipelineInput(const GrPipelineInput& input) { fInOut.reset(input); } - void completeCalculations(const GrFragmentProcessor * const processors[], int cnt); + GrProcOptInfo(GrColor color, GrColorComponentFlags colorFlags) + : fInOut(color, colorFlags), fInputColor(color) {} + + void resetToLCDCoverage(GrColor color, GrColorComponentFlags colorFlags) { + this->internalReset(color, colorFlags, true); + } + + void reset(GrColor color, GrColorComponentFlags colorFlags) { + this->internalReset(color, colorFlags, false); + } + + void reset(const GrPipelineInput& input) { + this->internalReset(input.fColor, input.fValidFlags, input.fIsLCDCoverage); + } + + /** + * Runs through a series of processors and updates calculated values. This can be called + * repeatedly for cases when the sequence of processors is not in a contiguous array. + */ + void addProcessors(const GrFragmentProcessor* const* processors, int cnt); bool isSolidWhite() const { return fInOut.isSolidWhite(); } bool isOpaque() const { return fInOut.isOpaque(); } - bool isSingleComponent() const { return fInOut.isSingleComponent(); } bool allStagesMultiplyInput() const { return fInOut.allStagesMulInput(); } - - // TODO: Once texture pixel configs quaries are updated, we no longer need this function. - // For now this function will correctly tell us if we are using LCD text or not and should only - // be called when looking at the coverage output. - bool isFourChannelOutput() const { return !fInOut.isSingleComponent() && - fInOut.isLCDCoverage(); } - + bool isLCDCoverage() const { return fIsLCDCoverage; } GrColor color() const { return fInOut.color(); } - - GrColorComponentFlags validFlags() const { - return fInOut.validFlags(); - } + GrColorComponentFlags validFlags() const { return fInOut.validFlags(); } /** * Returns the index of the first effective color processor. If an intermediate processor @@ -74,12 +76,21 @@ public: GrColor inputColorToFirstEffectiveProccesor() const { return fInputColor; } private: + void internalReset(GrColor color, GrColorComponentFlags colorFlags, bool isLCDCoverage) { + fInOut.reset(color, colorFlags); + fFirstEffectiveProcessorIndex = 0; + fInputColorIsUsed = true; + fInputColor = color; + fIsLCDCoverage = isLCDCoverage; + } + void internalCalc(const GrFragmentProcessor* const[], int cnt); GrInvariantOutput fInOut; - int fFirstEffectiveProcessorIndex; - bool fInputColorIsUsed; - GrColor fInputColor; + int fFirstEffectiveProcessorIndex = 0; + bool fInputColorIsUsed = true; + bool fIsLCDCoverage = false; + GrColor fInputColor = 0; }; #endif |