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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 TEST_STEP_NO_PDF(DrawVerticesShader, DrawVerticesShaderTestStep); | 424 TEST_STEP_NO_PDF(DrawVerticesShader, DrawVerticesShaderTestStep); |
425 | 425 |
426 static void DrawPictureTestStep(SkCanvas* canvas, const TestData& d, | 426 static void DrawPictureTestStep(SkCanvas* canvas, const TestData& d, |
427 skiatest::Reporter*, CanvasTestStep*) { | 427 skiatest::Reporter*, CanvasTestStep*) { |
428 SkPictureRecorder recorder; | 428 SkPictureRecorder recorder; |
429 SkCanvas* testCanvas = recorder.beginRecording(SkIntToScalar(d.fWidth), SkIn
tToScalar(d.fHeight), | 429 SkCanvas* testCanvas = recorder.beginRecording(SkIntToScalar(d.fWidth), SkIn
tToScalar(d.fHeight), |
430 nullptr, 0); | 430 nullptr, 0); |
431 testCanvas->scale(SkIntToScalar(2), SkIntToScalar(1)); | 431 testCanvas->scale(SkIntToScalar(2), SkIntToScalar(1)); |
432 testCanvas->clipRect(d.fRect); | 432 testCanvas->clipRect(d.fRect); |
433 testCanvas->drawRect(d.fRect, d.fPaint); | 433 testCanvas->drawRect(d.fRect, d.fPaint); |
434 SkAutoTUnref<SkPicture> testPicture(recorder.endRecording()); | |
435 | 434 |
436 canvas->drawPicture(testPicture); | 435 canvas->drawPicture(recorder.finishRecordingAsPicture()); |
437 } | 436 } |
438 TEST_STEP(DrawPicture, DrawPictureTestStep); | 437 TEST_STEP(DrawPicture, DrawPictureTestStep); |
439 | 438 |
440 static void SaveRestoreTestStep(SkCanvas* canvas, const TestData& d, | 439 static void SaveRestoreTestStep(SkCanvas* canvas, const TestData& d, |
441 skiatest::Reporter* reporter, CanvasTestStep* te
stStep) { | 440 skiatest::Reporter* reporter, CanvasTestStep* te
stStep) { |
442 int baseSaveCount = canvas->getSaveCount(); | 441 int baseSaveCount = canvas->getSaveCount(); |
443 int n = canvas->save(); | 442 int n = canvas->save(); |
444 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount == n, testStep->assertMessag
e()); | 443 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount == n, testStep->assertMessag
e()); |
445 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount + 1 == canvas->getSaveCount(
), | 444 REPORTER_ASSERT_MESSAGE(reporter, baseSaveCount + 1 == canvas->getSaveCount(
), |
446 testStep->assertMessage()); | 445 testStep->assertMessage()); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
751 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); | 750 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); |
752 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); | 751 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); |
753 REPORTER_ASSERT(reporter, clip1 == clip2); | 752 REPORTER_ASSERT(reporter, clip1 == clip2); |
754 | 753 |
755 filterCanvas.clipRect(SkRect::MakeXYWH(30.5f, 30.7f, 100, 100)); | 754 filterCanvas.clipRect(SkRect::MakeXYWH(30.5f, 30.7f, 100, 100)); |
756 filterCanvas.scale(0.75f, 0.5f); | 755 filterCanvas.scale(0.75f, 0.5f); |
757 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); | 756 REPORTER_ASSERT(reporter, canvas.getTotalMatrix() == filterCanvas.getTotalMa
trix()); |
758 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); | 757 REPORTER_ASSERT(reporter, canvas.getClipBounds(&clip1) == filterCanvas.getCl
ipBounds(&clip2)); |
759 REPORTER_ASSERT(reporter, clip1 == clip2); | 758 REPORTER_ASSERT(reporter, clip1 == clip2); |
760 } | 759 } |
OLD | NEW |