Bug 1713769 - Ensure extracting SkImage subset is actually successful. r=gfx-reviewers,jrmuizel

If ExtractSubset fails on an SkImage, we may accidentally call image->makeShader
with a null image below that. We need to bail out in that case so that we don't
do that.

Differential Revision: https://phabricator.services.mozilla.com/D128667
This commit is contained in:
Lee Salzman 2021-10-16 03:23:42 +00:00
Родитель a80aa30af6
Коммит b2f18bd6b9
1 изменённых файлов: 4 добавлений и 0 удалений

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

@ -573,6 +573,10 @@ static void SetPaintPattern(SkPaint& aPaint, const Pattern& aPattern,
if (!pat.mSamplingRect.IsEmpty()) {
image = ExtractSubset(image, pat.mSamplingRect);
if (!image) {
aPaint.setColor(SK_ColorTRANSPARENT);
break;
}
mat.preTranslate(pat.mSamplingRect.X(), pat.mSamplingRect.Y());
}