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

Side by Side Diff: src/core/SkGlyph.h

Issue 897463004: Revert of Make the glyph array entries inline. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/core/SkGlyphCache.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 SkGlyph_DEFINED 8 #ifndef SkGlyph_DEFINED
9 #define SkGlyph_DEFINED 9 #define SkGlyph_DEFINED
10 10
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 enum { 97 enum {
98 kSubBits = 2, 98 kSubBits = 2,
99 kSubMask = ((1 << kSubBits) - 1), 99 kSubMask = ((1 << kSubBits) - 1),
100 kSubShift = 24, // must be large enough for glyphs and unichars 100 kSubShift = 24, // must be large enough for glyphs and unichars
101 kCodeMask = ((1 << kSubShift) - 1), 101 kCodeMask = ((1 << kSubShift) - 1),
102 // relative offsets for X and Y subpixel bits 102 // relative offsets for X and Y subpixel bits
103 kSubShiftX = kSubBits, 103 kSubShiftX = kSubBits,
104 kSubShiftY = 0 104 kSubShiftY = 0
105 }; 105 };
106 106
107 // The code is increased by one in MakeID. Adjust back. This allows the zero
108 // id to be the invalid id.
109 static unsigned ID2Code(uint32_t id) { 107 static unsigned ID2Code(uint32_t id) {
110 return (id & kCodeMask) - 1; 108 return id & kCodeMask;
111 } 109 }
112 110
113 static unsigned ID2SubX(uint32_t id) { 111 static unsigned ID2SubX(uint32_t id) {
114 return id >> (kSubShift + kSubShiftX); 112 return id >> (kSubShift + kSubShiftX);
115 } 113 }
116 114
117 static unsigned ID2SubY(uint32_t id) { 115 static unsigned ID2SubY(uint32_t id) {
118 return (id >> (kSubShift + kSubShiftY)) & kSubMask; 116 return (id >> (kSubShift + kSubShiftY)) & kSubMask;
119 } 117 }
120 118
121 static unsigned FixedToSub(SkFixed n) { 119 static unsigned FixedToSub(SkFixed n) {
122 return (n >> (16 - kSubBits)) & kSubMask; 120 return (n >> (16 - kSubBits)) & kSubMask;
123 } 121 }
124 122
125 static SkFixed SubToFixed(unsigned sub) { 123 static SkFixed SubToFixed(unsigned sub) {
126 SkASSERT(sub <= kSubMask); 124 SkASSERT(sub <= kSubMask);
127 return sub << (16 - kSubBits); 125 return sub << (16 - kSubBits);
128 } 126 }
129 127
130 // This and the MakeID below must not return an id of zero. Zero is used as
131 // the invalid id.
132 static uint32_t MakeID(unsigned code) { 128 static uint32_t MakeID(unsigned code) {
133 SkASSERT(code + 1 <= kCodeMask); 129 return code;
134 return code + 1;
135 } 130 }
136 131
137 // See comment for MakeID above.
138 static uint32_t MakeID(unsigned code, SkFixed x, SkFixed y) { 132 static uint32_t MakeID(unsigned code, SkFixed x, SkFixed y) {
139 SkASSERT(code + 1 <= kCodeMask); 133 SkASSERT(code <= kCodeMask);
140 x = FixedToSub(x); 134 x = FixedToSub(x);
141 y = FixedToSub(y); 135 y = FixedToSub(y);
142 return (x << (kSubShift + kSubShiftX)) | 136 return (x << (kSubShift + kSubShiftX)) |
143 (y << (kSubShift + kSubShiftY)) | 137 (y << (kSubShift + kSubShiftY)) |
144 (code + 1); 138 code;
145 } 139 }
146 140
147 void toMask(SkMask* mask) const; 141 void toMask(SkMask* mask) const;
148 }; 142 };
149 143
150 #endif 144 #endif
OLDNEW
« 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