| Index: src/core/SkImageInfo.cpp
|
| diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp
|
| index 146a3aeed8b0a4a1b04af80f43cb0742e39069db..2bd90d105ed40b7aafc7d219989bd3b0c1cd090b 100644
|
| --- a/src/core/SkImageInfo.cpp
|
| +++ b/src/core/SkImageInfo.cpp
|
| @@ -9,6 +9,23 @@
|
| #include "SkReadBuffer.h"
|
| #include "SkWriteBuffer.h"
|
|
|
| +int SkColorTypeBytesPerPixel(SkColorType ct) {
|
| + static const uint8_t gSize[] = {
|
| + 0, // Unknown
|
| + 1, // Alpha_8
|
| + 2, // RGB_565
|
| + 2, // ARGB_4444
|
| + 4, // RGBA_8888
|
| + 4, // BGRA_8888
|
| + 1, // kIndex_8
|
| + };
|
| + SK_COMPILE_ASSERT(SK_ARRAY_COUNT(gSize) == (size_t)(kLastEnum_SkColorType + 1),
|
| + size_mismatch_with_SkColorType_enum);
|
| +
|
| + SkASSERT((size_t)ct < SK_ARRAY_COUNT(gSize));
|
| + return gSize[ct];
|
| +}
|
| +
|
| static bool profile_type_is_valid(SkColorProfileType profileType) {
|
| return (profileType >= 0) && (profileType <= kLastEnum_SkColorProfileType);
|
| }
|
| @@ -21,6 +38,10 @@ static bool color_type_is_valid(SkColorType colorType) {
|
| return (colorType >= 0) && (colorType <= kLastEnum_SkColorType);
|
| }
|
|
|
| +int SkImageInfo::bytesPerPixel() const {
|
| + return SkColorTypeBytesPerPixel(fColorType);
|
| +}
|
| +
|
| void SkImageInfo::unflatten(SkReadBuffer& buffer) {
|
| fWidth = buffer.read32();
|
| fHeight = buffer.read32();
|
|
|