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

Side by Side Diff: tests/PictureTest.cpp

Issue 14819008: Fix SkPicture path bound optimization to handle inverse filled paths. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "Test.h" 7 #include "Test.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 { 442 {
443 // Test without call to endRecording 443 // Test without call to endRecording
444 SkPicture picture; 444 SkPicture picture;
445 picture.beginRecording(1, 1); 445 picture.beginRecording(1, 1);
446 SkPicture* destPicture = picture.clone(); 446 SkPicture* destPicture = picture.clone();
447 REPORTER_ASSERT(reporter, NULL != destPicture); 447 REPORTER_ASSERT(reporter, NULL != destPicture);
448 destPicture->unref(); 448 destPicture->unref();
449 } 449 }
450 } 450 }
451 451
452 static void test_inverse_fill_clip_opt(skiatest::Reporter* reporter) {
453 // Regression test for crbug.com/229011
454 SkPicture picture;
455 SkCanvas* canvas = picture.beginRecording(10, 10,
456 SkPicture::kUsePathBoundsForClip_RecordingFlag);
457 SkRect rect = SkRect::MakeXYWH(SkIntToScalar(4), SkIntToScalar(4),
458 SkIntToScalar(2), SkIntToScalar(2));
459 SkPath path;
460 path.addRect(rect);
461 path.setFillType(SkPath::kInverseEvenOdd_FillType);
462 canvas->clipPath(path);
463 SkIRect clipBounds;
464 bool nonEmpty = canvas->getClipDeviceBounds(&clipBounds);
465 REPORTER_ASSERT(reporter, true == nonEmpty);
466 REPORTER_ASSERT(reporter, 0 == clipBounds.fLeft);
467 REPORTER_ASSERT(reporter, 0 == clipBounds.fTop);
468 REPORTER_ASSERT(reporter, 10 == clipBounds.fBottom);
469 REPORTER_ASSERT(reporter, 10 == clipBounds.fRight);
470 }
471
452 static void TestPicture(skiatest::Reporter* reporter) { 472 static void TestPicture(skiatest::Reporter* reporter) {
453 #ifdef SK_DEBUG 473 #ifdef SK_DEBUG
454 test_deleting_empty_playback(); 474 test_deleting_empty_playback();
455 test_serializing_empty_picture(); 475 test_serializing_empty_picture();
456 #else 476 #else
457 test_bad_bitmap(); 477 test_bad_bitmap();
458 #endif 478 #endif
459 test_peephole(); 479 test_peephole();
460 test_gatherpixelrefs(reporter); 480 test_gatherpixelrefs(reporter);
461 test_bitmap_with_encoded_data(reporter); 481 test_bitmap_with_encoded_data(reporter);
462 test_clone_empty(reporter); 482 test_clone_empty(reporter);
483 test_inverse_fill_clip_opt(reporter);
463 } 484 }
464 485
465 #include "TestClassDef.h" 486 #include "TestClassDef.h"
466 DEFINE_TESTCLASS("Pictures", PictureTestClass, TestPicture) 487 DEFINE_TESTCLASS("Pictures", PictureTestClass, TestPicture)
OLDNEW
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698