Chromium Code Reviews| Index: include/core/SkImageInfo.h |
| diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h |
| index 1165479f7484267e47dc5dfa2bba90e5a79dce56..ae5470c6c66edc121898595001ff5f29631a4d01 100644 |
| --- a/include/core/SkImageInfo.h |
| +++ b/include/core/SkImageInfo.h |
| @@ -109,6 +109,51 @@ struct SkImageInfo { |
| SkColorType fColorType; |
| SkAlphaType fAlphaType; |
| + static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at) { |
| + SkASSERT(width >= 0); |
| + SkASSERT(height >= 0); |
| + SkImageInfo info = { |
| + width, height, ct, at |
| + }; |
| + return info; |
| + } |
| + |
| + static SkImageInfo MakePM(int width, int height, SkAlphaType at) { |
| + SkASSERT(width >= 0); |
| + SkASSERT(height >= 0); |
| + SkImageInfo info = { |
| + width, height, kPMColor_SkColorType, at |
| + }; |
| + return info; |
| + } |
| + |
| + static SkImageInfo MakePMPremul(int width, int height) { |
|
scroggo
2014/01/09 00:02:11
Not a big fan of this name... Any chance we can ch
reed1
2014/01/13 16:27:26
Suggestions?
kNativeARGB32_ColorType?
scroggo
2014/01/13 17:48:48
sgtm
|
| + SkASSERT(width >= 0); |
| + SkASSERT(height >= 0); |
| + SkImageInfo info = { |
| + width, height, kPMColor_SkColorType, kPremul_SkAlphaType |
| + }; |
| + return info; |
| + } |
| + |
| + static SkImageInfo MakePMOpaque(int width, int height) { |
| + SkASSERT(width >= 0); |
| + SkASSERT(height >= 0); |
| + SkImageInfo info = { |
| + width, height, kPMColor_SkColorType, kOpaque_SkAlphaType |
| + }; |
| + return info; |
| + } |
| + |
| + static SkImageInfo MakeA8(int width, int height) { |
| + SkASSERT(width >= 0); |
| + SkASSERT(height >= 0); |
| + SkImageInfo info = { |
| + width, height, kAlpha_8_SkColorType, kPremul_SkAlphaType |
| + }; |
| + return info; |
| + } |
| + |
| bool isOpaque() const { |
| return SkAlphaTypeIsOpaque(fAlphaType); |
| } |