| Index: cc/region.h
|
| diff --git a/cc/region.h b/cc/region.h
|
| index ec21c65fc9ff2248dff15f9007269ee795cc74fc..db622096f90c0d9450004122789030db15fd77a2 100644
|
| --- a/cc/region.h
|
| +++ b/cc/region.h
|
| @@ -9,9 +9,16 @@
|
|
|
| #include "base/logging.h"
|
| #include "cc/cc_export.h"
|
| -#include "third_party/skia/include/core/SkRegion.h"
|
| #include "ui/gfx/rect.h"
|
|
|
| +#define USE_ANDROID_REGION
|
| +
|
| +#ifdef USE_ANDROID_REGION
|
| +#include "cc/android_region.h"
|
| +#else
|
| +#include "third_party/skia/include/core/SkRegion.h"
|
| +#endif
|
| +
|
| namespace cc {
|
|
|
| class CC_EXPORT Region {
|
| @@ -40,10 +47,14 @@ 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;
|
|
|
| gfx::Rect bounds() const {
|
| +#ifdef USE_ANDROID_REGION
|
| + SkIRect r = droidregion_.bounds();
|
| +#else
|
| SkIRect r = skregion_.getBounds();
|
| +#endif
|
| // TODO(danakj) Use method from ui/gfx/skia_utils.h when it exists.
|
| return gfx::Rect(r.x(), r.y(), r.width(), r.height());
|
| }
|
| @@ -56,24 +67,45 @@ class CC_EXPORT Region {
|
| ~Iterator();
|
|
|
| gfx::Rect rect() const {
|
| +#ifdef USE_ANDROID_REGION
|
| + SkIRect r = *it_;
|
| +#else
|
| SkIRect r = it_.rect();
|
| +#endif
|
| // TODO(danakj) Use method from ui/gfx/skia_utils.h when it exists.
|
| return gfx::Rect(r.x(), r.y(), r.width(), r.height());
|
| }
|
|
|
| void next() {
|
| +#ifdef USE_ANDROID_REGION
|
| + ++it_;
|
| +#else
|
| it_.next();
|
| +#endif
|
| }
|
| bool has_rect() const {
|
| +#ifdef USE_ANDROID_REGION
|
| + return it_ != droidregion_.end();
|
| +#else
|
| return !it_.done();
|
| +#endif
|
| }
|
|
|
| private:
|
| +#ifdef USE_ANDROID_REGION
|
| + const android::Region& droidregion_;
|
| + android::Region::const_iterator it_;
|
| +#else
|
| SkRegion::Iterator it_;
|
| +#endif
|
| };
|
|
|
| private:
|
| +#ifdef USE_ANDROID_REGION
|
| + android::Region droidregion_;
|
| +#else
|
| SkRegion skregion_;
|
| +#endif
|
| };
|
|
|
| inline bool operator==(const Region& a, const Region& b) {
|
|
|