| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 return this->getAtlas(format)->addToAtlas(id, batchTarget, width, height
, image, loc); | 140 return this->getAtlas(format)->addToAtlas(id, batchTarget, width, height
, image, loc); |
| 141 } | 141 } |
| 142 | 142 |
| 143 // Some clients may wish to verify the integrity of the texture backing stor
e of the | 143 // Some clients may wish to verify the integrity of the texture backing stor
e of the |
| 144 // GrBatchAtlas. The atlasGeneration returned below is a monitonically incr
easing number which | 144 // GrBatchAtlas. The atlasGeneration returned below is a monitonically incr
easing number which |
| 145 // changes everytime something is removed from the texture backing store. | 145 // changes everytime something is removed from the texture backing store. |
| 146 uint64_t atlasGeneration(GrMaskFormat format) const { | 146 uint64_t atlasGeneration(GrMaskFormat format) const { |
| 147 return this->getAtlas(format)->atlasGeneration(); | 147 return this->getAtlas(format)->atlasGeneration(); |
| 148 } | 148 } |
| 149 | 149 |
| 150 GrPixelConfig getPixelConfig(GrMaskFormat) const; | |
| 151 | |
| 152 void dump() const; | 150 void dump() const; |
| 153 | 151 |
| 154 private: | 152 private: |
| 153 static GrPixelConfig MaskFormatToPixelConfig(GrMaskFormat format) { |
| 154 static const GrPixelConfig kPixelConfigs[] = { |
| 155 kAlpha_8_GrPixelConfig, |
| 156 kRGB_565_GrPixelConfig, |
| 157 kSkia8888_GrPixelConfig |
| 158 }; |
| 159 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(kPixelConfigs) == kMaskFormatCount, arr
ay_size_mismatch); |
| 160 |
| 161 return kPixelConfigs[format]; |
| 162 } |
| 163 |
| 155 // There is a 1:1 mapping between GrMaskFormats and atlas indices | 164 // There is a 1:1 mapping between GrMaskFormats and atlas indices |
| 156 static int MaskFormatToAtlasIndex(GrMaskFormat format) { | 165 static int MaskFormatToAtlasIndex(GrMaskFormat format) { |
| 157 static const int sAtlasIndices[] = { | 166 static const int sAtlasIndices[] = { |
| 158 kA8_GrMaskFormat, | 167 kA8_GrMaskFormat, |
| 159 kA565_GrMaskFormat, | 168 kA565_GrMaskFormat, |
| 160 kARGB_GrMaskFormat, | 169 kARGB_GrMaskFormat, |
| 161 }; | 170 }; |
| 162 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(sAtlasIndices) == kMaskFormatCount, arr
ay_size_mismatch); | 171 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(sAtlasIndices) == kMaskFormatCount, arr
ay_size_mismatch); |
| 163 | 172 |
| 164 SkASSERT(sAtlasIndices[format] < kMaskFormatCount); | 173 SkASSERT(sAtlasIndices[format] < kMaskFormatCount); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 181 | 190 |
| 182 static void HandleEviction(GrBatchAtlas::AtlasID, void*); | 191 static void HandleEviction(GrBatchAtlas::AtlasID, void*); |
| 183 | 192 |
| 184 GrContext* fContext; | 193 GrContext* fContext; |
| 185 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey> fCache; | 194 SkTDynamicHash<GrBatchTextStrike, GrFontDescKey> fCache; |
| 186 GrBatchAtlas* fAtlases[kMaskFormatCount]; | 195 GrBatchAtlas* fAtlases[kMaskFormatCount]; |
| 187 GrBatchTextStrike* fPreserveStrike; | 196 GrBatchTextStrike* fPreserveStrike; |
| 188 }; | 197 }; |
| 189 | 198 |
| 190 #endif | 199 #endif |
| OLD | NEW |