make quickReject treat empty rects and paths the same
Change-Id: Ie334a2f0aa354ea3b52f6143e2659fd74fdd6185 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/334100 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Mike Reed <reed@google.com>
This commit is contained in:
parent
e9bbbfe057
commit
d986835a6c
@ -1784,6 +1784,10 @@ bool SkCanvas::quickReject(const SkRect& src) const {
|
||||
SkASSERT(fIsScaleTranslate == SkMatrixPriv::IsScaleTranslateAsM33(fMCRec->fMatrix));
|
||||
#endif
|
||||
|
||||
if (src.isEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!fIsScaleTranslate) {
|
||||
return quick_reject_slow_path(src, fDeviceClipBounds, fMCRec->fMatrix.asM33());
|
||||
}
|
||||
@ -1812,7 +1816,7 @@ bool SkCanvas::quickReject(const SkRect& src) const {
|
||||
}
|
||||
|
||||
bool SkCanvas::quickReject(const SkPath& path) const {
|
||||
return path.isEmpty() || this->quickReject(path.getBounds());
|
||||
return this->quickReject(path.getBounds());
|
||||
}
|
||||
|
||||
SkRect SkCanvas::getLocalClipBounds() const {
|
||||
|
@ -760,3 +760,10 @@ DEF_TEST(canvas_markctm, reporter) {
|
||||
// found the previous one
|
||||
REPORTER_ASSERT(reporter, canvas.findMarkedCTM(id_a, &m) && m == a1);
|
||||
}
|
||||
|
||||
DEF_TEST(Canvas_quickreject_empty, reporter) {
|
||||
SkCanvas canvas(10, 10);
|
||||
|
||||
REPORTER_ASSERT(reporter, canvas.quickReject({0,0,0,0}));
|
||||
REPORTER_ASSERT(reporter, canvas.quickReject(SkPath()));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user