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

Side by Side Diff: include/gpu/GrTypes.h

Issue 762553006: Fix assert in GrMaskFormatBytesPerPixel. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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 | no next file » | 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 /* 2 /*
3 * Copyright 2010 Google Inc. 3 * Copyright 2010 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 10
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 kARGB_GrMaskFormat, //!< 4-bytes per pixel, color format 232 kARGB_GrMaskFormat, //!< 4-bytes per pixel, color format
233 233
234 kLast_GrMaskFormat = kARGB_GrMaskFormat 234 kLast_GrMaskFormat = kARGB_GrMaskFormat
235 }; 235 };
236 static const int kMaskFormatCount = kLast_GrMaskFormat + 1; 236 static const int kMaskFormatCount = kLast_GrMaskFormat + 1;
237 237
238 /** 238 /**
239 * Return the number of bytes-per-pixel for the specified mask format. 239 * Return the number of bytes-per-pixel for the specified mask format.
240 */ 240 */
241 static inline int GrMaskFormatBytesPerPixel(GrMaskFormat format) { 241 static inline int GrMaskFormatBytesPerPixel(GrMaskFormat format) {
242 SkASSERT((unsigned)format <= 3);
243 // kA8 (0) -> 1 242 // kA8 (0) -> 1
244 // kA565 (1) -> 2 243 // kA565 (1) -> 2
robertphillips 2014/11/26 18:19:35 (2) ?
jvanverth1 2014/11/26 19:21:49 Done.
245 // kARGB (3) -> 4 244 // kARGB (3) -> 4
246 static const int sBytesPerPixel[] = { 1, 2, 4 }; 245 static const int sBytesPerPixel[] = { 1, 2, 4 };
robertphillips 2014/11/26 18:19:35 Why SK_ARRAY_COUNT(sBytesPerPixel) instead of kMas
jvanverth1 2014/11/26 19:21:49 Done.
246 SkASSERT((unsigned)format < SK_ARRAY_COUNT(sBytesPerPixel));
247 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(sBytesPerPixel) == kMaskFormatCount, array_ size_mismatch); 247 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(sBytesPerPixel) == kMaskFormatCount, array_ size_mismatch);
robertphillips 2014/11/26 18:19:35 Seems like we also need: SK_COMPILE_ASSERT(kA8_Gr
jvanverth1 2014/11/26 19:21:48 Done.
248 248
249 return sBytesPerPixel[(int) format]; 249 return sBytesPerPixel[(int) format];
250 } 250 }
251 251
252 /** 252 /**
253 * Pixel configurations. 253 * Pixel configurations.
254 */ 254 */
255 enum GrPixelConfig { 255 enum GrPixelConfig {
256 kUnknown_GrPixelConfig, 256 kUnknown_GrPixelConfig,
257 kAlpha_8_GrPixelConfig, 257 kAlpha_8_GrPixelConfig,
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 public: 713 public:
714 GrAutoMalloc() : INHERITED() {} 714 GrAutoMalloc() : INHERITED() {}
715 explicit GrAutoMalloc(size_t size) : INHERITED(size) {} 715 explicit GrAutoMalloc(size_t size) : INHERITED(size) {}
716 virtual ~GrAutoMalloc() {} 716 virtual ~GrAutoMalloc() {}
717 private: 717 private:
718 typedef GrAutoMallocBaseType INHERITED; 718 typedef GrAutoMallocBaseType INHERITED;
719 }; 719 };
720 720
721 #undef GrAutoMallocBaseType 721 #undef GrAutoMallocBaseType
722 #endif 722 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698