Chromium Code Reviews| Index: include/core/SkImageGenerator.h |
| diff --git a/include/core/SkImageGenerator.h b/include/core/SkImageGenerator.h |
| index 3d508ddfb1c7ec7f1ceb34b9a12d3ce3d50f6060..c9ae1376bcb96a36d41e922b339f997766041cf8 100644 |
| --- a/include/core/SkImageGenerator.h |
| +++ b/include/core/SkImageGenerator.h |
| @@ -74,7 +74,12 @@ public: |
| /** |
| * Return the ImageInfo associated with this generator. |
| */ |
| - const SkImageInfo& getInfo() const { return fInfo; } |
| + const SkImageInfo& getInfo() { |
| + SkColorType colorType; |
| + if ((colorType = onGetColorType()) != fInfo.colorType()) |
| + fInfo = fInfo.makeColorType(colorType); |
| + return fInfo; |
| + } |
| /** |
| * Decode into the given pixels, a block of memory of size at |
| @@ -199,10 +204,12 @@ protected: |
| return nullptr; |
| } |
| + virtual SkColorType onGetColorType() { return fInfo.colorType(); } |
|
aleksandar.stojiljkovic
2015/12/07 19:31:02
Does this look better?
Implemented the chromium pa
|
| + |
| bool tryGenerateBitmap(SkBitmap* bm, const SkImageInfo* optionalInfo, SkBitmap::Allocator*); |
| private: |
| - const SkImageInfo fInfo; |
| + SkImageInfo fInfo; |
| const uint32_t fUniqueID; |
| // This is our default impl, which may be different on different platforms. |