| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 return this->getAtlas(format)->addToAtlas(id, target, width, height, ima
ge, loc); | 159 return this->getAtlas(format)->addToAtlas(id, target, width, height, ima
ge, loc); |
| 160 } | 160 } |
| 161 | 161 |
| 162 // Some clients may wish to verify the integrity of the texture backing stor
e of the | 162 // Some clients may wish to verify the integrity of the texture backing stor
e of the |
| 163 // GrBatchAtlas. The atlasGeneration returned below is a monitonically incr
easing number which | 163 // GrBatchAtlas. The atlasGeneration returned below is a monitonically incr
easing number which |
| 164 // changes everytime something is removed from the texture backing store. | 164 // changes everytime something is removed from the texture backing store. |
| 165 uint64_t atlasGeneration(GrMaskFormat format) const { | 165 uint64_t atlasGeneration(GrMaskFormat format) const { |
| 166 return this->getAtlas(format)->atlasGeneration(); | 166 return this->getAtlas(format)->atlasGeneration(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 /////////////////////////////////////////////////////////////////////////// |
| 170 // Functions intended debug only |
| 169 void dump() const; | 171 void dump() const; |
| 170 | 172 |
| 173 void setAtlasSizes_ForTesting(const GrBatchAtlasConfig configs[3]); |
| 174 |
| 171 private: | 175 private: |
| 172 static GrPixelConfig MaskFormatToPixelConfig(GrMaskFormat format) { | 176 static GrPixelConfig MaskFormatToPixelConfig(GrMaskFormat format) { |
| 173 static const GrPixelConfig kPixelConfigs[] = { | 177 static const GrPixelConfig kPixelConfigs[] = { |
| 174 kAlpha_8_GrPixelConfig, | 178 kAlpha_8_GrPixelConfig, |
| 175 kRGB_565_GrPixelConfig, | 179 kRGB_565_GrPixelConfig, |
| 176 kSkia8888_GrPixelConfig | 180 kSkia8888_GrPixelConfig |
| 177 }; | 181 }; |
| 178 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(kPixelConfigs) == kMaskFormatCount, arr
ay_size_mismatch); | 182 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(kPixelConfigs) == kMaskFormatCount, arr
ay_size_mismatch); |
| 179 | 183 |
| 180 return kPixelConfigs[format]; | 184 return kPixelConfigs[format]; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 206 SkASSERT(fAtlases[atlasIndex]); | 210 SkASSERT(fAtlases[atlasIndex]); |
| 207 return fAtlases[atlasIndex]; | 211 return fAtlases[atlasIndex]; |
| 208 } | 212 } |
| 209 | 213 |
| 210 static void HandleEviction(GrBatchAtlas::AtlasID, void*); | 214 static void HandleEviction(GrBatchAtlas::AtlasID, void*); |
| 211 | 215 |
| 212 GrContext* fContext; | 216 GrContext* fContext; |
| 213 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey> fCache; | 217 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey> fCache; |
| 214 GrBatchAtlas* fAtlases[kMaskFormatCount]; | 218 GrBatchAtlas* fAtlases[kMaskFormatCount]; |
| 215 GrBatchTextStrike* fPreserveStrike; | 219 GrBatchTextStrike* fPreserveStrike; |
| 220 GrBatchAtlasConfig fAtlasConfigs[kMaskFormatCount]; |
| 216 }; | 221 }; |
| 217 | 222 |
| 218 #endif | 223 #endif |
| OLD | NEW |