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 SkFindAndPositionGlyph_DEFINED | 8 #ifndef SkFindAndPositionGlyph_DEFINED |
9 #define SkFindAndPositionGlyph_DEFINED | 9 #define SkFindAndPositionGlyph_DEFINED |
10 | 10 |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 | 360 |
361 // The "call" to SkFixedToScalar is actually a macro. It's macros all the wa
y down. | 361 // The "call" to SkFixedToScalar is actually a macro. It's macros all the wa
y down. |
362 // Needs to be a macro because you can't have a const float unless you make
it constexpr. | 362 // Needs to be a macro because you can't have a const float unless you make
it constexpr. |
363 #define kSubpixelRounding (SkFixedToScalar(SkGlyph::kSubpixelRound)) | 363 #define kSubpixelRounding (SkFixedToScalar(SkGlyph::kSubpixelRound)) |
364 | 364 |
365 // The SubpixelPositionRounding function returns a point suitable for roundi
ng a sub-pixel | 365 // The SubpixelPositionRounding function returns a point suitable for roundi
ng a sub-pixel |
366 // positioned glyph. | 366 // positioned glyph. |
367 static SkPoint SubpixelPositionRounding(SkAxisAlignment axisAlignment) { | 367 static SkPoint SubpixelPositionRounding(SkAxisAlignment axisAlignment) { |
368 switch (axisAlignment) { | 368 switch (axisAlignment) { |
369 case kX_SkAxisAlignment: | 369 case kX_SkAxisAlignment: |
370 return {SkFixedToScalar(SkGlyph::kSubpixelRound), SK_ScalarHalf}
; | 370 return {kSubpixelRounding, SK_ScalarHalf}; |
371 case kY_SkAxisAlignment: | 371 case kY_SkAxisAlignment: |
372 return {SK_ScalarHalf, kSubpixelRounding}; | 372 return {SK_ScalarHalf, kSubpixelRounding}; |
373 case kNone_SkAxisAlignment: | 373 case kNone_SkAxisAlignment: |
374 return {kSubpixelRounding, kSubpixelRounding}; | 374 return {kSubpixelRounding, kSubpixelRounding}; |
375 } | 375 } |
376 SkFAIL("Should not get here."); | 376 SkFAIL("Should not get here."); |
377 return {0.0f, 0.0f}; | 377 return {0.0f, 0.0f}; |
378 } | 378 } |
379 | 379 |
380 // The SubpixelAlignment function produces a suitable position for the glyph
cache to | 380 // The SubpixelAlignment function produces a suitable position for the glyph
cache to |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 SkPoint current = offset; | 725 SkPoint current = offset; |
726 while (text < stop) { | 726 while (text < stop) { |
727 current = | 727 current = |
728 findAndPosition->findAndPositionGlyph( | 728 findAndPosition->findAndPositionGlyph( |
729 &text, current, std::forward<ProcessOneGlyph>(processOneGlyph)); | 729 &text, current, std::forward<ProcessOneGlyph>(processOneGlyph)); |
730 | 730 |
731 } | 731 } |
732 } | 732 } |
733 | 733 |
734 #endif // SkFindAndPositionGlyph_DEFINED | 734 #endif // SkFindAndPositionGlyph_DEFINED |
OLD | NEW |