Chromium Code Reviews| Index: include/core/SkImageInfo.h |
| diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h |
| index 4b308c05d88ca736d69451f3b970c1bd71b30b12..f7bcb3aa1e9ca98e82d3a4fddb2f2c987114d257 100644 |
| --- a/include/core/SkImageInfo.h |
| +++ b/include/core/SkImageInfo.h |
| @@ -8,6 +8,7 @@ |
| #ifndef SkImageInfo_DEFINED |
| #define SkImageInfo_DEFINED |
| +#include "SkColorSpace.h" |
| #include "SkMath.h" |
| #include "SkRect.h" |
| #include "SkSize.h" |
| @@ -194,6 +195,11 @@ public: |
| return SkImageInfo(width, height, ct, at, pt); |
| } |
| + static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at, |
| + sk_sp<SkColorSpace> cs) { |
| + return SkImageInfo(width, height, ct, at, kLinear_SkColorProfileType, cs); |
| + } |
| + |
| /** |
| * Sets colortype to the native ARGB32 type. |
| */ |
| @@ -247,6 +253,24 @@ public: |
| bool isLinear() const { return kLinear_SkColorProfileType == fProfileType; } |
| bool isSRGB() const { return kSRGB_SkColorProfileType == fProfileType; } |
| + bool isSRGBGamma() const { |
|
msarett
2016/05/20 16:55:37
I don't like these... I think they are too limiti
|
| + if (fColorSpace) { |
| + return SkColorSpace::kSRGBCurve_GammaNamed == fColorSpace->gammaNamed(); |
| + } |
| + |
| + // Treat unmarked images as sRGB. |
| + return true; |
| + } |
| + |
| + bool isSRGBGamut() const { |
| + if (fColorSpace) { |
| + return SkColorSpace::kSRGB_Named == fColorSpace->named(); |
| + } |
| + |
| + // Treat unmarked images as sRGB. |
| + return true; |
| + } |
| + |
| SkISize dimensions() const { return SkISize::Make(fWidth, fHeight); } |
| SkIRect bounds() const { return SkIRect::MakeWH(fWidth, fHeight); } |
| @@ -322,13 +346,16 @@ private: |
| SkColorType fColorType; |
| SkAlphaType fAlphaType; |
| SkColorProfileType fProfileType; |
| + sk_sp<SkColorSpace> fColorSpace; |
| - SkImageInfo(int width, int height, SkColorType ct, SkAlphaType at, SkColorProfileType pt) |
| + SkImageInfo(int width, int height, SkColorType ct, SkAlphaType at, SkColorProfileType pt, |
| + sk_sp<SkColorSpace> cs = nullptr) |
| : fWidth(width) |
| , fHeight(height) |
| , fColorType(ct) |
| , fAlphaType(at) |
| , fProfileType(pt) |
| + , fColorSpace(cs) |
| {} |
| }; |