Fix special case in SkRRect::setOval where the oval devolves to a rect

Bug:1119593
Change-Id: I6c25c54840f44b5143e40b4ec5da403a737e9d1c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/326441
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2020-10-13 16:49:06 -04:00 committed by Skia Commit-Bot
parent 6ffcb23435
commit 52ace08ef8

View File

@ -193,10 +193,16 @@ public:
SkScalar xRad = SkScalarHalf(fRect.width());
SkScalar yRad = SkScalarHalf(fRect.height());
for (int i = 0; i < 4; ++i) {
fRadii[i].set(xRad, yRad);
if (xRad == 0.0f || yRad == 0.0f) {
// All the corners will be square
memset(fRadii, 0, sizeof(fRadii));
fType = kRect_Type;
} else {
for (int i = 0; i < 4; ++i) {
fRadii[i].set(xRad, yRad);
}
fType = kOval_Type;
}
fType = kOval_Type;
SkASSERT(this->isValid());
}