devirtualize SkCanvas getClipBounds methods

We no longer have any subclasses overriding the virtual hooks,
and we've seen subtle bugs come up back when they did.

In all modes, SkCanvas can answer these queries itself.

BUG=chromium:781238

Change-Id: I37c7511c7bd00c638faacbe4bee89f785691453f
Reviewed-on: https://skia-review.googlesource.com/77202
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
Mike Klein 2017-11-28 17:08:45 -05:00 committed by Skia Commit-Bot
parent 5eaa297267
commit 83c8dd9b1a
2 changed files with 7 additions and 11 deletions

View File

@ -1025,7 +1025,7 @@ public:
@return bounds of clip in local coordinates
*/
SkRect getLocalClipBounds() const { return this->onGetLocalClipBounds(); }
SkRect getLocalClipBounds() const;
/** Return bounds of clip, transformed by inverse of SkMatrix. If clip is empty,
return false, and set bounds to SkRect::MakeEmpty, where all SkRect sides equal zero.
@ -1037,7 +1037,7 @@ public:
@return true if clip bounds is not empty
*/
bool getLocalClipBounds(SkRect* bounds) const {
*bounds = this->onGetLocalClipBounds();
*bounds = this->getLocalClipBounds();
return !bounds->isEmpty();
}
@ -1048,7 +1048,7 @@ public:
@return bounds of clip in SkBaseDevice coordinates
*/
SkIRect getDeviceClipBounds() const { return this->onGetDeviceClipBounds(); }
SkIRect getDeviceClipBounds() const;
/** Return SkIRect bounds of clip, unaffected by SkMatrix. If clip is empty,
return false, and set bounds to SkRect::MakeEmpty, where all SkRect sides equal zero.
@ -1059,7 +1059,7 @@ public:
@return true if clip bounds is not empty
*/
bool getDeviceClipBounds(SkIRect* bounds) const {
*bounds = this->onGetDeviceClipBounds();
*bounds = this->getDeviceClipBounds();
return !bounds->isEmpty();
}
@ -2471,10 +2471,6 @@ protected:
this->didConcat(SkMatrix::MakeTrans(dx, dy));
}
virtual SkRect onGetLocalClipBounds() const;
virtual SkIRect onGetDeviceClipBounds() const;
virtual void onDrawAnnotation(const SkRect& rect, const char key[], SkData* value);
virtual void onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint);

View File

@ -1634,8 +1634,8 @@ bool SkCanvas::quickReject(const SkPath& path) const {
return path.isEmpty() || this->quickReject(path.getBounds());
}
SkRect SkCanvas::onGetLocalClipBounds() const {
SkIRect ibounds = this->onGetDeviceClipBounds();
SkRect SkCanvas::getLocalClipBounds() const {
SkIRect ibounds = this->getDeviceClipBounds();
if (ibounds.isEmpty()) {
return SkRect::MakeEmpty();
}
@ -1657,7 +1657,7 @@ SkRect SkCanvas::onGetLocalClipBounds() const {
return bounds;
}
SkIRect SkCanvas::onGetDeviceClipBounds() const {
SkIRect SkCanvas::getDeviceClipBounds() const {
return fMCRec->fRasterClip.getBounds();
}