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

Side by Side Diff: tests/SerializationTest.cpp

Issue 540963002: Change SkPicture::draw to playback (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
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
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
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 }
OLDNEW
« include/core/SkPicture.h ('K') | « tests/PictureTest.cpp ('k') | tests/TileGridTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698