| 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 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 | 276 |
| 277 void push_back_run(int currRun) { | 277 void push_back_run(int currRun) { |
| 278 SkASSERT(currRun < fRunCount); | 278 SkASSERT(currRun < fRunCount); |
| 279 if (currRun > 0) { | 279 if (currRun > 0) { |
| 280 Run::SubRunInfo& newRun = fRuns[currRun].fSubRunInfo.back(); | 280 Run::SubRunInfo& newRun = fRuns[currRun].fSubRunInfo.back(); |
| 281 Run::SubRunInfo& lastRun = fRuns[currRun - 1].fSubRunInfo.back(); | 281 Run::SubRunInfo& lastRun = fRuns[currRun - 1].fSubRunInfo.back(); |
| 282 newRun.setAsSuccessor(lastRun); | 282 newRun.setAsSuccessor(lastRun); |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 | 285 |
| 286 // Appends a glyph to the blob. If the glyph is too large, the glyph will b
e appended |
| 287 // as a path. |
| 286 void appendGlyph(int runIndex, | 288 void appendGlyph(int runIndex, |
| 287 const SkRect& positions, | 289 const SkRect& positions, |
| 288 GrColor color, | 290 GrColor color, |
| 289 GrBatchTextStrike* strike, | 291 GrBatchTextStrike* strike, |
| 290 GrGlyph* glyph); | 292 GrGlyph* glyph, |
| 293 GrFontScaler* scaler, const SkGlyph& skGlyph, |
| 294 SkScalar x, SkScalar y, SkScalar scale, bool applyVM); |
| 291 | 295 |
| 292 static size_t GetVertexStride(GrMaskFormat maskFormat) { | 296 static size_t GetVertexStride(GrMaskFormat maskFormat) { |
| 293 switch (maskFormat) { | 297 switch (maskFormat) { |
| 294 case kA8_GrMaskFormat: | 298 case kA8_GrMaskFormat: |
| 295 return kGrayTextVASize; | 299 return kGrayTextVASize; |
| 296 case kARGB_GrMaskFormat: | 300 case kARGB_GrMaskFormat: |
| 297 return kColorTextVASize; | 301 return kColorTextVASize; |
| 298 default: | 302 default: |
| 299 return kLCDTextVASize; | 303 return kLCDTextVASize; |
| 300 } | 304 } |
| 301 } | 305 } |
| 302 | 306 |
| 303 bool mustRegenerate(SkScalar* outTransX, SkScalar* outTransY, const SkPaint&
paint, | 307 bool mustRegenerate(SkScalar* outTransX, SkScalar* outTransY, const SkPaint&
paint, |
| 304 GrColor color, const SkMaskFilter::BlurRec& blurRec, | 308 GrColor color, const SkMaskFilter::BlurRec& blurRec, |
| 305 const SkMatrix& viewMatrix, SkScalar x, SkScalar y); | 309 const SkMatrix& viewMatrix, SkScalar x, SkScalar y); |
| 306 | 310 |
| 307 // position + local coord | 311 // position + local coord |
| 308 static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16); | 312 static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16); |
| 309 static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + si
zeof(SkIPoint16); | 313 static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + si
zeof(SkIPoint16); |
| 310 static const size_t kLCDTextVASize = kGrayTextVASize; | 314 static const size_t kLCDTextVASize = kGrayTextVASize; |
| 311 static const int kVerticesPerGlyph = 4; | 315 static const int kVerticesPerGlyph = 4; |
| 312 | 316 |
| 313 #ifdef CACHE_SANITY_CHECK | 317 #ifdef CACHE_SANITY_CHECK |
| 314 static void AssertEqual(const GrAtlasTextBlob&, const GrAtlasTextBlob&); | 318 static void AssertEqual(const GrAtlasTextBlob&, const GrAtlasTextBlob&); |
| 315 size_t fSize; | 319 size_t fSize; |
| 316 #endif | 320 #endif |
| 321 private: |
| 322 void appendLargeGlyph(GrGlyph* glyph, GrFontScaler* scaler, const SkGlyph& s
kGlyph, |
| 323 SkScalar x, SkScalar y, SkScalar scale, bool applyVM); |
| 317 }; | 324 }; |
| 318 | 325 |
| 319 #endif | 326 #endif |
| OLD | NEW |