Chromium Code Reviews| Index: include/core/SkBitmap.h |
| diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h |
| index 887169ccb522c2820c8c2f0ff3f78e454d0d00cf..af33cb261517258d7d88900bec47d1a33507f7f0 100644 |
| --- a/include/core/SkBitmap.h |
| +++ b/include/core/SkBitmap.h |
| @@ -11,6 +11,7 @@ |
| #define SkBitmap_DEFINED |
| #include "Sk64.h" |
| +#include "SkAlpha.h" |
| #include "SkColor.h" |
| #include "SkColorTable.h" |
| #include "SkPoint.h" |
| @@ -130,6 +131,8 @@ public: |
| */ |
| int rowBytesAsPixels() const { return fRowBytes >> (fBytesPerPixel >> 1); } |
| + SkAlphaType alphaType() const { return (SkAlphaType)fAlphaType; } |
| + |
| /** Return the address of the pixels for this SkBitmap. |
| */ |
| void* getPixels() const { return fPixels; } |
| @@ -248,7 +251,14 @@ public: |
| ComputeRowBytes() is called to compute the optimal value. This resets |
| any pixel/colortable ownership, just like reset(). |
| */ |
| - void setConfig(Config, int width, int height, size_t rowBytes = 0); |
| + bool setConfig(Config, int width, int height, size_t rowBytes, SkAlphaType); |
| + |
| + bool setConfig(Config config, int width, int height, size_t rowBytes = 0) { |
| + return this->setConfig(config, width, height, rowBytes, |
| + kPremul_SkAlphaType); |
| + } |
| + |
| + |
| /** Use this to assign a new pixel address for an existing bitmap. This |
| will automatically release any pixelref previously installed. Only call |
| this if you are handling ownership/lifetime of the pixel memory. |
| @@ -672,6 +682,7 @@ private: |
| uint32_t fWidth; |
| uint32_t fHeight; |
| uint8_t fConfig; |
| + uint8_t fAlphaType; |
|
scroggo
2013/09/30 19:01:28
This should be serialized, and we should bump the
|
| uint8_t fFlags; |
| uint8_t fBytesPerPixel; // based on config |