aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrBitmapTextContext.cpp
diff options
context:
space:
mode:
authorGravatar jvanverth <jvanverth@google.com>2014-10-10 11:36:12 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-10-10 11:36:12 -0700
commit294c32612d712eb56361ac5439271a91ae96862e (patch)
tree296fe453480d2c47365ff64a05d6e79aa04c657e /src/gpu/GrBitmapTextContext.cpp
parent71856d520461ae025a0332aa0ce9735a096d9baf (diff)
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 Review URL: https://codereview.chromium.org/636183005
Diffstat (limited to 'src/gpu/GrBitmapTextContext.cpp')
-rwxr-xr-xsrc/gpu/GrBitmapTextContext.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/gpu/GrBitmapTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp
index 9478d0436c..7cfe91771f 100755
--- a/src/gpu/GrBitmapTextContext.cpp
+++ b/src/gpu/GrBitmapTextContext.cpp
@@ -370,7 +370,7 @@ void GrBitmapTextContext::appendGlyph(GrGlyph::PackedID packed,
}
// try to clear out an unused plot before we flush
- if (fContext->getFontCache()->freeUnusedPlot(fStrike) &&
+ if (fContext->getFontCache()->freeUnusedPlot(fStrike, glyph) &&
fStrike->addGlyphToAtlas(glyph, scaler)) {
goto HAS_ATLAS;
}
@@ -386,7 +386,7 @@ void GrBitmapTextContext::appendGlyph(GrGlyph::PackedID packed,
fContext->flush();
// we should have an unused plot now
- if (fContext->getFontCache()->freeUnusedPlot(fStrike) &&
+ if (fContext->getFontCache()->freeUnusedPlot(fStrike, glyph) &&
fStrike->addGlyphToAtlas(glyph, scaler)) {
goto HAS_ATLAS;
}
@@ -422,6 +422,7 @@ HAS_ATLAS:
width = SkIntToFixed(width);
height = SkIntToFixed(height);
+ // the current texture/maskformat must match what the glyph needs
GrTexture* texture = glyph->fPlot->texture();
SkASSERT(texture);
@@ -429,9 +430,10 @@ HAS_ATLAS:
this->flush();
fCurrTexture = texture;
fCurrTexture->ref();
+ fCurrMaskFormat = glyph->fMaskFormat;
}
- bool useColorVerts = kA8_GrMaskFormat == fStrike->getMaskFormat();
+ bool useColorVerts = kA8_GrMaskFormat == fCurrMaskFormat;
if (NULL == fVertices) {
// If we need to reserve vertices allow the draw target to suggest
@@ -549,12 +551,12 @@ void GrBitmapTextContext::flush() {
// This effect could be stored with one of the cache objects (atlas?)
drawState->setGeometryProcessor(fCachedGeometryProcessor.get());
SkASSERT(fStrike);
- switch (fStrike->getMaskFormat()) {
+ switch (fCurrMaskFormat) {
// Color bitmap text
case kARGB_GrMaskFormat:
SkASSERT(!drawState->hasColorVertexAttribute());
drawState->setBlendFunc(fPaint.getSrcBlendCoeff(), fPaint.getDstBlendCoeff());
- drawState->setColor(0xffffffff);
+ drawState->setAlpha(fSkPaint.getAlpha());
break;
// LCD text
case kA888_GrMaskFormat:
@@ -585,7 +587,7 @@ void GrBitmapTextContext::flush() {
SkASSERT(drawState->hasColorVertexAttribute());
break;
default:
- SkFAIL("Unexepected mask format.");
+ SkFAIL("Unexpected mask format.");
}
int nGlyphs = fCurrVertex / 4;
fDrawTarget->setIndexSourceToBuffer(fContext->getQuadIndexBuffer());