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

Side by Side Diff: include/core/SkImageInfo.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 | « gm/variedtext.cpp ('k') | include/core/SkPath.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 2013 Google Inc. 2 * Copyright 2013 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 SkImageInfo_DEFINED 8 #ifndef SkImageInfo_DEFINED
9 #define SkImageInfo_DEFINED 9 #define SkImageInfo_DEFINED
10 10
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 static const uint8_t gSize[] = { 105 static const uint8_t gSize[] = {
106 0, // Unknown 106 0, // Unknown
107 1, // Alpha_8 107 1, // Alpha_8
108 2, // RGB_565 108 2, // RGB_565
109 2, // ARGB_4444 109 2, // ARGB_4444
110 4, // RGBA_8888 110 4, // RGBA_8888
111 4, // BGRA_8888 111 4, // BGRA_8888
112 1, // kIndex_8 112 1, // kIndex_8
113 1, // kGray_8 113 1, // kGray_8
114 }; 114 };
115 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(gSize) == (size_t)(kLastEnum_SkColorType + 1), 115 static_assert(SK_ARRAY_COUNT(gSize) == (size_t)(kLastEnum_SkColorType + 1),
116 size_mismatch_with_SkColorType_enum); 116 "size_mismatch_with_SkColorType_enum");
117 117
118 SkASSERT((size_t)ct < SK_ARRAY_COUNT(gSize)); 118 SkASSERT((size_t)ct < SK_ARRAY_COUNT(gSize));
119 return gSize[ct]; 119 return gSize[ct];
120 } 120 }
121 121
122 static inline size_t SkColorTypeMinRowBytes(SkColorType ct, int width) { 122 static inline size_t SkColorTypeMinRowBytes(SkColorType ct, int width) {
123 return width * SkColorTypeBytesPerPixel(ct); 123 return width * SkColorTypeBytesPerPixel(ct);
124 } 124 }
125 125
126 static inline bool SkColorTypeIsValid(unsigned value) { 126 static inline bool SkColorTypeIsValid(unsigned value) {
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 SkImageInfo(int width, int height, SkColorType ct, SkAlphaType at, SkColorPr ofileType pt) 325 SkImageInfo(int width, int height, SkColorType ct, SkAlphaType at, SkColorPr ofileType pt)
326 : fWidth(width) 326 : fWidth(width)
327 , fHeight(height) 327 , fHeight(height)
328 , fColorType(ct) 328 , fColorType(ct)
329 , fAlphaType(at) 329 , fAlphaType(at)
330 , fProfileType(pt) 330 , fProfileType(pt)
331 {} 331 {}
332 }; 332 };
333 333
334 #endif 334 #endif
OLDNEW
« no previous file with comments | « gm/variedtext.cpp ('k') | include/core/SkPath.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698