Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(317)

Unified Diff: tests/QuickRejectTest.cpp

Issue 2263513003: Fix bug, always keep fIsScaleTranslate in correct state (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Improve comments Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/QuickRejectTest.cpp
diff --git a/tests/QuickRejectTest.cpp b/tests/QuickRejectTest.cpp
index b39484bd89c488578fa24b6a1db1d370a4bbfad8..8f6556bcd6fba7c35ee3dc26fdb5a1d3eab4fc77 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.
+// It is possible to set a new matrix on the canvas without calling setMatrix(). This tests
+// that code path.
+DEF_TEST(QuickReject_MatrixState, reporter) {
+ SkCanvas canvas(100, 100);
+
+ SkMatrix matrix;
+ matrix.setRotate(45.0f);
+ canvas.setMatrix(matrix);
+
+ 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);
+
+ // quickReject() will assert if the matrix is out of sync.
+ canvas.quickReject(SkRect::MakeWH(100.0f, 100.0f));
+}
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698