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

Side by Side Diff: tests/CanvasTest.cpp

Issue 513983002: Try out scalar picture sizes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update to ToT again Created 6 years, 3 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
« no previous file with comments | « src/utils/debugger/SkDrawCommand.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | 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 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 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, pts, pts, 456 canvas->drawVertices(SkCanvas::kTriangleFan_VertexMode, 4, pts, pts,
457 NULL, NULL, NULL, 0, paint); 457 NULL, NULL, NULL, 0, paint);
458 } 458 }
459 // NYI: issue 240. 459 // NYI: issue 240.
460 TEST_STEP_NO_PDF(DrawVerticesShader, DrawVerticesShaderTestStep); 460 TEST_STEP_NO_PDF(DrawVerticesShader, DrawVerticesShaderTestStep);
461 461
462 static void DrawPictureTestStep(SkCanvas* canvas, 462 static void DrawPictureTestStep(SkCanvas* canvas,
463 skiatest::Reporter*, 463 skiatest::Reporter*,
464 CanvasTestStep*) { 464 CanvasTestStep*) {
465 SkPictureRecorder recorder; 465 SkPictureRecorder recorder;
466 SkCanvas* testCanvas = recorder.beginRecording(kWidth, kHeight, NULL, 0); 466 SkCanvas* testCanvas = recorder.beginRecording(SkIntToScalar(kWidth), SkIntT oScalar(kHeight),
467 NULL, 0);
467 testCanvas->scale(SkIntToScalar(2), SkIntToScalar(1)); 468 testCanvas->scale(SkIntToScalar(2), SkIntToScalar(1));
468 testCanvas->clipRect(kTestRect); 469 testCanvas->clipRect(kTestRect);
469 testCanvas->drawRect(kTestRect, kTestPaint); 470 testCanvas->drawRect(kTestRect, kTestPaint);
470 SkAutoTUnref<SkPicture> testPicture(recorder.endRecording()); 471 SkAutoTUnref<SkPicture> testPicture(recorder.endRecording());
471 472
472 canvas->drawPicture(testPicture); 473 canvas->drawPicture(testPicture);
473 } 474 }
474 TEST_STEP(DrawPicture, DrawPictureTestStep); 475 TEST_STEP(DrawPicture, DrawPictureTestStep);
475 476
476 static void SaveRestoreTestStep(SkCanvas* canvas, 477 static void SaveRestoreTestStep(SkCanvas* canvas,
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 public: 682 public:
682 683
683 static void TestPictureFlattenedObjectReuse(skiatest::Reporter* reporter, 684 static void TestPictureFlattenedObjectReuse(skiatest::Reporter* reporter,
684 CanvasTestStep* testStep, 685 CanvasTestStep* testStep,
685 uint32_t recordFlags) { 686 uint32_t recordFlags) {
686 // Verify that when a test step is executed twice, no extra resources 687 // Verify that when a test step is executed twice, no extra resources
687 // are flattened during the second execution 688 // are flattened during the second execution
688 testStep->setAssertMessageFormat(kPictureDrawAssertMessageFormat); 689 testStep->setAssertMessageFormat(kPictureDrawAssertMessageFormat);
689 SkPictureRecorder referenceRecorder; 690 SkPictureRecorder referenceRecorder;
690 SkCanvas* referenceCanvas = 691 SkCanvas* referenceCanvas =
691 referenceRecorder.DEPRECATED_beginRecording(kWidth, kHeight, NULL, r ecordFlags); 692 referenceRecorder.DEPRECATED_beginRecording(SkIntToScalar(kWidth),
693 SkIntToScalar(kHeight),
694 NULL, recordFlags);
692 testStep->draw(referenceCanvas, reporter); 695 testStep->draw(referenceCanvas, reporter);
693 696
694 SkPictureRecorder testRecorder; 697 SkPictureRecorder testRecorder;
695 SkCanvas* testCanvas = 698 SkCanvas* testCanvas =
696 testRecorder.DEPRECATED_beginRecording(kWidth, kHeight, NULL, record Flags); 699 testRecorder.DEPRECATED_beginRecording(SkIntToScalar(kWidth),
700 SkIntToScalar(kHeight),
701 NULL, recordFlags);
697 testStep->draw(testCanvas, reporter); 702 testStep->draw(testCanvas, reporter);
698 testStep->setAssertMessageFormat(kPictureSecondDrawAssertMessageFormat); 703 testStep->setAssertMessageFormat(kPictureSecondDrawAssertMessageFormat);
699 testStep->draw(testCanvas, reporter); 704 testStep->draw(testCanvas, reporter);
700 705
701 SkPictureRecord* referenceRecord = static_cast<SkPictureRecord*>(referen ceCanvas); 706 SkPictureRecord* referenceRecord = static_cast<SkPictureRecord*>(referen ceCanvas);
702 SkPictureRecord* testRecord = static_cast<SkPictureRecord*>(testCanvas); 707 SkPictureRecord* testRecord = static_cast<SkPictureRecord*>(testCanvas);
703 testStep->setAssertMessageFormat(kPictureResourceReuseMessageFormat); 708 testStep->setAssertMessageFormat(kPictureResourceReuseMessageFormat);
704 AssertFlattenedObjectsEqual(referenceRecord, testRecord, 709 AssertFlattenedObjectsEqual(referenceRecord, testRecord,
705 reporter, testStep); 710 reporter, testStep);
706 } 711 }
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
910 if (testStepArray()[testStep]->enablePdfTesting()) { 915 if (testStepArray()[testStep]->enablePdfTesting()) {
911 TestPdfDevice(reporter, testStepArray()[testStep]); 916 TestPdfDevice(reporter, testStepArray()[testStep]);
912 } 917 }
913 } 918 }
914 919
915 // Explicitly call reset(), so we don't leak the pixels (since kTestBitmap i s a global) 920 // Explicitly call reset(), so we don't leak the pixels (since kTestBitmap i s a global)
916 kTestBitmap.reset(); 921 kTestBitmap.reset();
917 922
918 test_newraster(reporter); 923 test_newraster(reporter);
919 } 924 }
OLDNEW
« no previous file with comments | « src/utils/debugger/SkDrawCommand.cpp ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698