diff options
Diffstat (limited to 'src/core/SkGlyph.h')
-rw-r--r-- | src/core/SkGlyph.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/core/SkGlyph.h b/src/core/SkGlyph.h index 48b9815a03..abca215d00 100644 --- a/src/core/SkGlyph.h +++ b/src/core/SkGlyph.h @@ -34,6 +34,8 @@ class SkGlyph { public: static const SkFixed kSubpixelRound = SK_FixedHalf >> SkGlyph::kSubBits; + // A value that can never be generated by MakeID. + static const uint32_t kImpossibleID = ~0; void* fImage; SkPath* fPath; SkFixed fAdvanceX, fAdvanceY; @@ -147,6 +149,7 @@ class SkGlyph { static uint32_t MakeID(unsigned code) { SkASSERT(code <= kCodeMask); + SkASSERT(code != kImpossibleID); return code; } @@ -154,9 +157,11 @@ class SkGlyph { SkASSERT(code <= kCodeMask); x = FixedToSub(x); y = FixedToSub(y); - return (x << (kSubShift + kSubShiftX)) | - (y << (kSubShift + kSubShiftY)) | - code; + uint32_t ID = (x << (kSubShift + kSubShiftX)) | + (y << (kSubShift + kSubShiftY)) | + code; + SkASSERT(ID != kImpossibleID); + return ID; } // FIXME - This is needed because the Android frame work directly |