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

Side by Side Diff: src/gpu/text/GrBatchFontCache.h

Issue 2129913004: Use sRGB pixel config for ARGB masks (color emoji) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Avoid static cache of wrong value Created 4 years, 5 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/gpu/text/GrBatchFontCache.cpp » ('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 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
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
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
OLDNEW
« no previous file with comments | « no previous file | src/gpu/text/GrBatchFontCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698