Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Unified Diff: src/core/SkGlyph.h

Issue 885903002: Make the glyph array entries inline. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add parens as suggested by build Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/core/SkGlyphCache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkGlyph.h
diff --git a/src/core/SkGlyph.h b/src/core/SkGlyph.h
index 9abefa84c7578f450cce93460a109e95e3f0bca4..2a97c09b22e76230147d60a86abe26495e1c09b4 100644
--- a/src/core/SkGlyph.h
+++ b/src/core/SkGlyph.h
@@ -104,8 +104,10 @@ struct SkGlyph {
kSubShiftY = 0
};
+ // The code is increased by one in MakeID. Adjust back. This allows the zero
+ // id to be the invalid id.
static unsigned ID2Code(uint32_t id) {
- return id & kCodeMask;
+ return (id & kCodeMask) - 1;
}
static unsigned ID2SubX(uint32_t id) {
@@ -125,17 +127,20 @@ struct SkGlyph {
return sub << (16 - kSubBits);
}
+ // This and the MakeID below must not return an id of zero. Zero is used as
+ // the invalid id.
static uint32_t MakeID(unsigned code) {
reed1 2015/02/02 11:49:36 can we add? SkASSERT(0 == (code & kCodeMask));
herb_g 2015/02/02 13:39:03 This assert doesn't make sense to me. Do you mean
herb_g 2015/02/02 15:34:11 Done. I think your intent was to check the pre-co
- return code;
+ return code + 1;
}
+ // See comment for MakeID above.
static uint32_t MakeID(unsigned code, SkFixed x, SkFixed y) {
SkASSERT(code <= kCodeMask);
x = FixedToSub(x);
y = FixedToSub(y);
return (x << (kSubShift + kSubShiftX)) |
(y << (kSubShift + kSubShiftY)) |
- code;
+ (code + 1);
}
void toMask(SkMask* mask) const;
« no previous file with comments | « no previous file | src/core/SkGlyphCache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698