diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-12 21:44:44 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-12 21:44:44 +0000 |
commit | 6c50bfb93535623550aeab906f2119610c28cb29 (patch) | |
tree | f0cbce7830db3c0ad328cc13aaa90960b7d86f64 /cc/region.h | |
parent | e5de0f7c04d74d4e7b5d11466f4b9279c29b2f82 (diff) | |
download | chromium_src-6c50bfb93535623550aeab906f2119610c28cb29.zip chromium_src-6c50bfb93535623550aeab906f2119610c28cb29.tar.gz chromium_src-6c50bfb93535623550aeab906f2119610c28cb29.tar.bz2 |
ui: Add SkIRectToRect() function to convert from SkIRect type to gfx::Rect.
This fixes the 3 TODOs for Dana from region.*
TEST=cc_unittests,ui_unittests
R=danakj@chromium.org
Review URL: https://codereview.chromium.org/11410025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@167244 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/region.h')
-rw-r--r-- | cc/region.h | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/cc/region.h b/cc/region.h index 00e2bd1..badd33c 100644 --- a/cc/region.h +++ b/cc/region.h @@ -11,6 +11,7 @@ #include "cc/cc_export.h" #include "third_party/skia/include/core/SkRegion.h" #include "ui/gfx/rect.h" +#include "ui/gfx/skia_util.h" namespace cc { @@ -42,12 +43,12 @@ class CC_EXPORT Region { void Intersect(gfx::Rect rect); void Intersect(const Region& region); - bool Equals(const Region& other) const { return skregion_ == other.skregion_; } + bool Equals(const Region& other) const { + return skregion_ == other.skregion_; + } gfx::Rect bounds() const { - SkIRect r = skregion_.getBounds(); - // TODO(danakj) Use method from ui/gfx/skia_utils.h when it exists. - return gfx::Rect(r.x(), r.y(), r.width(), r.height()); + return gfx::SkIRectToRect(skregion_.getBounds()); } std::string ToString() const; @@ -58,14 +59,13 @@ class CC_EXPORT Region { ~Iterator(); gfx::Rect rect() const { - SkIRect r = it_.rect(); - // TODO(danakj) Use method from ui/gfx/skia_utils.h when it exists. - return gfx::Rect(r.x(), r.y(), r.width(), r.height()); + return gfx::SkIRectToRect(it_.rect()); } void next() { it_.next(); } + bool has_rect() const { return !it_.done(); } |