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

Side by Side Diff: tests/CanvasTest.cpp

Issue 313613004: Alter SkCanvas::drawPicture (devirtualize, take const SkPicture, take pointer) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add staging entry point for Chromium and Android Created 6 years, 6 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
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 485 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698