From f622a6c8fd176acf9944de8df00d7f0bb56b67d3 Mon Sep 17 00:00:00 2001 From: halcanary Date: Fri, 24 Oct 2014 12:54:53 -0700 Subject: Add `SkIRect bounds()` convenience method to SkImageInfo and SkBitmap. Review URL: https://codereview.chromium.org/646213003 --- include/core/SkBitmap.h | 3 +++ include/core/SkImageInfo.h | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'include') 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); } /** -- cgit v1.2.3