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

Side by Side Diff: include/core/SkImageInfo.h

Issue 1010343002: add kGray_8_SkColorType (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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/filterbitmap.cpp ('k') | src/core/SkBitmap.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 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 * for 32bit pixels. 65 * for 32bit pixels.
66 */ 66 */
67 enum SkColorType { 67 enum SkColorType {
68 kUnknown_SkColorType, 68 kUnknown_SkColorType,
69 kAlpha_8_SkColorType, 69 kAlpha_8_SkColorType,
70 kRGB_565_SkColorType, 70 kRGB_565_SkColorType,
71 kARGB_4444_SkColorType, 71 kARGB_4444_SkColorType,
72 kRGBA_8888_SkColorType, 72 kRGBA_8888_SkColorType,
73 kBGRA_8888_SkColorType, 73 kBGRA_8888_SkColorType,
74 kIndex_8_SkColorType, 74 kIndex_8_SkColorType,
75 kGray_8_SkColorType,
75 76
76 kLastEnum_SkColorType = kIndex_8_SkColorType, 77 kLastEnum_SkColorType = kGray_8_SkColorType,
77 78
78 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) 79 #if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
79 kN32_SkColorType = kBGRA_8888_SkColorType, 80 kN32_SkColorType = kBGRA_8888_SkColorType,
80 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) 81 #elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
81 kN32_SkColorType = kRGBA_8888_SkColorType, 82 kN32_SkColorType = kRGBA_8888_SkColorType,
82 #else 83 #else
83 #error "SK_*32_SHFIT values must correspond to BGRA or RGBA byte order" 84 #error "SK_*32_SHFIT values must correspond to BGRA or RGBA byte order"
84 #endif 85 #endif
85 }; 86 };
86 87
87 static int SkColorTypeBytesPerPixel(SkColorType ct) { 88 static int SkColorTypeBytesPerPixel(SkColorType ct) {
88 static const uint8_t gSize[] = { 89 static const uint8_t gSize[] = {
89 0, // Unknown 90 0, // Unknown
90 1, // Alpha_8 91 1, // Alpha_8
91 2, // RGB_565 92 2, // RGB_565
92 2, // ARGB_4444 93 2, // ARGB_4444
93 4, // RGBA_8888 94 4, // RGBA_8888
94 4, // BGRA_8888 95 4, // BGRA_8888
95 1, // kIndex_8 96 1, // kIndex_8
97 1, // kGray_8
96 }; 98 };
97 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(gSize) == (size_t)(kLastEnum_SkColorType + 1), 99 SK_COMPILE_ASSERT(SK_ARRAY_COUNT(gSize) == (size_t)(kLastEnum_SkColorType + 1),
98 size_mismatch_with_SkColorType_enum); 100 size_mismatch_with_SkColorType_enum);
99 101
100 SkASSERT((size_t)ct < SK_ARRAY_COUNT(gSize)); 102 SkASSERT((size_t)ct < SK_ARRAY_COUNT(gSize));
101 return gSize[ct]; 103 return gSize[ct];
102 } 104 }
103 105
104 static inline size_t SkColorTypeMinRowBytes(SkColorType ct, int width) { 106 static inline size_t SkColorTypeMinRowBytes(SkColorType ct, int width) {
105 return width * SkColorTypeBytesPerPixel(ct); 107 return width * SkColorTypeBytesPerPixel(ct);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 , fHeight(height) 291 , fHeight(height)
290 , fColorType(ct) 292 , fColorType(ct)
291 , fAlphaType(at) 293 , fAlphaType(at)
292 , fProfileType(pt) 294 , fProfileType(pt)
293 {} 295 {}
294 296
295 SkColorProfileType fProfileType; 297 SkColorProfileType fProfileType;
296 }; 298 };
297 299
298 #endif 300 #endif
OLDNEW
« no previous file with comments | « gm/filterbitmap.cpp ('k') | src/core/SkBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698