Align const pointer casts in SkRect

Clang5 reports this as a bug.

Bug: skia:
Change-Id: I838b8abf2399429358f83d3232dc9d2caac54967
Reviewed-on: https://skia-review.googlesource.com/26080
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Kevin Lubick 2017-07-24 08:58:37 -04:00 committed by Skia Commit-Bot
parent 55963bcaab
commit 8e5be413c1

View File

@ -456,7 +456,7 @@ struct SK_API SkRect {
static SkRect Make(const SkISize& size) { static SkRect Make(const SkISize& size) {
return MakeIWH(size.width(), size.height()); return MakeIWH(size.width(), size.height());
} }
static SkRect SK_WARN_UNUSED_RESULT Make(const SkIRect& irect) { static SkRect SK_WARN_UNUSED_RESULT Make(const SkIRect& irect) {
SkRect r; SkRect r;
r.set(SkIntToScalar(irect.fLeft), r.set(SkIntToScalar(irect.fLeft),
@ -512,11 +512,11 @@ struct SK_API SkRect {
SkScalar centerY() const { return SkScalarHalf(fTop + fBottom); } SkScalar centerY() const { return SkScalarHalf(fTop + fBottom); }
friend bool operator==(const SkRect& a, const SkRect& b) { friend bool operator==(const SkRect& a, const SkRect& b) {
return SkScalarsEqual((SkScalar*)&a, (SkScalar*)&b, 4); return SkScalarsEqual((const SkScalar*)&a, (const SkScalar*)&b, 4);
} }
friend bool operator!=(const SkRect& a, const SkRect& b) { friend bool operator!=(const SkRect& a, const SkRect& b) {
return !SkScalarsEqual((SkScalar*)&a, (SkScalar*)&b, 4); return !SkScalarsEqual((const SkScalar*)&a, (const SkScalar*)&b, 4);
} }
/** return the 4 points that enclose the rectangle (top-left, top-right, bottom-right, /** return the 4 points that enclose the rectangle (top-left, top-right, bottom-right,
@ -633,7 +633,7 @@ struct SK_API SkRect {
SkRect makeOffset(SkScalar dx, SkScalar dy) const { SkRect makeOffset(SkScalar dx, SkScalar dy) const {
return MakeLTRB(fLeft + dx, fTop + dy, fRight + dx, fBottom + dy); return MakeLTRB(fLeft + dx, fTop + dy, fRight + dx, fBottom + dy);
} }
/** /**
* Return a new Rect, built as an inset of this rect. * Return a new Rect, built as an inset of this rect.
*/ */
@ -883,14 +883,14 @@ public:
this->round(&ir); this->round(&ir);
return ir; return ir;
} }
//! Returns the result of calling roundOut(&dst) //! Returns the result of calling roundOut(&dst)
SkIRect roundOut() const { SkIRect roundOut() const {
SkIRect ir; SkIRect ir;
this->roundOut(&ir); this->roundOut(&ir);
return ir; return ir;
} }
/** /**
* Swap top/bottom or left/right if there are flipped (i.e. if width() * Swap top/bottom or left/right if there are flipped (i.e. if width()
* or height() would have returned a negative value.) This should be called * or height() would have returned a negative value.) This should be called