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

Side by Side Diff: tests/PictureBBHTest.cpp

Issue 1811703002: return pictures as sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rely on RVO in picturerecorder Created 4 years, 9 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 | « tests/PathOpsSkpClipTest.cpp ('k') | tests/PictureShaderTest.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 2014 Google Inc. 2 * Copyright 2014 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 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkBBoxHierarchy.h" 9 #include "SkBBoxHierarchy.h"
10 #include "SkPaint.h" 10 #include "SkPaint.h"
(...skipping 27 matching lines...) Expand all
38 38
39 private: 39 private:
40 void run(SkBBHFactory* factory, skiatest::Reporter* reporter) { 40 void run(SkBBHFactory* factory, skiatest::Reporter* reporter) {
41 SkCanvas playbackCanvas(fResultBitmap); 41 SkCanvas playbackCanvas(fResultBitmap);
42 playbackCanvas.clear(SK_ColorGREEN); 42 playbackCanvas.clear(SK_ColorGREEN);
43 SkPictureRecorder recorder; 43 SkPictureRecorder recorder;
44 SkCanvas* recordCanvas = recorder.beginRecording(SkIntToScalar(fPictureW idth), 44 SkCanvas* recordCanvas = recorder.beginRecording(SkIntToScalar(fPictureW idth),
45 SkIntToScalar(fPictureH eight), 45 SkIntToScalar(fPictureH eight),
46 factory); 46 factory);
47 this->doTest(playbackCanvas, *recordCanvas); 47 this->doTest(playbackCanvas, *recordCanvas);
48 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); 48 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
49 playbackCanvas.drawPicture(picture); 49 playbackCanvas.drawPicture(picture);
50 REPORTER_ASSERT(reporter, SK_ColorGREEN == fResultBitmap.getColor(0, 0)) ; 50 REPORTER_ASSERT(reporter, SK_ColorGREEN == fResultBitmap.getColor(0, 0)) ;
51 } 51 }
52 52
53 SkBitmap fResultBitmap; 53 SkBitmap fResultBitmap;
54 int fPictureWidth, fPictureHeight; 54 int fPictureWidth, fPictureHeight;
55 }; 55 };
56 56
57 // Test to verify the playback of an empty picture 57 // Test to verify the playback of an empty picture
58 // 58 //
(...skipping 27 matching lines...) Expand all
86 }; 86 };
87 87
88 DEF_TEST(PictureBBH, reporter) { 88 DEF_TEST(PictureBBH, reporter) {
89 89
90 DrawEmptyPictureBBHTest emptyPictureTest; 90 DrawEmptyPictureBBHTest emptyPictureTest;
91 emptyPictureTest.run(reporter); 91 emptyPictureTest.run(reporter);
92 92
93 EmptyClipPictureBBHTest emptyClipPictureTest; 93 EmptyClipPictureBBHTest emptyClipPictureTest;
94 emptyClipPictureTest.run(reporter); 94 emptyClipPictureTest.run(reporter);
95 } 95 }
OLDNEW
« no previous file with comments | « tests/PathOpsSkpClipTest.cpp ('k') | tests/PictureShaderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698