diff options
author | 2017-02-01 15:01:43 -0800 | |
---|---|---|
committer | 2017-02-02 16:03:58 +0000 | |
commit | ebfbba9bbdacd754c8ad7429ee066f53f17bc66b (patch) | |
tree | a54ded2d599d3649c933f1f67937467f001429d1 /src/core | |
parent | 41511604ae0aadddef0c4defeb73dcbe4408ff66 (diff) |
Don't instantiate shaders with non-invertible local matrix
Change-Id: If11f7d57cbf45929632d858f91c02d8f5fa9f442
Reviewed-on: https://skia-review.googlesource.com/7885
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Florin Malita <fmalita@chromium.org>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkShader.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/SkShader.cpp b/src/core/SkShader.cpp index 9e562c9276..9f97a7a74a 100644 --- a/src/core/SkShader.cpp +++ b/src/core/SkShader.cpp @@ -241,11 +241,17 @@ sk_sp<SkShader> SkShader::MakeColorShader(SkColor color) { return sk_make_sp<SkC sk_sp<SkShader> SkShader::MakeBitmapShader(const SkBitmap& src, TileMode tmx, TileMode tmy, const SkMatrix* localMatrix) { + if (localMatrix && !localMatrix->invert(nullptr)) { + return nullptr; + } return SkMakeBitmapShader(src, tmx, tmy, localMatrix, kIfMutable_SkCopyPixelsMode, nullptr); } sk_sp<SkShader> SkShader::MakePictureShader(sk_sp<SkPicture> src, TileMode tmx, TileMode tmy, const SkMatrix* localMatrix, const SkRect* tile) { + if (localMatrix && !localMatrix->invert(nullptr)) { + return nullptr; + } return SkPictureShader::Make(std::move(src), tmx, tmy, localMatrix, tile); } |