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 GrBatchFontCache_DEFINED | 8 #ifndef GrBatchFontCache_DEFINED |
9 #define GrBatchFontCache_DEFINED | 9 #define GrBatchFontCache_DEFINED |
10 | 10 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 }; | 193 }; |
194 static_assert(SK_ARRAY_COUNT(sAtlasIndices) == kMaskFormatCount, "array_
size_mismatch"); | 194 static_assert(SK_ARRAY_COUNT(sAtlasIndices) == kMaskFormatCount, "array_
size_mismatch"); |
195 | 195 |
196 SkASSERT(sAtlasIndices[format] < kMaskFormatCount); | 196 SkASSERT(sAtlasIndices[format] < kMaskFormatCount); |
197 return sAtlasIndices[format]; | 197 return sAtlasIndices[format]; |
198 } | 198 } |
199 | 199 |
200 bool initAtlas(GrMaskFormat); | 200 bool initAtlas(GrMaskFormat); |
201 | 201 |
202 GrBatchTextStrike* generateStrike(GrFontScaler* scaler) { | 202 GrBatchTextStrike* generateStrike(GrFontScaler* scaler) { |
203 GrBatchTextStrike* strike = SkNEW_ARGS(GrBatchTextStrike, (this, scaler-
>getKey())); | 203 GrBatchTextStrike* strike = new GrBatchTextStrike(this, scaler->getKey()
); |
204 fCache.add(strike); | 204 fCache.add(strike); |
205 return strike; | 205 return strike; |
206 } | 206 } |
207 | 207 |
208 GrBatchAtlas* getAtlas(GrMaskFormat format) const { | 208 GrBatchAtlas* getAtlas(GrMaskFormat format) const { |
209 int atlasIndex = MaskFormatToAtlasIndex(format); | 209 int atlasIndex = MaskFormatToAtlasIndex(format); |
210 SkASSERT(fAtlases[atlasIndex]); | 210 SkASSERT(fAtlases[atlasIndex]); |
211 return fAtlases[atlasIndex]; | 211 return fAtlases[atlasIndex]; |
212 } | 212 } |
213 | 213 |
214 static void HandleEviction(GrBatchAtlas::AtlasID, void*); | 214 static void HandleEviction(GrBatchAtlas::AtlasID, void*); |
215 | 215 |
216 GrContext* fContext; | 216 GrContext* fContext; |
217 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey> fCache; | 217 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey> fCache; |
218 GrBatchAtlas* fAtlases[kMaskFormatCount]; | 218 GrBatchAtlas* fAtlases[kMaskFormatCount]; |
219 GrBatchTextStrike* fPreserveStrike; | 219 GrBatchTextStrike* fPreserveStrike; |
220 GrBatchAtlasConfig fAtlasConfigs[kMaskFormatCount]; | 220 GrBatchAtlasConfig fAtlasConfigs[kMaskFormatCount]; |
221 }; | 221 }; |
222 | 222 |
223 #endif | 223 #endif |
OLD | NEW |