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

Unified Diff: src/gpu/effects/GrBitmapTextGeoProc.cpp

Issue 1110993002: Revert of removing equality / compute invariant loops from GrGeometryProcessors (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanup1
Patch Set: Created 5 years, 8 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 | « src/gpu/effects/GrBitmapTextGeoProc.h ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrBitmapTextGeoProc.cpp
diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp
index db4374cd495feb0d7c69ef180de12ffd86a89b98..25904f753f523f5d6a9ea365cd66eabc3fc63280 100644
--- a/src/gpu/effects/GrBitmapTextGeoProc.cpp
+++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp
@@ -118,8 +118,8 @@
GrBitmapTextGeoProc::GrBitmapTextGeoProc(GrColor color, GrTexture* texture,
const GrTextureParams& params, GrMaskFormat format,
- const SkMatrix& localMatrix)
- : INHERITED(color, SkMatrix::I(), localMatrix)
+ bool opaqueVertexColors, const SkMatrix& localMatrix)
+ : INHERITED(color, SkMatrix::I(), localMatrix, opaqueVertexColors)
, fTextureAccess(texture, params)
, fInColor(NULL)
, fMaskFormat(format) {
@@ -129,10 +129,38 @@
bool hasVertexColor = kA8_GrMaskFormat == fMaskFormat;
if (hasVertexColor) {
fInColor = &this->addVertexAttrib(Attribute("inColor", kVec4ub_GrVertexAttribType));
+ this->setHasVertexColor();
}
fInTextureCoords = &this->addVertexAttrib(Attribute("inTextureCoords",
kVec2s_GrVertexAttribType));
this->addTextureAccess(&fTextureAccess);
+}
+
+bool GrBitmapTextGeoProc::onIsEqual(const GrGeometryProcessor& other) const {
+ const GrBitmapTextGeoProc& gp = other.cast<GrBitmapTextGeoProc>();
+ return SkToBool(this->inColor()) == SkToBool(gp.inColor());
+}
+
+void GrBitmapTextGeoProc::onGetInvariantOutputColor(GrInitInvariantOutput* out) const {
+ if (kARGB_GrMaskFormat == fMaskFormat) {
+ out->setUnknownFourComponents();
+ }
+}
+
+void GrBitmapTextGeoProc::onGetInvariantOutputCoverage(GrInitInvariantOutput* out) const {
+ if (kARGB_GrMaskFormat != fMaskFormat) {
+ if (GrPixelConfigIsAlphaOnly(this->texture(0)->config())) {
+ out->setUnknownSingleComponent();
+ } else if (GrPixelConfigIsOpaque(this->texture(0)->config())) {
+ out->setUnknownOpaqueFourComponents();
+ out->setUsingLCDCoverage();
+ } else {
+ out->setUnknownFourComponents();
+ out->setUsingLCDCoverage();
+ }
+ } else {
+ out->setKnownSingleComponent(0xff);
+ }
}
void GrBitmapTextGeoProc::getGLProcessorKey(const GrBatchTracker& bt,
@@ -152,6 +180,17 @@
local->fInputColorType = GetColorInputType(&local->fColor, this->color(), init,
SkToBool(fInColor));
local->fUsesLocalCoords = init.fUsesLocalCoords;
+}
+
+bool GrBitmapTextGeoProc::onCanMakeEqual(const GrBatchTracker& m,
+ const GrGeometryProcessor& that,
+ const GrBatchTracker& t) const {
+ const BitmapTextBatchTracker& mine = m.cast<BitmapTextBatchTracker>();
+ const BitmapTextBatchTracker& theirs = t.cast<BitmapTextBatchTracker>();
+ return CanCombineLocalMatrices(*this, mine.fUsesLocalCoords,
+ that, theirs.fUsesLocalCoords) &&
+ CanCombineOutput(mine.fInputColorType, mine.fColor,
+ theirs.fInputColorType, theirs.fColor);
}
///////////////////////////////////////////////////////////////////////////////
@@ -192,5 +231,6 @@
}
return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx], params,
- format, GrProcessorUnitTest::TestMatrix(random));
-}
+ format, random->nextBool(),
+ GrProcessorUnitTest::TestMatrix(random));
+}
« no previous file with comments | « src/gpu/effects/GrBitmapTextGeoProc.h ('k') | src/gpu/effects/GrDashingEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698