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 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1706 | 1706 |
1707 // Total number of Geometry this Batch owns | 1707 // Total number of Geometry this Batch owns |
1708 int instanceCount() const { return fInstanceCount; } | 1708 int instanceCount() const { return fInstanceCount; } |
1709 SkAutoSTMalloc<kMinAllocated, Geometry>* geoData() { return &fGeoData; } | 1709 SkAutoSTMalloc<kMinAllocated, Geometry>* geoData() { return &fGeoData; } |
1710 | 1710 |
1711 // to avoid even the initial copy of the struct, we have a getter for the fi
rst item which | 1711 // to avoid even the initial copy of the struct, we have a getter for the fi
rst item which |
1712 // is used to seed the batch with its initial geometry. After seeding, the
client should call | 1712 // is used to seed the batch with its initial geometry. After seeding, the
client should call |
1713 // init() so the Batch can initialize itself | 1713 // init() so the Batch can initialize itself |
1714 Geometry& geometry() { return fGeoData[0]; } | 1714 Geometry& geometry() { return fGeoData[0]; } |
1715 void init() { | 1715 void init() { |
1716 fBatch.fColor = fGeoData[0].fColor; | 1716 const Geometry& geo = fGeoData[0]; |
1717 fBatch.fViewMatrix = fGeoData[0].fBlob->fViewMatrix; | 1717 fBatch.fColor = geo.fColor; |
1718 this->setBounds(fGeoData[0].fBlob->fRuns[fGeoData[0].fRun].fVertexBounds
); | 1718 fBatch.fViewMatrix = geo.fBlob->fViewMatrix; |
| 1719 |
| 1720 // We don't yet position distance field text on the cpu, so we have to m
ap the vertex bounds |
| 1721 // into device space |
| 1722 const Run& run = geo.fBlob->fRuns[geo.fRun]; |
| 1723 if (run.fSubRunInfo[geo.fSubRun].fDrawAsDistanceFields) { |
| 1724 SkRect bounds = run.fVertexBounds; |
| 1725 fBatch.fViewMatrix.mapRect(&bounds); |
| 1726 this->setBounds(bounds); |
| 1727 } else { |
| 1728 this->setBounds(run.fVertexBounds); |
| 1729 } |
1719 } | 1730 } |
1720 | 1731 |
1721 private: | 1732 private: |
1722 BitmapTextBatch(GrMaskFormat maskFormat, int glyphCount, GrBatchFontCache* f
ontCache) | 1733 BitmapTextBatch(GrMaskFormat maskFormat, int glyphCount, GrBatchFontCache* f
ontCache) |
1723 : fMaskFormat(maskFormat) | 1734 : fMaskFormat(maskFormat) |
1724 , fPixelConfig(fontCache->getPixelConfig(maskFormat)) | 1735 , fPixelConfig(fontCache->getPixelConfig(maskFormat)) |
1725 , fFontCache(fontCache) | 1736 , fFontCache(fontCache) |
1726 , fUseDistanceFields(false) { | 1737 , fUseDistanceFields(false) { |
1727 this->initClassID<BitmapTextBatch>(); | 1738 this->initClassID<BitmapTextBatch>(); |
1728 fBatch.fNumGlyphs = glyphCount; | 1739 fBatch.fNumGlyphs = glyphCount; |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2152 pipelineBuilder.setFromPaint(grPaint, rt, clip); | 2163 pipelineBuilder.setFromPaint(grPaint, rt, clip); |
2153 | 2164 |
2154 GrColor color = grPaint.getColor(); | 2165 GrColor color = grPaint.getColor(); |
2155 for (int run = 0; run < cacheBlob->fRunCount; run++) { | 2166 for (int run = 0; run < cacheBlob->fRunCount; run++) { |
2156 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, 0, 0, sk
Paint); | 2167 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, 0, 0, sk
Paint); |
2157 } | 2168 } |
2158 | 2169 |
2159 // Now flush big glyphs | 2170 // Now flush big glyphs |
2160 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip, 0, 0); | 2171 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip, 0, 0); |
2161 } | 2172 } |
OLD | NEW |