Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 }; | 231 }; |
| 232 | 232 |
| 233 /** | 233 /** |
| 234 * Formats for masks, used by the font cache. | 234 * Formats for masks, used by the font cache. |
| 235 * Important that these are 0-based. | 235 * Important that these are 0-based. |
| 236 */ | 236 */ |
| 237 enum GrMaskFormat { | 237 enum GrMaskFormat { |
| 238 kA8_GrMaskFormat, //!< 1-byte per pixel | 238 kA8_GrMaskFormat, //!< 1-byte per pixel |
| 239 kA565_GrMaskFormat, //!< 2-bytes per pixel | 239 kA565_GrMaskFormat, //!< 2-bytes per pixel |
| 240 kA888_GrMaskFormat, //!< 4-bytes per pixel | 240 kA888_GrMaskFormat, //!< 4-bytes per pixel |
| 241 kARGB_GrMaskFormat, //!< 4-bytes per pixel, color format | |
| 241 | 242 |
| 242 kLast_GrMaskFormat = kA888_GrMaskFormat | 243 kLast_GrMaskFormat = kARGB_GrMaskFormat |
| 243 }; | 244 }; |
| 244 static const int kMaskFormatCount = kLast_GrMaskFormat + 1; | 245 static const int kMaskFormatCount = kLast_GrMaskFormat + 1; |
| 245 | 246 |
| 246 /** | 247 /** |
| 247 * Return the number of bytes-per-pixel for the specified mask format. | 248 * Return the number of bytes-per-pixel for the specified mask format. |
| 248 */ | 249 */ |
| 249 static inline int GrMaskFormatBytesPerPixel(GrMaskFormat format) { | 250 static inline int GrMaskFormatBytesPerPixel(GrMaskFormat format) { |
| 250 SkASSERT((unsigned)format <= 2); | 251 SkASSERT((unsigned)format <= 3); |
| 251 // kA8 (0) -> 1 | 252 // kA8 (0) -> 1 |
| 252 // kA565 (1) -> 2 | 253 // kA565 (1) -> 2 |
| 253 // kA888 (2) -> 4 | 254 // kA888 (2) -> 4 |
| 254 return 1 << (int)format; | 255 // kARGB (3) -> 4 |
|
robertphillips
2013/12/02 21:05:40
can we have a static assert here r.e. "4 == kLast_
| |
| 256 static int sBytesPerPixel[4] = { 1, 2, 4, 4 }; | |
| 257 return sBytesPerPixel[(int) format]; | |
| 255 } | 258 } |
| 256 | 259 |
| 257 /** | 260 /** |
| 258 * Pixel configurations. | 261 * Pixel configurations. |
| 259 */ | 262 */ |
| 260 enum GrPixelConfig { | 263 enum GrPixelConfig { |
| 261 kUnknown_GrPixelConfig, | 264 kUnknown_GrPixelConfig, |
| 262 kAlpha_8_GrPixelConfig, | 265 kAlpha_8_GrPixelConfig, |
| 263 kIndex_8_GrPixelConfig, | 266 kIndex_8_GrPixelConfig, |
| 264 kRGB_565_GrPixelConfig, | 267 kRGB_565_GrPixelConfig, |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 613 }; | 616 }; |
| 614 | 617 |
| 615 /** | 618 /** |
| 616 * This value translates to reseting all the context state for any backend. | 619 * This value translates to reseting all the context state for any backend. |
| 617 */ | 620 */ |
| 618 static const uint32_t kAll_GrBackendState = 0xffffffff; | 621 static const uint32_t kAll_GrBackendState = 0xffffffff; |
| 619 | 622 |
| 620 /////////////////////////////////////////////////////////////////////////////// | 623 /////////////////////////////////////////////////////////////////////////////// |
| 621 | 624 |
| 622 #endif | 625 #endif |
| OLD | NEW |