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 #ifndef GrAtlasTextBlob_DEFINED | 8 #ifndef GrAtlasTextBlob_DEFINED |
9 #define GrAtlasTextBlob_DEFINED | 9 #define GrAtlasTextBlob_DEFINED |
10 | 10 |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 | 273 |
274 void push_back_run(int currRun) { | 274 void push_back_run(int currRun) { |
275 SkASSERT(currRun < fRunCount); | 275 SkASSERT(currRun < fRunCount); |
276 if (currRun > 0) { | 276 if (currRun > 0) { |
277 Run::SubRunInfo& newRun = fRuns[currRun].fSubRunInfo.back(); | 277 Run::SubRunInfo& newRun = fRuns[currRun].fSubRunInfo.back(); |
278 Run::SubRunInfo& lastRun = fRuns[currRun - 1].fSubRunInfo.back(); | 278 Run::SubRunInfo& lastRun = fRuns[currRun - 1].fSubRunInfo.back(); |
279 newRun.setAsSuccessor(lastRun); | 279 newRun.setAsSuccessor(lastRun); |
280 } | 280 } |
281 } | 281 } |
282 | 282 |
283 void appendGlyph(Run* run, | 283 void appendGlyph(int runIndex, |
284 Run::SubRunInfo* subRun, | 284 const SkRect& positions, |
285 const SkRect& positions, GrColor color, | 285 GrColor color, |
286 size_t vertexStride, bool useVertexColor, | 286 GrBatchTextStrike* strike, |
287 GrGlyph* glyph); | 287 GrGlyph* glyph); |
288 | 288 |
| 289 static size_t GetVertexStride(GrMaskFormat maskFormat) { |
| 290 switch (maskFormat) { |
| 291 case kA8_GrMaskFormat: |
| 292 return kGrayTextVASize; |
| 293 case kARGB_GrMaskFormat: |
| 294 return kColorTextVASize; |
| 295 default: |
| 296 return kLCDTextVASize; |
| 297 } |
| 298 } |
| 299 |
| 300 // position + local coord |
| 301 static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16); |
| 302 static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + si
zeof(SkIPoint16); |
| 303 static const size_t kLCDTextVASize = kGrayTextVASize; |
289 static const int kVerticesPerGlyph = 4; | 304 static const int kVerticesPerGlyph = 4; |
290 | 305 |
291 #ifdef CACHE_SANITY_CHECK | 306 #ifdef CACHE_SANITY_CHECK |
292 static void AssertEqual(const GrAtlasTextBlob&, const GrAtlasTextBlob&); | 307 static void AssertEqual(const GrAtlasTextBlob&, const GrAtlasTextBlob&); |
293 size_t fSize; | 308 size_t fSize; |
294 #endif | 309 #endif |
295 }; | 310 }; |
296 | 311 |
297 #endif | 312 #endif |
OLD | NEW |