| 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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 static void DrawPictureTestStep(SkCanvas* canvas, | 496 static void DrawPictureTestStep(SkCanvas* canvas, |
| 497 skiatest::Reporter*, | 497 skiatest::Reporter*, |
| 498 CanvasTestStep*) { | 498 CanvasTestStep*) { |
| 499 SkPictureRecorder recorder; | 499 SkPictureRecorder recorder; |
| 500 SkCanvas* testCanvas = recorder.beginRecording(kWidth, kHeight, NULL, 0); | 500 SkCanvas* testCanvas = recorder.beginRecording(kWidth, kHeight, NULL, 0); |
| 501 testCanvas->scale(SkIntToScalar(2), SkIntToScalar(1)); | 501 testCanvas->scale(SkIntToScalar(2), SkIntToScalar(1)); |
| 502 testCanvas->clipRect(kTestRect); | 502 testCanvas->clipRect(kTestRect); |
| 503 testCanvas->drawRect(kTestRect, kTestPaint); | 503 testCanvas->drawRect(kTestRect, kTestPaint); |
| 504 SkAutoTUnref<SkPicture> testPicture(recorder.endRecording()); | 504 SkAutoTUnref<SkPicture> testPicture(recorder.endRecording()); |
| 505 | 505 |
| 506 canvas->drawPicture(*testPicture); | 506 canvas->drawPicture(testPicture); |
| 507 } | 507 } |
| 508 TEST_STEP(DrawPicture, DrawPictureTestStep); | 508 TEST_STEP(DrawPicture, DrawPictureTestStep); |
| 509 | 509 |
| 510 static void SaveRestoreTestStep(SkCanvas* canvas, | 510 static void SaveRestoreTestStep(SkCanvas* canvas, |
| 511 skiatest::Reporter* reporter, | 511 skiatest::Reporter* reporter, |
| 512 CanvasTestStep* testStep) { | 512 CanvasTestStep* testStep) { |
| 513 int baseSaveCount = canvas->getSaveCount(); | 513 int baseSaveCount = canvas->getSaveCount(); |
| 514 int n = canvas->save(); | 514 int n = canvas->save(); |
| 515 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount == n, testStep->assertMessag
e()); | 515 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount == n, testStep->assertMessag
e()); |
| 516 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount + 1 == canvas->getSaveCount(
), | 516 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount + 1 == canvas->getSaveCount(
), |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 if (testStepArray()[testStep]->enablePdfTesting()) { | 949 if (testStepArray()[testStep]->enablePdfTesting()) { |
| 950 TestPdfDevice(reporter, testStepArray()[testStep]); | 950 TestPdfDevice(reporter, testStepArray()[testStep]); |
| 951 } | 951 } |
| 952 } | 952 } |
| 953 | 953 |
| 954 // Explicitly call reset(), so we don't leak the pixels (since kTestBitmap i
s a global) | 954 // Explicitly call reset(), so we don't leak the pixels (since kTestBitmap i
s a global) |
| 955 kTestBitmap.reset(); | 955 kTestBitmap.reset(); |
| 956 | 956 |
| 957 test_newraster(reporter); | 957 test_newraster(reporter); |
| 958 } | 958 } |
| OLD | NEW |