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

Side by Side Diff: tests/RecordDrawTest.cpp

Issue 1817383002: switch surface to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/ReadPixelsTest.cpp ('k') | tests/RecorderTest.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 "Test.h" 8 #include "Test.h"
9 #include "RecordTestUtils.h" 9 #include "RecordTestUtils.h"
10 10
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 272 }
273 273
274 void resetTestValues() { 274 void resetTestValues() {
275 fDrawImageCalled = fDrawImageRectCalled = false; 275 fDrawImageCalled = fDrawImageRectCalled = false;
276 } 276 }
277 277
278 bool fDrawImageCalled; 278 bool fDrawImageCalled;
279 bool fDrawImageRectCalled; 279 bool fDrawImageRectCalled;
280 }; 280 };
281 281
282 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10)); 282 auto surface(SkSurface::MakeRasterN32Premul(10, 10));
283 surface->getCanvas()->clear(SK_ColorGREEN); 283 surface->getCanvas()->clear(SK_ColorGREEN);
284 sk_sp<SkImage> image(surface->makeImageSnapshot()); 284 sk_sp<SkImage> image(surface->makeImageSnapshot());
285 285
286 SkCanvasMock canvas(10, 10); 286 SkCanvasMock canvas(10, 10);
287 287
288 { 288 {
289 SkRecord record; 289 SkRecord record;
290 SkRecorder recorder(&record, 10, 10); 290 SkRecorder recorder(&record, 10, 10);
291 recorder.drawImage(image, 0, 0); 291 recorder.drawImage(image, 0, 0);
292 SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr, 0); 292 SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr, 0);
293 } 293 }
294 REPORTER_ASSERT(r, canvas.fDrawImageCalled); 294 REPORTER_ASSERT(r, canvas.fDrawImageCalled);
295 canvas.resetTestValues(); 295 canvas.resetTestValues();
296 296
297 { 297 {
298 SkRecord record; 298 SkRecord record;
299 SkRecorder recorder(&record, 10, 10); 299 SkRecorder recorder(&record, 10, 10);
300 recorder.drawImageRect(image, SkRect::MakeWH(10, 10), nullptr); 300 recorder.drawImageRect(image, SkRect::MakeWH(10, 10), nullptr);
301 SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr, 0); 301 SkRecordDraw(record, &canvas, nullptr, nullptr, 0, nullptr, 0);
302 } 302 }
303 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); 303 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled);
304 304
305 } 305 }
OLDNEW
« no previous file with comments | « tests/ReadPixelsTest.cpp ('k') | tests/RecorderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698