fix drawDRRect for fuzzer

make assert abort instead

Bug: skia:6450
Change-Id: I23ff51124fa8f069f2c7e5260f800017d7475d46
Reviewed-on: https://skia-review.googlesource.com/13197
Commit-Queue: Cary Clark <caryclark@google.com>
Reviewed-by: Hal Canary <halcanary@google.com>
This commit is contained in:
Cary Clark 2017-04-12 12:03:15 -04:00 committed by Skia Commit-Bot
parent 994ef97339
commit e0b728726d
2 changed files with 29 additions and 3 deletions

View File

@ -1770,11 +1770,13 @@ void SkCanvas::drawDRRect(const SkRRect& outer, const SkRRect& inner,
}
// We don't have this method (yet), but technically this is what we should
// be able to assert...
// SkASSERT(outer.contains(inner));
// be able to return ...
// if (!outer.contains(inner))) {
//
// For now at least check for containment of bounds
SkASSERT(outer.getBounds().contains(inner.getBounds()));
if (!outer.getBounds().contains(inner.getBounds())) {
return;
}
this->onDrawDRRect(outer, inner, paint);
}

View File

@ -8,6 +8,7 @@
#include "SkAutoMalloc.h"
#include "SkCanvas.h"
#include "SkGeometry.h"
#include "SkNullCanvas.h"
#include "SkPaint.h"
#include "SkParse.h"
#include "SkParsePath.h"
@ -24,6 +25,7 @@
#include "Test.h"
#include <cmath>
static void set_radii(SkVector radii[4], int index, float rad) {
sk_bzero(radii, sizeof(SkVector) * 4);
radii[index].set(rad, rad);
@ -4751,3 +4753,25 @@ DEF_TEST(path_tight_bounds, reporter) {
}
}
}
DEF_TEST(skbug_6450, r) {
SkRect ri = { 0.18554693f, 195.26283f, 0.185784385f, 752.644409f };
SkVector rdi[4] = {
{ 1.81159976e-09f, 7.58768801e-05f },
{ 0.000118725002f, 0.000118725002f },
{ 0.000118725002f, 0.000118725002f },
{ 0.000118725002f, 0.486297607f }
};
SkRRect irr;
irr.setRectRadii(ri, rdi);
SkRect ro = { 9.18354821e-39f, 2.1710848e+9f, 2.16945843e+9f, 3.47808128e+9f };
SkVector rdo[4] = {
{ 0, 0 },
{ 0.0103298295f, 0.185887396f },
{ 2.52999727e-29f, 169.001938f },
{ 195.262741f, 195.161255f }
};
SkRRect orr;
orr.setRectRadii(ro, rdo);
SkMakeNullCanvas()->drawDRRect(orr, irr, SkPaint());
}