diff options
author | 2014-01-13 20:28:50 +0000 | |
---|---|---|
committer | 2014-01-13 20:28:50 +0000 | |
commit | f0b56e74485d59465194b21f89fa3bc3a7962ac6 (patch) | |
tree | 7c8922e9ebead92d3d1ef93bbcd378c4eb3b05fb /include/core/SkImageInfo.h | |
parent | 9b06ba4c91484d09565ff4a572d8c5af15dd429e (diff) |
Revert "Revert of https://codereview.chromium.org/129423002/"
fixed new api references in unit tests
This reverts commit ffc0058e1fbcbd69617e1f41b2dce5b5765ff99e.
BUG=
Review URL: https://codereview.chromium.org/132643007
git-svn-id: http://skia.googlecode.com/svn/trunk@13057 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkImageInfo.h')
-rw-r--r-- | include/core/SkImageInfo.h | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h index 1165479f74..e0bce2a7c0 100644 --- a/include/core/SkImageInfo.h +++ b/include/core/SkImageInfo.h @@ -109,6 +109,60 @@ 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; + } + + /** + * Sets colortype to the native ARGB32 type. + */ + static SkImageInfo MakeN32(int width, int height, SkAlphaType at) { + SkASSERT(width >= 0); + SkASSERT(height >= 0); + SkImageInfo info = { + width, height, kPMColor_SkColorType, at + }; + return info; + } + + /** + * Sets colortype to the native ARGB32 type, and the alphatype to premul. + */ + static SkImageInfo MakeN32Premul(int width, int height) { + SkASSERT(width >= 0); + SkASSERT(height >= 0); + SkImageInfo info = { + width, height, kPMColor_SkColorType, kPremul_SkAlphaType + }; + return info; + } + + /** + * Sets colortype to the native ARGB32 type, and the alphatype to opaque. + */ + static SkImageInfo MakeN32Opaque(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); } |