Chromium Code Reviews| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 int log2Width(GrMaskFormat format) { return fAtlasConfigs[format].fLog2Width ; } | 179 int log2Width(GrMaskFormat format) { return fAtlasConfigs[format].fLog2Width ; } |
| 180 int log2Height(GrMaskFormat format) { return fAtlasConfigs[format].fLog2Heig ht; } | 180 int log2Height(GrMaskFormat format) { return fAtlasConfigs[format].fLog2Heig ht; } |
| 181 | 181 |
| 182 /////////////////////////////////////////////////////////////////////////// | 182 /////////////////////////////////////////////////////////////////////////// |
| 183 // Functions intended debug only | 183 // Functions intended debug only |
| 184 void dump() const; | 184 void dump() const; |
| 185 | 185 |
| 186 void setAtlasSizes_ForTesting(const GrBatchAtlasConfig configs[3]); | 186 void setAtlasSizes_ForTesting(const GrBatchAtlasConfig configs[3]); |
| 187 | 187 |
| 188 private: | 188 private: |
| 189 static GrPixelConfig MaskFormatToPixelConfig(GrMaskFormat format) { | 189 static GrPixelConfig MaskFormatToPixelConfig(GrMaskFormat format, const GrCa ps& caps) { |
| 190 static const GrPixelConfig kPixelConfigs[] = { | 190 switch (format) { |
|
Brian Osman
2016/07/07 20:42:34
First version of this change was failing on ANGLE
| |
| 191 kAlpha_8_GrPixelConfig, | 191 case kA8_GrMaskFormat: |
| 192 kRGB_565_GrPixelConfig, | 192 return kAlpha_8_GrPixelConfig; |
| 193 kSkia8888_GrPixelConfig | 193 case kA565_GrMaskFormat: |
| 194 }; | 194 return kRGB_565_GrPixelConfig; |
| 195 static_assert(SK_ARRAY_COUNT(kPixelConfigs) == kMaskFormatCount, "array_ size_mismatch"); | 195 case kARGB_GrMaskFormat: |
| 196 | 196 return caps.srgbSupport() ? kSkiaGamma8888_GrPixelConfig : kSkia 8888_GrPixelConfig; |
| 197 return kPixelConfigs[format]; | 197 default: |
| 198 SkDEBUGFAIL("unsupported GrMaskFormat"); | |
| 199 return kAlpha_8_GrPixelConfig; | |
| 200 } | |
| 198 } | 201 } |
| 199 | 202 |
| 200 // There is a 1:1 mapping between GrMaskFormats and atlas indices | 203 // There is a 1:1 mapping between GrMaskFormats and atlas indices |
| 201 static int MaskFormatToAtlasIndex(GrMaskFormat format) { | 204 static int MaskFormatToAtlasIndex(GrMaskFormat format) { |
| 202 static const int sAtlasIndices[] = { | 205 static const int sAtlasIndices[] = { |
| 203 kA8_GrMaskFormat, | 206 kA8_GrMaskFormat, |
| 204 kA565_GrMaskFormat, | 207 kA565_GrMaskFormat, |
| 205 kARGB_GrMaskFormat, | 208 kARGB_GrMaskFormat, |
| 206 }; | 209 }; |
| 207 static_assert(SK_ARRAY_COUNT(sAtlasIndices) == kMaskFormatCount, "array_ size_mismatch"); | 210 static_assert(SK_ARRAY_COUNT(sAtlasIndices) == kMaskFormatCount, "array_ size_mismatch"); |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 228 | 231 |
| 229 using StrikeHash = SkTDynamicHash<GrBatchTextStrike, SkDescriptor>; | 232 using StrikeHash = SkTDynamicHash<GrBatchTextStrike, SkDescriptor>; |
| 230 GrContext* fContext; | 233 GrContext* fContext; |
| 231 StrikeHash fCache; | 234 StrikeHash fCache; |
| 232 GrBatchAtlas* fAtlases[kMaskFormatCount]; | 235 GrBatchAtlas* fAtlases[kMaskFormatCount]; |
| 233 GrBatchTextStrike* fPreserveStrike; | 236 GrBatchTextStrike* fPreserveStrike; |
| 234 GrBatchAtlasConfig fAtlasConfigs[kMaskFormatCount]; | 237 GrBatchAtlasConfig fAtlasConfigs[kMaskFormatCount]; |
| 235 }; | 238 }; |
| 236 | 239 |
| 237 #endif | 240 #endif |
| OLD | NEW |