OLD | NEW |
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 | 7 |
8 /* Description: | 8 /* Description: |
9 * This test defines a series of elementatry test steps that perform | 9 * This test defines a series of elementatry test steps that perform |
10 * a single or a small group of canvas API calls. Each test step is | 10 * a single or a small group of canvas API calls. Each test step is |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, pts, pts, | 489 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, pts, pts, |
490 NULL, NULL, NULL, 0, paint); | 490 NULL, NULL, NULL, 0, paint); |
491 } | 491 } |
492 // NYI: issue 240. | 492 // NYI: issue 240. |
493 TEST_STEP_NO_PDF(DrawVerticesShader, DrawVerticesShaderTestStep); | 493 TEST_STEP_NO_PDF(DrawVerticesShader, DrawVerticesShaderTestStep); |
494 | 494 |
495 static void DrawPictureTestStep(SkCanvas* canvas, | 495 static void DrawPictureTestStep(SkCanvas* canvas, |
496 skiatest::Reporter*, | 496 skiatest::Reporter*, |
497 CanvasTestStep*) { | 497 CanvasTestStep*) { |
498 SkPictureRecorder recorder; | 498 SkPictureRecorder recorder; |
499 SkCanvas* testCanvas = recorder.beginRecording(kWidth, kHeight); | 499 SkCanvas* testCanvas = recorder.beginRecording(kWidth, kHeight, NULL, 0); |
500 testCanvas->scale(SkIntToScalar(2), SkIntToScalar(1)); | 500 testCanvas->scale(SkIntToScalar(2), SkIntToScalar(1)); |
501 testCanvas->clipRect(kTestRect); | 501 testCanvas->clipRect(kTestRect); |
502 testCanvas->drawRect(kTestRect, kTestPaint); | 502 testCanvas->drawRect(kTestRect, kTestPaint); |
503 SkAutoTUnref<SkPicture> testPicture(recorder.endRecording()); | 503 SkAutoTUnref<SkPicture> testPicture(recorder.endRecording()); |
504 | 504 |
505 canvas->drawPicture(*testPicture); | 505 canvas->drawPicture(*testPicture); |
506 } | 506 } |
507 TEST_STEP(DrawPicture, DrawPictureTestStep); | 507 TEST_STEP(DrawPicture, DrawPictureTestStep); |
508 | 508 |
509 static void SaveRestoreTestStep(SkCanvas* canvas, | 509 static void SaveRestoreTestStep(SkCanvas* canvas, |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 | 717 |
718 public: | 718 public: |
719 | 719 |
720 static void TestPictureFlattenedObjectReuse(skiatest::Reporter* reporter, | 720 static void TestPictureFlattenedObjectReuse(skiatest::Reporter* reporter, |
721 CanvasTestStep* testStep, | 721 CanvasTestStep* testStep, |
722 uint32_t recordFlags) { | 722 uint32_t recordFlags) { |
723 // Verify that when a test step is executed twice, no extra resources | 723 // Verify that when a test step is executed twice, no extra resources |
724 // are flattened during the second execution | 724 // are flattened during the second execution |
725 testStep->setAssertMessageFormat(kPictureDrawAssertMessageFormat); | 725 testStep->setAssertMessageFormat(kPictureDrawAssertMessageFormat); |
726 SkPictureRecorder referenceRecorder; | 726 SkPictureRecorder referenceRecorder; |
727 SkCanvas* referenceCanvas = referenceRecorder.beginRecording(kWidth, | 727 SkCanvas* referenceCanvas = referenceRecorder.beginRecording(kWidth, kHe
ight, |
728 kHeight, re
cordFlags); | 728 NULL, recor
dFlags); |
729 testStep->draw(referenceCanvas, reporter); | 729 testStep->draw(referenceCanvas, reporter); |
730 | 730 |
731 SkPictureRecorder testRecorder; | 731 SkPictureRecorder testRecorder; |
732 SkCanvas* testCanvas = testRecorder.beginRecording(kWidth, | 732 SkCanvas* testCanvas = testRecorder.beginRecording(kWidth, kHeight, |
733 kHeight, recordFlags)
; | 733 NULL, recordFlags); |
734 testStep->draw(testCanvas, reporter); | 734 testStep->draw(testCanvas, reporter); |
735 testStep->setAssertMessageFormat(kPictureSecondDrawAssertMessageFormat); | 735 testStep->setAssertMessageFormat(kPictureSecondDrawAssertMessageFormat); |
736 testStep->draw(testCanvas, reporter); | 736 testStep->draw(testCanvas, reporter); |
737 | 737 |
738 SkPictureRecord* referenceRecord = static_cast<SkPictureRecord*>(referen
ceCanvas); | 738 SkPictureRecord* referenceRecord = static_cast<SkPictureRecord*>(referen
ceCanvas); |
739 SkPictureRecord* testRecord = static_cast<SkPictureRecord*>(testCanvas); | 739 SkPictureRecord* testRecord = static_cast<SkPictureRecord*>(testCanvas); |
740 testStep->setAssertMessageFormat(kPictureResourceReuseMessageFormat); | 740 testStep->setAssertMessageFormat(kPictureResourceReuseMessageFormat); |
741 AssertFlattenedObjectsEqual(referenceRecord, testRecord, | 741 AssertFlattenedObjectsEqual(referenceRecord, testRecord, |
742 reporter, testStep); | 742 reporter, testStep); |
743 } | 743 } |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
951 if (testStepArray()[testStep]->enablePdfTesting()) { | 951 if (testStepArray()[testStep]->enablePdfTesting()) { |
952 TestPdfDevice(reporter, testStepArray()[testStep]); | 952 TestPdfDevice(reporter, testStepArray()[testStep]); |
953 } | 953 } |
954 } | 954 } |
955 | 955 |
956 // Explicitly call reset(), so we don't leak the pixels (since kTestBitmap i
s a global) | 956 // Explicitly call reset(), so we don't leak the pixels (since kTestBitmap i
s a global) |
957 kTestBitmap.reset(); | 957 kTestBitmap.reset(); |
958 | 958 |
959 test_newraster(reporter); | 959 test_newraster(reporter); |
960 } | 960 } |
OLD | NEW |