Bug 1248223 - verify that stroke widths are finite for Skia. r=jmuizelaar

This commit is contained in:
Lee Salzman 2016-02-23 18:09:03 -05:00
Родитель 5d028c4e25
Коммит 876e94a736
2 изменённых файлов: 9 добавлений и 4 удалений

Просмотреть файл

@ -142,7 +142,8 @@ StrokeOptionsToPaint(SkPaint& aPaint, const StrokeOptions &aOptions)
{
// Skia renders 0 width strokes with a width of 1 (and in black),
// so we should just skip the draw call entirely.
if (!aOptions.mLineWidth) {
// Skia does not handle non-finite line widths.
if (!aOptions.mLineWidth || !IsFinite(aOptions.mLineWidth)) {
return false;
}
aPaint.setStrokeWidth(SkFloatToScalar(aOptions.mLineWidth));

Просмотреть файл

@ -190,7 +190,9 @@ PathSkia::StrokeContainsPoint(const StrokeOptions &aStrokeOptions,
}
SkPaint paint;
StrokeOptionsToPaint(paint, aStrokeOptions);
if (!StrokeOptionsToPaint(paint, aStrokeOptions)) {
return false;
}
SkPath strokePath;
paint.getFillPath(mPath, &strokePath);
@ -218,8 +220,10 @@ PathSkia::GetStrokedBounds(const StrokeOptions &aStrokeOptions,
}
SkPaint paint;
StrokeOptionsToPaint(paint, aStrokeOptions);
if (!StrokeOptionsToPaint(paint, aStrokeOptions)) {
return Rect();
}
SkPath result;
paint.getFillPath(mPath, &result);