| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "TestClassDef.h" | 9 #include "TestClassDef.h" |
| 10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 SkPicture picture; | 333 SkPicture picture; |
| 334 SkCanvas* recordingCanvas = picture.beginRecording(100, 100); | 334 SkCanvas* recordingCanvas = picture.beginRecording(100, 100); |
| 335 recordingCanvas->drawBitmap(bm, 0, 0); | 335 recordingCanvas->drawBitmap(bm, 0, 0); |
| 336 picture.endRecording(); | 336 picture.endRecording(); |
| 337 | 337 |
| 338 SkCanvas canvas; | 338 SkCanvas canvas; |
| 339 canvas.drawPicture(picture); | 339 canvas.drawPicture(picture); |
| 340 } | 340 } |
| 341 #endif | 341 #endif |
| 342 | 342 |
| 343 static SkData* encode_bitmap_to_data(size_t* offset, const SkBitmap& bm) { | 343 static SkData* encode_bitmap_to_data(size_t*, const SkBitmap& bm) { |
| 344 *offset = 0; | |
| 345 return SkImageEncoder::EncodeData(bm, SkImageEncoder::kPNG_Type, 100); | 344 return SkImageEncoder::EncodeData(bm, SkImageEncoder::kPNG_Type, 100); |
| 346 } | 345 } |
| 347 | 346 |
| 348 static SkData* serialized_picture_from_bitmap(const SkBitmap& bitmap) { | 347 static SkData* serialized_picture_from_bitmap(const SkBitmap& bitmap) { |
| 349 SkPicture picture; | 348 SkPicture picture; |
| 350 SkCanvas* canvas = picture.beginRecording(bitmap.width(), bitmap.height()); | 349 SkCanvas* canvas = picture.beginRecording(bitmap.width(), bitmap.height()); |
| 351 canvas->drawBitmap(bitmap, 0, 0); | 350 canvas->drawBitmap(bitmap, 0, 0); |
| 352 SkDynamicMemoryWStream wStream; | 351 SkDynamicMemoryWStream wStream; |
| 353 picture.serialize(&wStream, &encode_bitmap_to_data); | 352 picture.serialize(&wStream, &encode_bitmap_to_data); |
| 354 return wStream.copyToData(); | 353 return wStream.copyToData(); |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 test_bad_bitmap(); | 632 test_bad_bitmap(); |
| 634 #endif | 633 #endif |
| 635 test_peephole(); | 634 test_peephole(); |
| 636 test_gatherpixelrefs(reporter); | 635 test_gatherpixelrefs(reporter); |
| 637 test_bitmap_with_encoded_data(reporter); | 636 test_bitmap_with_encoded_data(reporter); |
| 638 test_clone_empty(reporter); | 637 test_clone_empty(reporter); |
| 639 test_clip_bound_opt(reporter); | 638 test_clip_bound_opt(reporter); |
| 640 test_clip_expansion(reporter); | 639 test_clip_expansion(reporter); |
| 641 test_hierarchical(reporter); | 640 test_hierarchical(reporter); |
| 642 } | 641 } |
| OLD | NEW |