Add dirty_after_edit to SkPath::moveTo. Add commented out test case that triggers assert.
BUG=skia:1460 R=reed@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/517023003
This commit is contained in:
parent
4e4b935d52
commit
b17c129108
@ -671,6 +671,8 @@ void SkPath::moveTo(SkScalar x, SkScalar y) {
|
||||
fLastMoveToIndex = fPathRef->countPoints();
|
||||
|
||||
ed.growForVerb(kMove_Verb)->set(x, y);
|
||||
|
||||
DIRTY_AFTER_EDIT;
|
||||
}
|
||||
|
||||
void SkPath::rMoveTo(SkScalar x, SkScalar y) {
|
||||
|
@ -1504,7 +1504,19 @@ static void test_conservativelyContains(skiatest::Reporter* reporter) {
|
||||
SkIntToScalar(20),
|
||||
SkIntToScalar(5))));
|
||||
|
||||
// same as above path and first test but with an extra moveTo.
|
||||
|
||||
// Test that multiple move commands do not cause asserts.
|
||||
|
||||
// At the time of writing, this would not modify cached convexity. This caused an assert while
|
||||
// checking conservative containment again. http://skbug.com/1460
|
||||
path.moveTo(SkIntToScalar(100), SkIntToScalar(100));
|
||||
#if 0
|
||||
REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(SkIntToScalar(50), 0,
|
||||
SkIntToScalar(10),
|
||||
SkIntToScalar(10))));
|
||||
#endif
|
||||
|
||||
// Same as above path and first test but with an extra moveTo.
|
||||
path.reset();
|
||||
path.moveTo(100, 100);
|
||||
path.moveTo(0, 0);
|
||||
@ -1515,6 +1527,21 @@ static void test_conservativelyContains(skiatest::Reporter* reporter) {
|
||||
SkIntToScalar(10),
|
||||
SkIntToScalar(10))));
|
||||
|
||||
// Test that multiple move commands do not cause asserts and that the function
|
||||
// is not confused by the multiple moves.
|
||||
path.reset();
|
||||
path.moveTo(0, 0);
|
||||
path.lineTo(SkIntToScalar(100), 0);
|
||||
path.lineTo(0, SkIntToScalar(100));
|
||||
path.moveTo(0, SkIntToScalar(200));
|
||||
path.lineTo(SkIntToScalar(100), SkIntToScalar(200));
|
||||
path.lineTo(0, SkIntToScalar(300));
|
||||
|
||||
REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(
|
||||
SkRect::MakeXYWH(SkIntToScalar(50), 0,
|
||||
SkIntToScalar(10),
|
||||
SkIntToScalar(10))));
|
||||
|
||||
path.reset();
|
||||
path.lineTo(100, 100);
|
||||
REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH(0, 0, 1, 1)));
|
||||
|
Loading…
Reference in New Issue
Block a user