| OLD | NEW |
| 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10)); |
| 283 surface->getCanvas()->clear(SK_ColorGREEN); | 283 surface->getCanvas()->clear(SK_ColorGREEN); |
| 284 SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); | 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 } |
| OLD | NEW |