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

Unified Diff: include/core/SkImage.h

Issue 54363008: move SkImage::ColorType into SkColorType (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/srcmode.cpp ('k') | include/core/SkImageDecoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkImage.h
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index beede0338a6b8c6347bb6a131711543ebb9e0324..4142c63034ab7357a7bacf623b07f0144bc002ad 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -23,6 +23,30 @@ class GrTexture;
// need for TileMode
#include "SkShader.h"
+enum SkColorType {
+ kAlpha_8_SkColorType,
+ kRGB_565_SkColorType,
+ kRGBA_8888_SkColorType,
+ kBGRA_8888_SkColorType,
+
+#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
+ kPMColor_SkColorType = kBGRA_8888_SkColorType,
+#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
+ kPMColor_SkColorType = kRGBA_8888_SkColorType,
+#else
+ #error "SK_*32_SHFIT values must correspond to BGRA or RGBA byte order"
+#endif
+
+ kLastEnum_SkColorType = kBGRA_8888_SkColorType
+};
+
+struct SkImageInfo {
+ int fWidth;
+ int fHeight;
+ SkColorType fColorType;
+ SkAlphaType fAlphaType;
+};
+
/**
* SkImage is an abstraction for drawing a rectagle of pixels, though the
* particular type of image could be actually storing its data on the GPU, or
@@ -37,36 +61,27 @@ class SK_API SkImage : public SkRefCnt {
public:
SK_DECLARE_INST_COUNT(SkImage)
- enum ColorType {
- kAlpha_8_ColorType,
- kRGB_565_ColorType,
- kRGBA_8888_ColorType,
- kBGRA_8888_ColorType,
+#ifdef SK_SUPPORT_LEGACY_COLORTYPE
+ typedef SkColorType ColorType;
-#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A)
- kPMColor_ColorType = kBGRA_8888_ColorType,
-#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A)
- kPMColor_ColorType = kRGBA_8888_ColorType,
-#else
- #error "SK_*32_SHFIT values must correspond to BGRA or RGBA byte order"
+ static const SkColorType kAlpha_8_ColorType = kAlpha_8_SkColorType;
+ static const SkColorType kRGB_565_ColorType = kRGB_565_SkColorType;
+ static const SkColorType kRGBA_8888_ColorType = kRGBA_8888_SkColorType;
+ static const SkColorType kBGRA_8888_ColorType = kBGRA_8888_SkColorType;
+ static const SkColorType kPMColor_ColorType = kPMColor_SkColorType;
+ static const SkColorType kLastEnum_ColorType = kLastEnum_SkColorType;
#endif
- kLastEnum_ColorType = kBGRA_8888_ColorType
- };
-
+#ifdef SK_SUPPORT_LEGACY_ALPHATYPE
typedef SkAlphaType AlphaType;
static const SkAlphaType kIgnore_AlphaType = kIgnore_SkAlphaType;
static const SkAlphaType kOpaque_AlphaType = kOpaque_SkAlphaType;
static const SkAlphaType kPremul_AlphaType = kPremul_SkAlphaType;
static const SkAlphaType kUnpremul_AlphaType = kUnpremul_SkAlphaType;
+#endif
- struct Info {
- int fWidth;
- int fHeight;
- ColorType fColorType;
- SkAlphaType fAlphaType;
- };
+ typedef SkImageInfo Info;
static SkImage* NewRasterCopy(const Info&, const void* pixels, size_t rowBytes);
static SkImage* NewRasterData(const Info&, SkData* pixels, size_t rowBytes);
« no previous file with comments | « gm/srcmode.cpp ('k') | include/core/SkImageDecoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698