| 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 "SkBitmapSource.h" | 9 #include "SkBitmapSource.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 canvas.clipRect(SkRect::MakeXYWH(0, 0, SkIntToScalar(24), SkIntToScalar(
24))); | 259 canvas.clipRect(SkRect::MakeXYWH(0, 0, SkIntToScalar(24), SkIntToScalar(
24))); |
| 260 canvas.drawBitmap(bitmap, 0, 0, &paint); | 260 canvas.drawBitmap(bitmap, 0, 0, &paint); |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 | 263 |
| 264 static SkBitmap draw_picture(SkPicture& picture) { | 264 static SkBitmap draw_picture(SkPicture& picture) { |
| 265 SkBitmap bitmap; | 265 SkBitmap bitmap; |
| 266 bitmap.allocN32Pixels(SkScalarCeilToInt(picture.cullRect().width()), | 266 bitmap.allocN32Pixels(SkScalarCeilToInt(picture.cullRect().width()), |
| 267 SkScalarCeilToInt(picture.cullRect().height())); | 267 SkScalarCeilToInt(picture.cullRect().height())); |
| 268 SkCanvas canvas(bitmap); | 268 SkCanvas canvas(bitmap); |
| 269 picture.draw(&canvas); | 269 picture.playback(&canvas); |
| 270 return bitmap; | 270 return bitmap; |
| 271 } | 271 } |
| 272 | 272 |
| 273 static void compare_bitmaps(skiatest::Reporter* reporter, | 273 static void compare_bitmaps(skiatest::Reporter* reporter, |
| 274 const SkBitmap& b1, const SkBitmap& b2) { | 274 const SkBitmap& b1, const SkBitmap& b2) { |
| 275 REPORTER_ASSERT(reporter, b1.width() == b2.width()); | 275 REPORTER_ASSERT(reporter, b1.width() == b2.width()); |
| 276 REPORTER_ASSERT(reporter, b1.height() == b2.height()); | 276 REPORTER_ASSERT(reporter, b1.height() == b2.height()); |
| 277 SkAutoLockPixels autoLockPixels1(b1); | 277 SkAutoLockPixels autoLockPixels1(b1); |
| 278 SkAutoLockPixels autoLockPixels2(b2); | 278 SkAutoLockPixels autoLockPixels2(b2); |
| 279 | 279 |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 | 488 |
| 489 // Deserialize picture | 489 // Deserialize picture |
| 490 SkValidatingReadBuffer reader(static_cast<void*>(data.get()), size); | 490 SkValidatingReadBuffer reader(static_cast<void*>(data.get()), size); |
| 491 SkAutoTUnref<SkPicture> readPict( | 491 SkAutoTUnref<SkPicture> readPict( |
| 492 SkPicture::CreateFromBuffer(reader)); | 492 SkPicture::CreateFromBuffer(reader)); |
| 493 REPORTER_ASSERT(reporter, NULL != readPict.get()); | 493 REPORTER_ASSERT(reporter, NULL != readPict.get()); |
| 494 } | 494 } |
| 495 | 495 |
| 496 TestPictureTypefaceSerialization(reporter); | 496 TestPictureTypefaceSerialization(reporter); |
| 497 } | 497 } |
| OLD | NEW |