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 833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
844 #endif | 844 #endif |
845 | 845 |
846 static SkData* serialized_picture_from_bitmap(const SkBitmap& bitmap) { | 846 static SkData* serialized_picture_from_bitmap(const SkBitmap& bitmap) { |
847 SkPictureRecorder recorder; | 847 SkPictureRecorder recorder; |
848 SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(bitmap.width()), | 848 SkCanvas* canvas = recorder.beginRecording(SkIntToScalar(bitmap.width()), |
849 SkIntToScalar(bitmap.height())); | 849 SkIntToScalar(bitmap.height())); |
850 canvas->drawBitmap(bitmap, 0, 0); | 850 canvas->drawBitmap(bitmap, 0, 0); |
851 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 851 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
852 | 852 |
853 SkDynamicMemoryWStream wStream; | 853 SkDynamicMemoryWStream wStream; |
854 sk_tool_utils::PngPixelSerializer serializer; | 854 SkAutoTUnref<SkPixelSerializer> serializer( |
855 picture->serialize(&wStream, &serializer); | 855 SkImageEncoder::CreatePixelSerializer()); |
| 856 picture->serialize(&wStream, serializer); |
856 return wStream.copyToData(); | 857 return wStream.copyToData(); |
857 } | 858 } |
858 | 859 |
859 struct ErrorContext { | 860 struct ErrorContext { |
860 int fErrors; | 861 int fErrors; |
861 skiatest::Reporter* fReporter; | 862 skiatest::Reporter* fReporter; |
862 }; | 863 }; |
863 | 864 |
864 static void assert_one_parse_error_cb(SkError error, void* context) { | 865 static void assert_one_parse_error_cb(SkError error, void* context) { |
865 ErrorContext* errorContext = static_cast<ErrorContext*>(context); | 866 ErrorContext* errorContext = static_cast<ErrorContext*>(context); |
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 | 1380 |
1380 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); | 1381 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); |
1381 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr
eam)); | 1382 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr
eam)); |
1382 | 1383 |
1383 REPORTER_ASSERT(r, SkToBool(deserializedPicture)); | 1384 REPORTER_ASSERT(r, SkToBool(deserializedPicture)); |
1384 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1); | 1385 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1); |
1385 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2); | 1386 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2); |
1386 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3); | 1387 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3); |
1387 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4); | 1388 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4); |
1388 } | 1389 } |
OLD | NEW |