| 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 "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
| 9 #include "SkBlurImageFilter.h" | 9 #include "SkBlurImageFilter.h" |
| 10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 if (immutable) { | 43 if (immutable) { |
| 44 bm->setImmutable(); | 44 bm->setImmutable(); |
| 45 } | 45 } |
| 46 } | 46 } |
| 47 | 47 |
| 48 // For a while willPlayBackBitmaps() ignored SkImages and just looked for SkBitm
aps. | 48 // For a while willPlayBackBitmaps() ignored SkImages and just looked for SkBitm
aps. |
| 49 static void test_images_are_found_by_willPlayBackBitmaps(skiatest::Reporter* rep
orter) { | 49 static void test_images_are_found_by_willPlayBackBitmaps(skiatest::Reporter* rep
orter) { |
| 50 // We just need _some_ SkImage | 50 // We just need _some_ SkImage |
| 51 const SkPMColor pixel = 0; | 51 const SkPMColor pixel = 0; |
| 52 const SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1); | 52 const SkImageInfo info = SkImageInfo::MakeN32Premul(1, 1); |
| 53 SkAutoTUnref<SkImage> image(SkImage::NewRasterCopy(info, &pixel, sizeof(pixe
l))); | 53 sk_sp<SkImage> image(SkImage::MakeRasterCopy(SkPixmap(info, &pixel, sizeof(p
ixel)))); |
| 54 | 54 |
| 55 SkPictureRecorder recorder; | 55 SkPictureRecorder recorder; |
| 56 recorder.beginRecording(100,100)->drawImage(image, 0,0); | 56 recorder.beginRecording(100,100)->drawImage(image, 0,0); |
| 57 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 57 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
| 58 | 58 |
| 59 REPORTER_ASSERT(reporter, picture->willPlayBackBitmaps()); | 59 REPORTER_ASSERT(reporter, picture->willPlayBackBitmaps()); |
| 60 } | 60 } |
| 61 | 61 |
| 62 /* Hit a few SkPicture::Analysis cases not handled elsewhere. */ | 62 /* Hit a few SkPicture::Analysis cases not handled elsewhere. */ |
| 63 static void test_analysis(skiatest::Reporter* reporter) { | 63 static void test_analysis(skiatest::Reporter* reporter) { |
| (...skipping 1343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1407 | 1407 |
| 1408 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); | 1408 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); |
| 1409 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr
eam)); | 1409 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr
eam)); |
| 1410 | 1410 |
| 1411 REPORTER_ASSERT(r, deserializedPicture != nullptr); | 1411 REPORTER_ASSERT(r, deserializedPicture != nullptr); |
| 1412 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1); | 1412 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1); |
| 1413 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2); | 1413 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2); |
| 1414 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3); | 1414 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3); |
| 1415 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4); | 1415 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4); |
| 1416 } | 1416 } |
| OLD | NEW |