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 1808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1819 // TODO remove this when batch is everywhere | 1819 // TODO remove this when batch is everywhere |
1820 GrPipelineInfo init; | 1820 GrPipelineInfo init; |
1821 init.fColorIgnored = fBatch.fColorIgnored; | 1821 init.fColorIgnored = fBatch.fColorIgnored; |
1822 init.fOverrideColor = GrColor_ILLEGAL; | 1822 init.fOverrideColor = GrColor_ILLEGAL; |
1823 init.fCoverageIgnored = fBatch.fCoverageIgnored; | 1823 init.fCoverageIgnored = fBatch.fCoverageIgnored; |
1824 init.fUsesLocalCoords = this->usesLocalCoords(); | 1824 init.fUsesLocalCoords = this->usesLocalCoords(); |
1825 gp->initBatchTracker(batchTarget->currentBatchTracker(), init); | 1825 gp->initBatchTracker(batchTarget->currentBatchTracker(), init); |
1826 } | 1826 } |
1827 | 1827 |
1828 void flush(GrBatchTarget* batchTarget, FlushInfo* flushInfo) { | 1828 void flush(GrBatchTarget* batchTarget, FlushInfo* flushInfo) { |
1829 GrDrawTarget::DrawInfo drawInfo; | 1829 GrVertices vertices; |
1830 int glyphsToFlush = flushInfo->fGlyphsToFlush; | 1830 int glyphsToFlush = flushInfo->fGlyphsToFlush; |
1831 int maxGlyphsPerDraw = flushInfo->fIndexBuffer->maxQuads(); | 1831 int maxGlyphsPerDraw = flushInfo->fIndexBuffer->maxQuads(); |
1832 drawInfo.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuf
fer, | 1832 vertices.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuf
fer, |
1833 flushInfo->fIndexBuffer, flushInfo->fVertexOffset
, | 1833 flushInfo->fIndexBuffer, flushInfo->fVertexOffset
, |
1834 kVerticesPerGlyph, kIndicesPerGlyph, &glyphsToFlu
sh, | 1834 kVerticesPerGlyph, kIndicesPerGlyph, &glyphsToFlu
sh, |
1835 maxGlyphsPerDraw); | 1835 maxGlyphsPerDraw); |
1836 do { | 1836 do { |
1837 batchTarget->draw(drawInfo); | 1837 batchTarget->draw(vertices); |
1838 } while (drawInfo.nextInstances(&glyphsToFlush, maxGlyphsPerDraw)); | 1838 } while (vertices.nextInstances(&glyphsToFlush, maxGlyphsPerDraw)); |
1839 flushInfo->fVertexOffset += kVerticesPerGlyph * flushInfo->fGlyphsToFlus
h; | 1839 flushInfo->fVertexOffset += kVerticesPerGlyph * flushInfo->fGlyphsToFlus
h; |
1840 flushInfo->fGlyphsToFlush = 0; | 1840 flushInfo->fGlyphsToFlush = 0; |
1841 } | 1841 } |
1842 | 1842 |
1843 GrColor color() const { return fBatch.fColor; } | 1843 GrColor color() const { return fBatch.fColor; } |
1844 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } | 1844 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } |
1845 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 1845 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
1846 int numGlyphs() const { return fBatch.fNumGlyphs; } | 1846 int numGlyphs() const { return fBatch.fNumGlyphs; } |
1847 | 1847 |
1848 bool onCombineIfPossible(GrBatch* t) override { | 1848 bool onCombineIfPossible(GrBatch* t) override { |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2152 pipelineBuilder.setFromPaint(grPaint, rt, clip); | 2152 pipelineBuilder.setFromPaint(grPaint, rt, clip); |
2153 | 2153 |
2154 GrColor color = grPaint.getColor(); | 2154 GrColor color = grPaint.getColor(); |
2155 for (int run = 0; run < cacheBlob->fRunCount; run++) { | 2155 for (int run = 0; run < cacheBlob->fRunCount; run++) { |
2156 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, 0, 0, sk
Paint); | 2156 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, 0, 0, sk
Paint); |
2157 } | 2157 } |
2158 | 2158 |
2159 // Now flush big glyphs | 2159 // Now flush big glyphs |
2160 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip, 0, 0); | 2160 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip, 0, 0); |
2161 } | 2161 } |
OLD | NEW |