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 1508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1519 SkASSERT(vertexStride == (fUseDistanceFields ? | 1519 SkASSERT(vertexStride == (fUseDistanceFields ? |
1520 get_vertex_stride_df(fMaskFormat, fUseLCDText)
: | 1520 get_vertex_stride_df(fMaskFormat, fUseLCDText)
: |
1521 get_vertex_stride(fMaskFormat))); | 1521 get_vertex_stride(fMaskFormat))); |
1522 | 1522 |
1523 this->initDraw(batchTarget, gp, pipeline); | 1523 this->initDraw(batchTarget, gp, pipeline); |
1524 | 1524 |
1525 int glyphCount = this->numGlyphs(); | 1525 int glyphCount = this->numGlyphs(); |
1526 int instanceCount = fInstanceCount; | 1526 int instanceCount = fInstanceCount; |
1527 const GrVertexBuffer* vertexBuffer; | 1527 const GrVertexBuffer* vertexBuffer; |
1528 | 1528 |
1529 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, | 1529 void* vertices = batchTarget->makeVertSpace(vertexStride, |
1530 glyphCount * kVert
icesPerGlyph, | 1530 glyphCount * kVerticesPerGly
ph, |
1531 &vertexBuffer, | 1531 &vertexBuffer, |
1532 &flushInfo.fVertex
Offset); | 1532 &flushInfo.fVertexOffset); |
1533 flushInfo.fVertexBuffer.reset(SkRef(vertexBuffer)); | 1533 flushInfo.fVertexBuffer.reset(SkRef(vertexBuffer)); |
1534 flushInfo.fIndexBuffer.reset(batchTarget->resourceProvider()->refQuadInd
exBuffer()); | 1534 flushInfo.fIndexBuffer.reset(batchTarget->resourceProvider()->refQuadInd
exBuffer()); |
1535 if (!vertices || !flushInfo.fVertexBuffer) { | 1535 if (!vertices || !flushInfo.fVertexBuffer) { |
1536 SkDebugf("Could not allocate vertices\n"); | 1536 SkDebugf("Could not allocate vertices\n"); |
1537 return; | 1537 return; |
1538 } | 1538 } |
1539 | 1539 |
1540 unsigned char* currVertex = reinterpret_cast<unsigned char*>(vertices); | 1540 unsigned char* currVertex = reinterpret_cast<unsigned char*>(vertices); |
1541 | 1541 |
1542 // We cache some values to avoid going to the glyphcache for the same fo
ntScaler twice | 1542 // We cache some values to avoid going to the glyphcache for the same fo
ntScaler twice |
(...skipping 609 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 |