OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "Resources.h" | 8 #include "Resources.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkFixed.h" | 10 #include "SkFixed.h" |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 SkAutoTUnref<SkColorFilter> copy( | 289 SkAutoTUnref<SkColorFilter> copy( |
290 TestFlattenableSerialization<SkColorFilter>(colorFilter.get(), true, rep
orter)); | 290 TestFlattenableSerialization<SkColorFilter>(colorFilter.get(), true, rep
orter)); |
291 } | 291 } |
292 | 292 |
293 static SkBitmap draw_picture(SkPicture& picture) { | 293 static SkBitmap draw_picture(SkPicture& picture) { |
294 SkBitmap bitmap; | 294 SkBitmap bitmap; |
295 bitmap.allocN32Pixels(SkScalarCeilToInt(picture.cullRect().width()), | 295 bitmap.allocN32Pixels(SkScalarCeilToInt(picture.cullRect().width()), |
296 SkScalarCeilToInt(picture.cullRect().height())); | 296 SkScalarCeilToInt(picture.cullRect().height())); |
297 SkCanvas canvas(bitmap); | 297 SkCanvas canvas(bitmap); |
298 picture.playback(&canvas); | 298 picture.playback(&canvas); |
299 return bitmap; | 299 return skstd::move(bitmap); |
300 } | 300 } |
301 | 301 |
302 static void compare_bitmaps(skiatest::Reporter* reporter, | 302 static void compare_bitmaps(skiatest::Reporter* reporter, |
303 const SkBitmap& b1, const SkBitmap& b2) { | 303 const SkBitmap& b1, const SkBitmap& b2) { |
304 REPORTER_ASSERT(reporter, b1.width() == b2.width()); | 304 REPORTER_ASSERT(reporter, b1.width() == b2.width()); |
305 REPORTER_ASSERT(reporter, b1.height() == b2.height()); | 305 REPORTER_ASSERT(reporter, b1.height() == b2.height()); |
306 SkAutoLockPixels autoLockPixels1(b1); | 306 SkAutoLockPixels autoLockPixels1(b1); |
307 SkAutoLockPixels autoLockPixels2(b2); | 307 SkAutoLockPixels autoLockPixels2(b2); |
308 | 308 |
309 if ((b1.width() != b2.width()) || | 309 if ((b1.width() != b2.width()) || |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 | 539 |
540 // Deserialize picture | 540 // Deserialize picture |
541 SkValidatingReadBuffer reader(static_cast<void*>(data.get()), size); | 541 SkValidatingReadBuffer reader(static_cast<void*>(data.get()), size); |
542 SkAutoTUnref<SkPicture> readPict( | 542 SkAutoTUnref<SkPicture> readPict( |
543 SkPicture::CreateFromBuffer(reader)); | 543 SkPicture::CreateFromBuffer(reader)); |
544 REPORTER_ASSERT(reporter, readPict.get()); | 544 REPORTER_ASSERT(reporter, readPict.get()); |
545 } | 545 } |
546 | 546 |
547 TestPictureTypefaceSerialization(reporter); | 547 TestPictureTypefaceSerialization(reporter); |
548 } | 548 } |
OLD | NEW |