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 "GrBatchFontCache.h" | 9 #include "GrBatchFontCache.h" |
10 #include "GrBatchTarget.h" | 10 #include "GrBatchTarget.h" |
(...skipping 1875 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1886 batchTarget->draw(vertices); | 1886 batchTarget->draw(vertices); |
1887 flushInfo->fVertexOffset += kVerticesPerGlyph * flushInfo->fGlyphsToFlus
h; | 1887 flushInfo->fVertexOffset += kVerticesPerGlyph * flushInfo->fGlyphsToFlus
h; |
1888 flushInfo->fGlyphsToFlush = 0; | 1888 flushInfo->fGlyphsToFlush = 0; |
1889 } | 1889 } |
1890 | 1890 |
1891 GrColor color() const { return fBatch.fColor; } | 1891 GrColor color() const { return fBatch.fColor; } |
1892 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } | 1892 const SkMatrix& viewMatrix() const { return fBatch.fViewMatrix; } |
1893 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } | 1893 bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; } |
1894 int numGlyphs() const { return fBatch.fNumGlyphs; } | 1894 int numGlyphs() const { return fBatch.fNumGlyphs; } |
1895 | 1895 |
1896 bool onCombineIfPossible(GrBatch* t) override { | 1896 bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override { |
1897 if (!this->pipeline()->isEqual(*t->pipeline())) { | 1897 if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipel
ine(), t->bounds(), |
| 1898 caps)) { |
1898 return false; | 1899 return false; |
1899 } | 1900 } |
1900 | 1901 |
1901 TextBatch* that = t->cast<TextBatch>(); | 1902 TextBatch* that = t->cast<TextBatch>(); |
1902 | 1903 |
1903 if (fMaskType != that->fMaskType) { | 1904 if (fMaskType != that->fMaskType) { |
1904 return false; | 1905 return false; |
1905 } | 1906 } |
1906 | 1907 |
1907 if (!this->usesDistanceFields()) { | 1908 if (!this->usesDistanceFields()) { |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2283 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, | 2284 gTextContext->createDrawTextBlob(rt, clip, grPaint, skPaint, viewMat
rix, text, |
2284 static_cast<size_t>(textLen), 0, 0,
noClip)); | 2285 static_cast<size_t>(textLen), 0, 0,
noClip)); |
2285 | 2286 |
2286 SkScalar transX = static_cast<SkScalar>(random->nextU()); | 2287 SkScalar transX = static_cast<SkScalar>(random->nextU()); |
2287 SkScalar transY = static_cast<SkScalar>(random->nextU()); | 2288 SkScalar transY = static_cast<SkScalar>(random->nextU()); |
2288 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0]
; | 2289 const GrAtlasTextBlob::Run::SubRunInfo& info = blob->fRuns[0].fSubRunInfo[0]
; |
2289 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); | 2290 return gTextContext->createBatch(blob, info, textLen, 0, 0, color, transX, t
ransY, skPaint); |
2290 } | 2291 } |
2291 | 2292 |
2292 #endif | 2293 #endif |
OLD | NEW |