SkPictureShader should handle negative scaling gracefully.
Let's not choke on inverted tiles. BUG=chromium:447707 R=robertphillips@google.com,reed@google.com Review URL: https://codereview.chromium.org/852213002
This commit is contained in:
parent
114c3cd054
commit
b0878797b4
@ -51,3 +51,6 @@ filterindiabox
|
|||||||
# possibly also reed?
|
# possibly also reed?
|
||||||
coloremoji
|
coloremoji
|
||||||
fontmgr_iter
|
fontmgr_iter
|
||||||
|
|
||||||
|
# fmalita - rebaseline for http://crbug.com/447707
|
||||||
|
pictureshader
|
||||||
|
@ -51,7 +51,7 @@ protected:
|
|||||||
}
|
}
|
||||||
|
|
||||||
SkISize onISize() SK_OVERRIDE {
|
SkISize onISize() SK_OVERRIDE {
|
||||||
return SkISize::Make(1400, 1250);
|
return SkISize::Make(1400, 1450);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
void onDraw(SkCanvas* canvas) SK_OVERRIDE {
|
||||||
@ -61,6 +61,28 @@ protected:
|
|||||||
this->drawSceneColumn(canvas, SkPoint::Make(fSceneSize * 2.4f, fSceneSize * 6.4f), 1, 1, 2);
|
this->drawSceneColumn(canvas, SkPoint::Make(fSceneSize * 2.4f, fSceneSize * 6.4f), 1, 1, 2);
|
||||||
this->drawSceneColumn(canvas, SkPoint::Make(fSceneSize * 4.8f, 0), 2, 1, 0);
|
this->drawSceneColumn(canvas, SkPoint::Make(fSceneSize * 4.8f, 0), 2, 1, 0);
|
||||||
this->drawSceneColumn(canvas, SkPoint::Make(fSceneSize * 9.6f, 0), 2, 2, 0);
|
this->drawSceneColumn(canvas, SkPoint::Make(fSceneSize * 9.6f, 0), 2, 2, 0);
|
||||||
|
|
||||||
|
// One last custom row to exercise negative scaling
|
||||||
|
SkMatrix ctm, localMatrix;
|
||||||
|
ctm.setTranslate(fSceneSize * 2.1f, fSceneSize * 13.8f);
|
||||||
|
ctm.preScale(-1, -1);
|
||||||
|
localMatrix.setScale(2, 2);
|
||||||
|
this->drawScene(canvas, ctm, localMatrix, 0);
|
||||||
|
|
||||||
|
ctm.setTranslate(fSceneSize * 2.4f, fSceneSize * 12.8f);
|
||||||
|
localMatrix.setScale(-1, -1);
|
||||||
|
this->drawScene(canvas, ctm, localMatrix, 0);
|
||||||
|
|
||||||
|
ctm.setTranslate(fSceneSize * 4.8f, fSceneSize * 12.3f);
|
||||||
|
ctm.preScale(2, 2);
|
||||||
|
this->drawScene(canvas, ctm, localMatrix, 0);
|
||||||
|
|
||||||
|
ctm.setTranslate(fSceneSize * 13.8f, fSceneSize * 14.3f);
|
||||||
|
ctm.preScale(-2, -2);
|
||||||
|
localMatrix.setTranslate(fTileSize / 4, fTileSize / 4);
|
||||||
|
localMatrix.preRotate(45);
|
||||||
|
localMatrix.preScale(-2, -2);
|
||||||
|
this->drawScene(canvas, ctm, localMatrix, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -157,7 +157,8 @@ SkShader* SkPictureShader::refBitmapShader(const SkMatrix& matrix, const SkMatri
|
|||||||
scale.set(SkScalarSqrt(m.getScaleX() * m.getScaleX() + m.getSkewX() * m.getSkewX()),
|
scale.set(SkScalarSqrt(m.getScaleX() * m.getScaleX() + m.getSkewX() * m.getSkewX()),
|
||||||
SkScalarSqrt(m.getScaleY() * m.getScaleY() + m.getSkewY() * m.getSkewY()));
|
SkScalarSqrt(m.getScaleY() * m.getScaleY() + m.getSkewY() * m.getSkewY()));
|
||||||
}
|
}
|
||||||
SkSize scaledSize = SkSize::Make(scale.x() * fTile.width(), scale.y() * fTile.height());
|
SkSize scaledSize = SkSize::Make(SkScalarAbs(scale.x() * fTile.width()),
|
||||||
|
SkScalarAbs(scale.y() * fTile.height()));
|
||||||
|
|
||||||
// Clamp the tile size to about 16M pixels
|
// Clamp the tile size to about 16M pixels
|
||||||
static const SkScalar kMaxTileArea = 4096 * 4096;
|
static const SkScalar kMaxTileArea = 4096 * 4096;
|
||||||
|
Loading…
Reference in New Issue
Block a user