aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-06-02 13:07:26 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-02 13:07:26 -0700
commitc77392ed58ec78ab19fa0e3ff99fb8110854fba2 (patch)
tree35917d403903038c3e266f20fd14886ac22d9c98 /include/core
parent80f709a0d7f2f1d0d35a292c0c3189d3a50b4993 (diff)
use colortype instead of config
clone of https://codereview.chromium.org/305133006/ TBR= BUG=skia: Author: reed@google.com Review URL: https://codereview.chromium.org/301233011
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkImageInfo.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h
index 83919549d5..d66158d02c 100644
--- a/include/core/SkImageInfo.h
+++ b/include/core/SkImageInfo.h
@@ -189,6 +189,14 @@ struct SkImageInfo {
SkISize dimensions() const { return SkISize::Make(fWidth, fHeight); }
+ /**
+ * Return a new ImageInfo with the same colortype and alphatype as this info,
+ * but with the specified width and height.
+ */
+ SkImageInfo makeWH(int newWidth, int newHeight) const {
+ return SkImageInfo::Make(newWidth, newHeight, fColorType, fAlphaType);
+ }
+
int bytesPerPixel() const {
return SkColorTypeBytesPerPixel(fColorType);
}