| 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 1820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1831 GrPipelineInfo init; | 1831 GrPipelineInfo init; |
| 1832 init.fColorIgnored = fBatch.fColorIgnored; | 1832 init.fColorIgnored = fBatch.fColorIgnored; |
| 1833 init.fOverrideColor = GrColor_ILLEGAL; | 1833 init.fOverrideColor = GrColor_ILLEGAL; |
| 1834 init.fCoverageIgnored = fBatch.fCoverageIgnored; | 1834 init.fCoverageIgnored = fBatch.fCoverageIgnored; |
| 1835 init.fUsesLocalCoords = this->usesLocalCoords(); | 1835 init.fUsesLocalCoords = this->usesLocalCoords(); |
| 1836 gp->initBatchTracker(batchTarget->currentBatchTracker(), init); | 1836 gp->initBatchTracker(batchTarget->currentBatchTracker(), init); |
| 1837 } | 1837 } |
| 1838 | 1838 |
| 1839 void flush(GrBatchTarget* batchTarget, FlushInfo* flushInfo) { | 1839 void flush(GrBatchTarget* batchTarget, FlushInfo* flushInfo) { |
| 1840 GrVertices vertices; | 1840 GrVertices vertices; |
| 1841 int glyphsToFlush = flushInfo->fGlyphsToFlush; | |
| 1842 int maxGlyphsPerDraw = flushInfo->fIndexBuffer->maxQuads(); | 1841 int maxGlyphsPerDraw = flushInfo->fIndexBuffer->maxQuads(); |
| 1843 vertices.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuf
fer, | 1842 vertices.initInstanced(kTriangles_GrPrimitiveType, flushInfo->fVertexBuf
fer, |
| 1844 flushInfo->fIndexBuffer, flushInfo->fVertexOffset
, | 1843 flushInfo->fIndexBuffer, flushInfo->fVertexOffset
, |
| 1845 kVerticesPerGlyph, kIndicesPerGlyph, &glyphsToFlu
sh, | 1844 kVerticesPerGlyph, kIndicesPerGlyph, flushInfo->f
GlyphsToFlush, |
| 1846 maxGlyphsPerDraw); | 1845 maxGlyphsPerDraw); |
| 1847 do { | 1846 batchTarget->draw(vertices); |
| 1848 batchTarget->draw(vertices); | |
| 1849 } while (vertices.nextInstances(&glyphsToFlush, maxGlyphsPerDraw)); | |
| 1850 flushInfo->fVertexOffset += kVerticesPerGlyph * flushInfo->fGlyphsToFlus
h; | 1847 flushInfo->fVertexOffset += kVerticesPerGlyph * flushInfo->fGlyphsToFlus
h; |
| 1851 flushInfo->fGlyphsToFlush = 0; | 1848 flushInfo->fGlyphsToFlush = 0; |
| 1852 } | 1849 } |
| 1853 | 1850 |
| 1854 GrColor color() const { return fBatch.fColor; } | 1851 GrColor color() const { return fBatch.fColor; } |
| 1855 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } | 1852 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } |
| 1856 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 1853 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
| 1857 int numGlyphs() const { return fBatch.fNumGlyphs; } | 1854 int numGlyphs() const { return fBatch.fNumGlyphs; } |
| 1858 | 1855 |
| 1859 bool onCombineIfPossible(GrBatch* t) override { | 1856 bool onCombineIfPossible(GrBatch* t) override { |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2163 pipelineBuilder.setFromPaint(grPaint, rt, clip); | 2160 pipelineBuilder.setFromPaint(grPaint, rt, clip); |
| 2164 | 2161 |
| 2165 GrColor color = grPaint.getColor(); | 2162 GrColor color = grPaint.getColor(); |
| 2166 for (int run = 0; run < cacheBlob->fRunCount; run++) { | 2163 for (int run = 0; run < cacheBlob->fRunCount; run++) { |
| 2167 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, 0, 0, sk
Paint); | 2164 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, 0, 0, sk
Paint); |
| 2168 } | 2165 } |
| 2169 | 2166 |
| 2170 // Now flush big glyphs | 2167 // Now flush big glyphs |
| 2171 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip, 0, 0); | 2168 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip, 0, 0); |
| 2172 } | 2169 } |
| OLD | NEW |