Revert of Fix color emoji. (patchset #11 id:320001 of https://codereview.chromium.org/636183005/)
Reason for revert:
Crashing the Windows bots.
Original issue's description:
> Fix color emoji.
>
> Removes the GrMaskFormat and single atlas in GrTextStrike.
> Replaces it by storing the GrMaskFormat in each GrGlyph, and
> doing a lookup for the correct atlas based on that.
>
> Disables color glyph rendering in GrDistanceFieldTextContext
> for now.
>
> BUG=skia:2887
>
> Committed: https://skia.googlesource.com/skia/+/bc92163ddfe957ad6ffbb02ac40e0ba75ff82216
TBR=robertphillips@google.com,bungeman@google.com,reed@google.com,bsalomon@google.com
NOTREECHECKS=true
NOTRY=true
BUG=skia:2887
Review URL: https://codereview.chromium.org/640413004
diff --git a/src/gpu/GrBitmapTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp
index 7cfe917..9478d04 100755
--- a/src/gpu/GrBitmapTextContext.cpp
+++ b/src/gpu/GrBitmapTextContext.cpp
@@ -370,7 +370,7 @@
}
// try to clear out an unused plot before we flush
- if (fContext->getFontCache()->freeUnusedPlot(fStrike, glyph) &&
+ if (fContext->getFontCache()->freeUnusedPlot(fStrike) &&
fStrike->addGlyphToAtlas(glyph, scaler)) {
goto HAS_ATLAS;
}
@@ -386,7 +386,7 @@
fContext->flush();
// we should have an unused plot now
- if (fContext->getFontCache()->freeUnusedPlot(fStrike, glyph) &&
+ if (fContext->getFontCache()->freeUnusedPlot(fStrike) &&
fStrike->addGlyphToAtlas(glyph, scaler)) {
goto HAS_ATLAS;
}
@@ -422,7 +422,6 @@
width = SkIntToFixed(width);
height = SkIntToFixed(height);
- // the current texture/maskformat must match what the glyph needs
GrTexture* texture = glyph->fPlot->texture();
SkASSERT(texture);
@@ -430,10 +429,9 @@
this->flush();
fCurrTexture = texture;
fCurrTexture->ref();
- fCurrMaskFormat = glyph->fMaskFormat;
}
- bool useColorVerts = kA8_GrMaskFormat == fCurrMaskFormat;
+ bool useColorVerts = kA8_GrMaskFormat == fStrike->getMaskFormat();
if (NULL == fVertices) {
// If we need to reserve vertices allow the draw target to suggest
@@ -551,12 +549,12 @@
// This effect could be stored with one of the cache objects (atlas?)
drawState->setGeometryProcessor(fCachedGeometryProcessor.get());
SkASSERT(fStrike);
- switch (fCurrMaskFormat) {
+ switch (fStrike->getMaskFormat()) {
// Color bitmap text
case kARGB_GrMaskFormat:
SkASSERT(!drawState->hasColorVertexAttribute());
drawState->setBlendFunc(fPaint.getSrcBlendCoeff(), fPaint.getDstBlendCoeff());
- drawState->setAlpha(fSkPaint.getAlpha());
+ drawState->setColor(0xffffffff);
break;
// LCD text
case kA888_GrMaskFormat:
@@ -587,7 +585,7 @@
SkASSERT(drawState->hasColorVertexAttribute());
break;
default:
- SkFAIL("Unexpected mask format.");
+ SkFAIL("Unexepected mask format.");
}
int nGlyphs = fCurrVertex / 4;
fDrawTarget->setIndexSourceToBuffer(fContext->getQuadIndexBuffer());