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

Unified Diff: src/gpu/batches/GrAtlasTextBatch.cpp

Issue 1514563002: Revert of Allow LCD text to batch across colorchanges. This will always use (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 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 | « src/gpu/batches/GrAtlasTextBatch.h ('k') | src/gpu/effects/GrBitmapTextGeoProc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrAtlasTextBatch.cpp
diff --git a/src/gpu/batches/GrAtlasTextBatch.cpp b/src/gpu/batches/GrAtlasTextBatch.cpp
index 685cddcf0cb0ad268c9cb76e6d24c0deb71a0efc..b1ec1f8ef5fada21903083d212ebe40f4c670a83 100644
--- a/src/gpu/batches/GrAtlasTextBatch.cpp
+++ b/src/gpu/batches/GrAtlasTextBatch.cpp
@@ -312,10 +312,12 @@
return;
}
+ bool usesDistanceFields = this->usesDistanceFields();
GrMaskFormat maskFormat = this->maskFormat();
+ bool isLCD = this->isLCD();
SkAutoTUnref<const GrGeometryProcessor> gp;
- if (this->usesDistanceFields()) {
+ if (usesDistanceFields) {
gp.reset(this->setupDfProcessor(this->viewMatrix(), fFilteredColor, this->color(),
texture));
} else {
@@ -331,7 +333,9 @@
FlushInfo flushInfo;
flushInfo.fGlyphsToFlush = 0;
size_t vertexStride = gp->getVertexStride();
- SkASSERT(vertexStride == GetVertexStride(maskFormat));
+ SkASSERT(vertexStride == (usesDistanceFields ?
+ GetVertexStrideDf(maskFormat, isLCD) :
+ GetVertexStride(maskFormat)));
target->initDraw(gp, this->pipeline());
@@ -377,8 +381,12 @@
bool regenerateGlyphs = info.strike()->isAbandoned();
bool regenerateTextureCoords = info.atlasGeneration() != currentAtlasGen ||
regenerateGlyphs;
- bool regenerateColors = kARGB_GrMaskFormat != maskFormat &&
- run.fColor != args.fColor;
+ bool regenerateColors;
+ if (usesDistanceFields) {
+ regenerateColors = !isLCD && run.fColor != args.fColor;
+ } else {
+ regenerateColors = kA8_GrMaskFormat == maskFormat && run.fColor != args.fColor;
+ }
bool regeneratePositions = args.fTransX != 0.f || args.fTransY != 0.f;
int glyphCount = info.glyphCount();
@@ -451,7 +459,9 @@
}
if (!this->usesDistanceFields()) {
- if (kColorBitmapMask_MaskType == fMaskType && this->color() != that->color()) {
+ // TODO we can often batch across LCD text if we have dual source blending and don't
+ // have to use the blend constant
+ if (kGrayscaleCoverageMask_MaskType != fMaskType && this->color() != that->color()) {
return false;
}
if (this->usesLocalCoords() && !this->viewMatrix().cheapEqualTo(that->viewMatrix())) {
@@ -467,6 +477,11 @@
}
if (fUseBGR != that->fUseBGR) {
+ return false;
+ }
+
+ // TODO see note above
+ if (kLCDDistanceField_MaskType == fMaskType && this->color() != that->color()) {
return false;
}
}
@@ -515,7 +530,6 @@
flags |= kUseLCD_DistanceFieldEffectFlag;
flags |= viewMatrix.rectStaysRect() ? kRectToRect_DistanceFieldEffectFlag : 0;
flags |= fUseBGR ? kBGR_DistanceFieldEffectFlag : 0;
- flags |= kColorAttr_DistanceFieldEffectFlag;
GrColor colorNoPreMul = skcolor_to_grcolor_nopremultiply(filteredColor);
« no previous file with comments | « src/gpu/batches/GrAtlasTextBatch.h ('k') | src/gpu/effects/GrBitmapTextGeoProc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698