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

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

Issue 1306443004: Use static_assert instead of SK_COMPILE_ASSERT. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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 | « include/core/SkTypes.h ('k') | include/private/SkRecords.h » ('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 2010 Google Inc. 2 * Copyright 2010 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 GrTypes_DEFINED 8 #ifndef GrTypes_DEFINED
9 #define GrTypes_DEFINED 9 #define GrTypes_DEFINED
10 10
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 178
179 /** 179 /**
180 * Return the number of bytes-per-pixel for the specified mask format. 180 * Return the number of bytes-per-pixel for the specified mask format.
181 */ 181 */
182 static inline int GrMaskFormatBytesPerPixel(GrMaskFormat format) { 182 static inline int GrMaskFormatBytesPerPixel(GrMaskFormat format) {
183 SkASSERT((unsigned)format < kMaskFormatCount); 183 SkASSERT((unsigned)format < kMaskFormatCount);
184 // kA8 (0) -> 1 184 // kA8 (0) -> 1
185 // kA565 (1) -> 2 185 // kA565 (1) -> 2
186 // kARGB (2) -> 4 186 // kARGB (2) -> 4
187 static const int sBytesPerPixel[] = { 1, 2, 4 }; 187 static const int sBytesPerPixel[] = { 1, 2, 4 };
188 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(sBytesPerPixel) == kMaskFormatCount, array_ size_mismatch); 188 static_assert(SK_ARRAY_COUNT(sBytesPerPixel) == kMaskFormatCount, "array_siz e_mismatch");
189 SK_COMPILE_ASSERT(kA8_GrMaskFormat == 0, enum_order_dependency); 189 static_assert(kA8_GrMaskFormat == 0, "enum_order_dependency");
190 SK_COMPILE_ASSERT(kA565_GrMaskFormat == 1, enum_order_dependency); 190 static_assert(kA565_GrMaskFormat == 1, "enum_order_dependency");
191 SK_COMPILE_ASSERT(kARGB_GrMaskFormat == 2, enum_order_dependency); 191 static_assert(kARGB_GrMaskFormat == 2, "enum_order_dependency");
192 192
193 return sBytesPerPixel[(int) format]; 193 return sBytesPerPixel[(int) format];
194 } 194 }
195 195
196 /** 196 /**
197 * Pixel configurations. 197 * Pixel configurations.
198 */ 198 */
199 enum GrPixelConfig { 199 enum GrPixelConfig {
200 kUnknown_GrPixelConfig, 200 kUnknown_GrPixelConfig,
201 kAlpha_8_GrPixelConfig, 201 kAlpha_8_GrPixelConfig,
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 return 4 * width * height; 634 return 4 * width * height;
635 } 635 }
636 } 636 }
637 637
638 /** 638 /**
639 * This value translates to reseting all the context state for any backend. 639 * This value translates to reseting all the context state for any backend.
640 */ 640 */
641 static const uint32_t kAll_GrBackendState = 0xffffffff; 641 static const uint32_t kAll_GrBackendState = 0xffffffff;
642 642
643 #endif 643 #endif
OLDNEW
« no previous file with comments | « include/core/SkTypes.h ('k') | include/private/SkRecords.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698