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 | 7 |
8 #include "GrTextUtils.h" | 8 #include "GrTextUtils.h" |
9 | 9 |
10 #include "GrAtlasTextBlob.h" | 10 #include "GrAtlasTextBlob.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 const SkMatrix& viewMatrix, | 28 const SkMatrix& viewMatrix, |
29 const char text[], size_t byteLength, | 29 const char text[], size_t byteLength, |
30 SkScalar x, SkScalar y) { | 30 SkScalar x, SkScalar y) { |
31 SkASSERT(byteLength == 0 || text != nullptr); | 31 SkASSERT(byteLength == 0 || text != nullptr); |
32 | 32 |
33 // nothing to draw | 33 // nothing to draw |
34 if (text == nullptr || byteLength == 0) { | 34 if (text == nullptr || byteLength == 0) { |
35 return; | 35 return; |
36 } | 36 } |
37 | 37 |
| 38 // Ensure the blob is set for bitmaptext |
| 39 blob->setHasBitmap(); |
| 40 |
38 GrBatchTextStrike* currStrike = nullptr; | 41 GrBatchTextStrike* currStrike = nullptr; |
39 | 42 |
40 // Get GrFontScaler from cache | 43 // Get GrFontScaler from cache |
41 SkGlyphCache* cache = blob->setupCache(runIndex, props, skPaint, &viewMatrix
, false); | 44 SkGlyphCache* cache = blob->setupCache(runIndex, props, skPaint, &viewMatrix
, false); |
42 GrFontScaler* fontScaler = GrTextContext::GetGrFontScaler(cache); | 45 GrFontScaler* fontScaler = GrTextContext::GetGrFontScaler(cache); |
43 | 46 |
44 SkFindAndPlaceGlyph::ProcessText( | 47 SkFindAndPlaceGlyph::ProcessText( |
45 skPaint.getTextEncoding(), text, byteLength, | 48 skPaint.getTextEncoding(), text, byteLength, |
46 {x, y}, viewMatrix, skPaint.getTextAlign(), | 49 {x, y}, viewMatrix, skPaint.getTextAlign(), |
47 cache, | 50 cache, |
(...skipping 18 matching lines...) Expand all Loading... |
66 const SkScalar pos[], int scalarsPerPosition, | 69 const SkScalar pos[], int scalarsPerPosition, |
67 const SkPoint& offset) { | 70 const SkPoint& offset) { |
68 SkASSERT(byteLength == 0 || text != nullptr); | 71 SkASSERT(byteLength == 0 || text != nullptr); |
69 SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition); | 72 SkASSERT(1 == scalarsPerPosition || 2 == scalarsPerPosition); |
70 | 73 |
71 // nothing to draw | 74 // nothing to draw |
72 if (text == nullptr || byteLength == 0) { | 75 if (text == nullptr || byteLength == 0) { |
73 return; | 76 return; |
74 } | 77 } |
75 | 78 |
| 79 // Ensure the blob is set for bitmaptext |
| 80 blob->setHasBitmap(); |
| 81 |
76 GrBatchTextStrike* currStrike = nullptr; | 82 GrBatchTextStrike* currStrike = nullptr; |
77 | 83 |
78 // Get GrFontScaler from cache | 84 // Get GrFontScaler from cache |
79 SkGlyphCache* cache = blob->setupCache(runIndex, props, skPaint, &viewMatrix
, false); | 85 SkGlyphCache* cache = blob->setupCache(runIndex, props, skPaint, &viewMatrix
, false); |
80 GrFontScaler* fontScaler = GrTextContext::GetGrFontScaler(cache); | 86 GrFontScaler* fontScaler = GrTextContext::GetGrFontScaler(cache); |
81 | 87 |
82 SkFindAndPlaceGlyph::ProcessPosText( | 88 SkFindAndPlaceGlyph::ProcessPosText( |
83 skPaint.getTextEncoding(), text, byteLength, | 89 skPaint.getTextEncoding(), text, byteLength, |
84 offset, viewMatrix, pos, scalarsPerPosition, | 90 offset, viewMatrix, pos, scalarsPerPosition, |
85 skPaint.getTextAlign(), cache, | 91 skPaint.getTextAlign(), cache, |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 203 |
198 matrix[SkMatrix::kMTransX] = loc.fX; | 204 matrix[SkMatrix::kMTransX] = loc.fX; |
199 matrix[SkMatrix::kMTransY] = loc.fY; | 205 matrix[SkMatrix::kMTransY] = loc.fY; |
200 GrBlurUtils::drawPathWithMaskFilter(context, dc, clip, *path, pa
int, | 206 GrBlurUtils::drawPathWithMaskFilter(context, dc, clip, *path, pa
int, |
201 viewMatrix, &matrix, clipBou
nds, false); | 207 viewMatrix, &matrix, clipBou
nds, false); |
202 } | 208 } |
203 } | 209 } |
204 pos += scalarsPerPosition; | 210 pos += scalarsPerPosition; |
205 } | 211 } |
206 } | 212 } |
OLD | NEW |