aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2016-04-15 10:03:03 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-15 10:03:03 -0700
commit6d7cd1f421dbde43dd2db655ca477c05312ec5fd (patch)
treea417c65d83d2ef2575876f57f786526ab7d39b38 /src/core
parent6b13473dd4d5915309cc2caddbab2e22f2f21d5f (diff)
move static arrays into impl, to avoid multiple copies
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkImageInfo.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/core/SkImageInfo.cpp b/src/core/SkImageInfo.cpp
index 16f0a0109c..6b6fb17d35 100644
--- a/src/core/SkImageInfo.cpp
+++ b/src/core/SkImageInfo.cpp
@@ -9,6 +9,34 @@
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
+const uint8_t gPrivate_SkColorTypeBytesPerPixel[] = {
+ 0, // Unknown
+ 1, // Alpha_8
+ 2, // RGB_565
+ 2, // ARGB_4444
+ 4, // RGBA_8888
+ 4, // BGRA_8888
+ 1, // kIndex_8
+ 1, // kGray_8
+ 8, // kRGBA_F16
+};
+static_assert(SK_ARRAY_COUNT(gPrivate_SkColorTypeBytesPerPixel) == (size_t)(kLastEnum_SkColorType + 1),
+ "size_mismatch_with_SkColorType_enum");
+
+const uint8_t gPrivate_SkColorTypeShiftPerPixel[] = {
+ 0, // Unknown
+ 0, // Alpha_8
+ 1, // RGB_565
+ 1, // ARGB_4444
+ 2, // RGBA_8888
+ 2, // BGRA_8888
+ 0, // kIndex_8
+ 0, // kGray_8
+ 3, // kRGBA_F16
+};
+static_assert(SK_ARRAY_COUNT(gPrivate_SkColorTypeShiftPerPixel) == (size_t)(kLastEnum_SkColorType + 1),
+ "size_mismatch_with_SkColorType_enum");
+
static bool profile_type_is_valid(SkColorProfileType profileType) {
return (profileType >= 0) && (profileType <= kLastEnum_SkColorProfileType);
}