Revert "More non-invertible shader local matrix guards"

This reverts commit 368af4605d.

Reason for revert: checking to see if this is breaking the Chrome DEPS roll
Original change's description:
> More non-invertible shader local matrix guards
> 
> Change-Id: Ida9a300420ff1d883e617cdaadb80e88c99ad226
> Reviewed-on: https://skia-review.googlesource.com/8333
> Reviewed-by: Mike Reed <reed@google.com>
> Commit-Queue: Florin Malita <fmalita@chromium.org>
> 

TBR=brianosman@google.com,fmalita@chromium.org,reed@google.com
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true

Change-Id: Id0a771342b9be27c85d91f511d814297b8c3e0b8
Reviewed-on: https://skia-review.googlesource.com/8345
Commit-Queue: Robert Phillips <robertphillips@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
This commit is contained in:
Robert Phillips 2017-02-11 01:19:30 +00:00 committed by Skia Commit-Bot
parent 3e50027f22
commit 54be5c9286
4 changed files with 12 additions and 14 deletions

View File

@ -39,6 +39,7 @@ class GrFragmentProcessor;
*/
class SK_API SkShader : public SkFlattenable {
public:
SkShader(const SkMatrix* localMatrix = NULL);
virtual ~SkShader();
/**
@ -466,8 +467,6 @@ public:
const SkMatrix& ctm, const SkPaint&) const;
protected:
SkShader(const SkMatrix* localMatrix = nullptr);
void flatten(SkWriteBuffer&) const override;
bool computeTotalInverse(const ContextRec&, SkMatrix* totalInverse) const;
@ -499,7 +498,9 @@ protected:
const SkMatrix* /*local matrix*/) const;
private:
const SkMatrix fLocalMatrix;
// This is essentially const, but not officially so it can be modified in
// constructors.
SkMatrix fLocalMatrix;
// So the SkLocalMatrixShader can whack fLocalMatrix in its SkReadBuffer constructor.
friend class SkLocalMatrixShader;

View File

@ -106,10 +106,7 @@ SkPictureShader::SkPictureShader(sk_sp<SkPicture> picture, TileMode tmx, TileMod
sk_sp<SkShader> SkPictureShader::Make(sk_sp<SkPicture> picture, TileMode tmx, TileMode tmy,
const SkMatrix* localMatrix, const SkRect* tile) {
if (!picture ||
picture->cullRect().isEmpty() ||
(tile && tile->isEmpty()) ||
(localMatrix && !localMatrix->invert(nullptr))) {
if (!picture || picture->cullRect().isEmpty() || (tile && tile->isEmpty())) {
return SkShader::MakeEmptyShader();
}
return sk_sp<SkShader>(new SkPictureShader(std::move(picture), tmx, tmy, localMatrix, tile));

View File

@ -45,11 +45,13 @@ static inline void dec_shader_counter() {
#endif
}
SkShader::SkShader(const SkMatrix* localMatrix)
: fLocalMatrix(localMatrix ? *localMatrix : SkMatrix::I()) {
SkASSERT(!localMatrix || localMatrix->invert(nullptr));
SkShader::SkShader(const SkMatrix* localMatrix) {
inc_shader_counter();
if (localMatrix) {
fLocalMatrix = *localMatrix;
} else {
fLocalMatrix.reset();
}
// Pre-cache so future calls to fLocalMatrix.getType() are threadsafe.
(void)fLocalMatrix.getType();
}

View File

@ -100,9 +100,7 @@ sk_sp<SkShader> SkImageShader::Make(sk_sp<SkImage> image, TileMode tx, TileMode
const SkMatrix* localMatrix,
SkTBlitterAllocator* allocator) {
SkShader* shader;
if (!image ||
bitmap_is_too_big(image->width(), image->height()) ||
(localMatrix && !localMatrix->invert(nullptr))) {
if (!image || bitmap_is_too_big(image->width(), image->height())) {
if (nullptr == allocator) {
shader = new SkEmptyShader;
} else {