Chromium Code Reviews| Index: tests/QuickRejectTest.cpp |
| diff --git a/tests/QuickRejectTest.cpp b/tests/QuickRejectTest.cpp |
| index b39484bd89c488578fa24b6a1db1d370a4bbfad8..1aee34632097febd08b38c291deaa1f076c049d4 100644 |
| --- a/tests/QuickRejectTest.cpp |
| +++ b/tests/QuickRejectTest.cpp |
| @@ -7,6 +7,7 @@ |
| #include "SkCanvas.h" |
| #include "SkDrawLooper.h" |
| +#include "SkLightingImageFilter.h" |
| #include "SkTypes.h" |
| #include "Test.h" |
| @@ -145,3 +146,26 @@ DEF_TEST(QuickReject, reporter) { |
| test_layers(reporter); |
| test_quick_reject(reporter); |
| } |
| + |
| +// Regression test to make sure that we keep fIsScaleTranslate up to date on the canvas. |
|
tomhudson
2016/08/19 15:09:03
Presumably the point is that sometimes we set a ma
msarett
2016/08/19 15:15:31
Yes, updating comment.
|
| +DEF_TEST(QuickReject_MatrixState, reporter) { |
| + SkCanvas canvas(100, 100); |
| + |
| + // Set rotation matrix. |
|
tomhudson
2016/08/19 15:09:03
Nit: this is not a useful comment?
msarett
2016/08/19 15:15:31
Removed.
|
| + SkMatrix matrix; |
| + matrix.setRotate(45.0f); |
| + canvas.setMatrix(matrix); |
| + |
| + // Set image filter. |
|
tomhudson
2016/08/19 15:09:03
Nit: nor is this.
msarett
2016/08/19 15:15:31
Removed.
|
| + SkPaint paint; |
| + sk_sp<SkImageFilter> filter = SkLightingImageFilter::MakeDistantLitDiffuse( |
| + SkPoint3::Make(1.0f, 1.0f, 1.0f), 0xFF0000FF, 2.0f, 0.5f, nullptr); |
| + REPORTER_ASSERT(reporter, filter); |
| + paint.setImageFilter(filter); |
| + SkCanvas::SaveLayerRec rec; |
| + rec.fPaint = &paint; |
| + canvas.saveLayer(rec); |
| + |
| + // Call quickReject(). It will assert if the matrix is out of sync. |
|
tomhudson
2016/08/19 15:09:03
// quickReject() will assert if the matrix is out
msarett
2016/08/19 15:15:31
Done.
|
| + canvas.quickReject(SkRect::MakeWH(100.0f, 100.0f)); |
| +} |