diff options
author | halcanary <halcanary@google.com> | 2014-10-24 12:54:53 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-24 12:54:53 -0700 |
commit | f622a6c8fd176acf9944de8df00d7f0bb56b67d3 (patch) | |
tree | 11a136e816a7dfd26804f199c5d123a28e70c896 /include | |
parent | 87ab51862731ab0cd017e63d828fef31a193be40 (diff) |
Add `SkIRect bounds()` convenience method to SkImageInfo and SkBitmap.
Review URL: https://codereview.chromium.org/646213003
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkBitmap.h | 3 | ||||
-rw-r--r-- | include/core/SkImageInfo.h | 4 |
2 files changed, 6 insertions, 1 deletions
diff --git a/include/core/SkBitmap.h b/include/core/SkBitmap.h index b36a1fd3fd..cefc30ac82 100644 --- a/include/core/SkBitmap.h +++ b/include/core/SkBitmap.h @@ -220,6 +220,9 @@ public: void getBounds(SkRect* bounds) const; void getBounds(SkIRect* bounds) const; + SkIRect bounds() const { return fInfo.bounds(); } + SkISize dimensions() const { return fInfo.dimensions(); } + bool setInfo(const SkImageInfo&, size_t rowBytes = 0); /** diff --git a/include/core/SkImageInfo.h b/include/core/SkImageInfo.h index 7fedfa1a4a..6fbaf6bbce 100644 --- a/include/core/SkImageInfo.h +++ b/include/core/SkImageInfo.h @@ -9,10 +9,11 @@ #define SkImageInfo_DEFINED #include "SkMath.h" +#include "SkRect.h" #include "SkSize.h" -class SkWriteBuffer; class SkReadBuffer; +class SkWriteBuffer; /** * Describes how to interpret the alpha compoent of a pixel. @@ -207,6 +208,7 @@ public: return SkAlphaTypeIsOpaque(fAlphaType); } + SkIRect bounds() const { return SkIRect::MakeWH(fWidth, fHeight); } SkISize dimensions() const { return SkISize::Make(fWidth, fHeight); } /** |