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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 } | 279 } |
280 | 280 |
281 void resetTestValues() { | 281 void resetTestValues() { |
282 fDrawImageCalled = fDrawImageRectCalled = false; | 282 fDrawImageCalled = fDrawImageRectCalled = false; |
283 } | 283 } |
284 | 284 |
285 bool fDrawImageCalled; | 285 bool fDrawImageCalled; |
286 bool fDrawImageRectCalled; | 286 bool fDrawImageRectCalled; |
287 }; | 287 }; |
288 | 288 |
289 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterPMColor(10, 10)); | 289 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10)); |
290 surface->getCanvas()->clear(SK_ColorGREEN); | 290 surface->getCanvas()->clear(SK_ColorGREEN); |
291 SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); | 291 SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); |
292 | 292 |
293 SkCanvasMock canvas(10, 10); | 293 SkCanvasMock canvas(10, 10); |
294 | 294 |
295 { | 295 { |
296 SkRecord record; | 296 SkRecord record; |
297 SkRecorder recorder(&record, 10, 10); | 297 SkRecorder recorder(&record, 10, 10); |
298 recorder.drawImage(image, 0, 0); | 298 recorder.drawImage(image, 0, 0); |
299 SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL, 0); | 299 SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL, 0); |
300 } | 300 } |
301 REPORTER_ASSERT(r, canvas.fDrawImageCalled); | 301 REPORTER_ASSERT(r, canvas.fDrawImageCalled); |
302 canvas.resetTestValues(); | 302 canvas.resetTestValues(); |
303 | 303 |
304 { | 304 { |
305 SkRecord record; | 305 SkRecord record; |
306 SkRecorder recorder(&record, 10, 10); | 306 SkRecorder recorder(&record, 10, 10); |
307 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10)); | 307 recorder.drawImageRect(image, 0, SkRect::MakeWH(10, 10)); |
308 SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL, 0); | 308 SkRecordDraw(record, &canvas, NULL, NULL, 0, NULL, 0); |
309 } | 309 } |
310 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); | 310 REPORTER_ASSERT(r, canvas.fDrawImageRectCalled); |
311 | 311 |
312 } | 312 } |
OLD | NEW |