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

Unified Diff: src/gpu/GrFragmentProcessor.cpp

Issue 2324553002: Push usage of GrColor4f into OverrideInput (Closed)
Patch Set: Remove TODO comment Created 4 years, 3 months 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') | src/gpu/SkGr.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrFragmentProcessor.cpp
diff --git a/src/gpu/GrFragmentProcessor.cpp b/src/gpu/GrFragmentProcessor.cpp
index a8a4898e78d99fd7baa3cafbde772f2fc49ac386..c905fcc44f3fb34835c095e20a274799de714214 100644
--- a/src/gpu/GrFragmentProcessor.cpp
+++ b/src/gpu/GrFragmentProcessor.cpp
@@ -259,10 +259,10 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::MulOutputByInputUnpremulColor(
//////////////////////////////////////////////////////////////////////////////
sk_sp<GrFragmentProcessor> GrFragmentProcessor::OverrideInput(sk_sp<GrFragmentProcessor> fp,
- GrColor color) {
+ GrColor4f color) {
class ReplaceInputFragmentProcessor : public GrFragmentProcessor {
public:
- ReplaceInputFragmentProcessor(sk_sp<GrFragmentProcessor> child, GrColor color)
+ ReplaceInputFragmentProcessor(sk_sp<GrFragmentProcessor> child, GrColor4f color)
: fColor(color) {
this->initClassID<ReplaceInputFragmentProcessor>();
this->registerChildProcessor(std::move(child));
@@ -286,24 +286,17 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::OverrideInput(sk_sp<GrFragmentPr
private:
void onSetData(const GrGLSLProgramDataManager& pdman,
const GrProcessor& fp) override {
- GrColor color = fp.cast<ReplaceInputFragmentProcessor>().fColor;
+ GrColor4f color = fp.cast<ReplaceInputFragmentProcessor>().fColor;
if (!fHaveSetColor || color != fPreviousColor) {
- static const float scale = 1.f / 255.f;
- float floatColor[4] = {
- GrColorUnpackR(color) * scale,
- GrColorUnpackG(color) * scale,
- GrColorUnpackB(color) * scale,
- GrColorUnpackA(color) * scale,
- };
- pdman.set4fv(fColorUni, 1, floatColor);
+ pdman.set4fv(fColorUni, 1, color.fRGBA);
fPreviousColor = color;
fHaveSetColor = true;
}
}
GrGLSLProgramDataManager::UniformHandle fColorUni;
- bool fHaveSetColor;
- GrColor fPreviousColor;
+ bool fHaveSetColor;
+ GrColor4f fPreviousColor;
};
return new GLFP;
@@ -318,12 +311,12 @@ sk_sp<GrFragmentProcessor> GrFragmentProcessor::OverrideInput(sk_sp<GrFragmentPr
}
void onComputeInvariantOutput(GrInvariantOutput* inout) const override {
- inout->setToOther(kRGBA_GrColorComponentFlags, fColor,
+ inout->setToOther(kRGBA_GrColorComponentFlags, fColor.toGrColor(),
GrInvariantOutput::kWillNot_ReadInput);
this->childProcessor(0).computeInvariantOutput(inout);
}
- GrColor fColor;
+ GrColor4f fColor;
};
GrInvariantOutput childOut(0x0, kNone_GrColorComponentFlags, false);
« no previous file with comments | « include/gpu/GrFragmentProcessor.h ('k') | src/gpu/SkGr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698