OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 #include "GrAtlasTextContext.h" | 7 #include "GrAtlasTextContext.h" |
8 | 8 |
9 #include "GrBatch.h" | 9 #include "GrBatch.h" |
10 #include "GrBatchFontCache.h" | 10 #include "GrBatchFontCache.h" |
(...skipping 1663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1674 // Get the id from the old glyph, and use the new st
rike to lookup | 1674 // Get the id from the old glyph, and use the new st
rike to lookup |
1675 // the glyph. | 1675 // the glyph. |
1676 blob->fGlyphs[glyphOffset] = strike->getGlyph(skGlyp
h, id, scaler); | 1676 blob->fGlyphs[glyphOffset] = strike->getGlyph(skGlyp
h, id, scaler); |
1677 } | 1677 } |
1678 glyph = blob->fGlyphs[glyphOffset]; | 1678 glyph = blob->fGlyphs[glyphOffset]; |
1679 SkASSERT(glyph); | 1679 SkASSERT(glyph); |
1680 SkASSERT(id == glyph->fPackedID && | 1680 SkASSERT(id == glyph->fPackedID && |
1681 glyph->fMaskFormat == this->maskFormat()); | 1681 glyph->fMaskFormat == this->maskFormat()); |
1682 | 1682 |
1683 if (!fFontCache->hasGlyph(glyph) && | 1683 if (!fFontCache->hasGlyph(glyph) && |
1684 !strike->addGlyphToAtlas(batchTarget, glyph, scaler,
skGlyph)) { | 1684 !strike->addGlyphToAtlas(batchTarget, glyph, scaler,
skGlyph, |
| 1685 maskFormat)) { |
1685 this->flush(batchTarget, &flushInfo); | 1686 this->flush(batchTarget, &flushInfo); |
1686 batchTarget->initDraw(gp, pipeline); | 1687 batchTarget->initDraw(gp, pipeline); |
1687 brokenRun = glyphIdx > 0; | 1688 brokenRun = glyphIdx > 0; |
1688 | 1689 |
1689 SkDEBUGCODE(bool success =) strike->addGlyphToAtlas(
batchTarget, | 1690 SkDEBUGCODE(bool success =) strike->addGlyphToAtlas(
batchTarget, |
1690
glyph, | 1691
glyph, |
1691
scaler, | 1692
scaler, |
1692
skGlyph); | 1693
skGlyph, |
| 1694
maskFormat); |
1693 SkASSERT(success); | 1695 SkASSERT(success); |
1694 } | 1696 } |
1695 fFontCache->addGlyphToBulkAndSetUseToken(&info.fBulkUseT
oken, glyph, | 1697 fFontCache->addGlyphToBulkAndSetUseToken(&info.fBulkUseT
oken, glyph, |
1696 batchTarget->cu
rrentToken()); | 1698 batchTarget->cu
rrentToken()); |
1697 | 1699 |
1698 // Texture coords are the last vertex attribute so we ge
t a pointer to the | 1700 // Texture coords are the last vertex attribute so we ge
t a pointer to the |
1699 // first one and then map with stride in regenerateTextu
reCoords | 1701 // first one and then map with stride in regenerateTextu
reCoords |
1700 intptr_t vertex = reinterpret_cast<intptr_t>(blob->fVert
ices); | 1702 intptr_t vertex = reinterpret_cast<intptr_t>(blob->fVert
ices); |
1701 vertex += info.fVertexStartIndex; | 1703 vertex += info.fVertexStartIndex; |
1702 vertex += vertexStride * glyphIdx * kVerticesPerGlyph; | 1704 vertex += vertexStride * glyphIdx * kVerticesPerGlyph; |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2272 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, | 2274 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, |
2273 static_cast<size_t>(textLen), 0, 0,
noClip)); | 2275 static_cast<size_t>(textLen), 0, 0,
noClip)); |
2274 | 2276 |
2275 SkScalar transX = static_cast<SkScalar>(random->nextU()); | 2277 SkScalar transX = static_cast<SkScalar>(random->nextU()); |
2276 SkScalar transY = static_cast<SkScalar>(random->nextU()); | 2278 SkScalar transY = static_cast<SkScalar>(random->nextU()); |
2277 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0]
; | 2279 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0]
; |
2278 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); | 2280 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); |
2279 } | 2281 } |
2280 | 2282 |
2281 #endif | 2283 #endif |
OLD | NEW |