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

Side by Side Diff: tests/PictureTest.cpp

Issue 2187613002: Deserialize pictures with custom image-deserializer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix build Created 4 years, 4 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 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 "SkBigPicture.h" 8 #include "SkBigPicture.h"
9 #include "SkBBoxHierarchy.h" 9 #include "SkBBoxHierarchy.h"
10 #include "SkBlurImageFilter.h" 10 #include "SkBlurImageFilter.h"
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 REPORTER_ASSERT(reporter, picture1->equals(picture2.get())); 684 REPORTER_ASSERT(reporter, picture1->equals(picture2.get()));
685 685
686 // Now test that a parse error was generated when trying to create a new SkP icture without 686 // Now test that a parse error was generated when trying to create a new SkP icture without
687 // providing a function to decode the bitmap. 687 // providing a function to decode the bitmap.
688 ErrorContext context; 688 ErrorContext context;
689 context.fErrors = 0; 689 context.fErrors = 0;
690 context.fReporter = reporter; 690 context.fReporter = reporter;
691 SkSetErrorCallback(assert_one_parse_error_cb, &context); 691 SkSetErrorCallback(assert_one_parse_error_cb, &context);
692 SkMemoryStream pictureStream(std::move(picture1)); 692 SkMemoryStream pictureStream(std::move(picture1));
693 SkClearLastError(); 693 SkClearLastError();
694 sk_sp<SkPicture> pictureFromStream(SkPicture::MakeFromStream(&pictureStream, nullptr)); 694 sk_sp<SkPicture> pictureFromStream(SkPicture::MakeFromStream(&pictureStream) );
695 REPORTER_ASSERT(reporter, pictureFromStream.get() != nullptr); 695 REPORTER_ASSERT(reporter, pictureFromStream.get() != nullptr);
696 SkClearLastError(); 696 SkClearLastError();
697 SkSetErrorCallback(nullptr, nullptr); 697 SkSetErrorCallback(nullptr, nullptr);
698 698
699 // Test that using the version of CreateFromStream that just takes a stream also decodes the 699 // Test that using the version of CreateFromStream that just takes a stream also decodes the
700 // bitmap. Drawing this picture should look exactly like the original bitmap . 700 // bitmap. Drawing this picture should look exactly like the original bitmap .
701 SkMD5::Digest referenceDigest; 701 SkMD5::Digest referenceDigest;
702 md5(original, &referenceDigest); 702 md5(original, &referenceDigest);
703 703
704 SkBitmap dst; 704 SkBitmap dst;
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
1305 SkPictureRecorder rec; 1305 SkPictureRecorder rec;
1306 proc(rec.beginRecording(cull)); 1306 proc(rec.beginRecording(cull));
1307 sk_sp<SkDrawable> dr = rec.finishRecordingAsDrawable( 1307 sk_sp<SkDrawable> dr = rec.finishRecordingAsDrawable(
1308 SkPictureRecorder::kReturnNullF orEmpty_FinishFlag); 1308 SkPictureRecorder::kReturnNullF orEmpty_FinishFlag);
1309 REPORTER_ASSERT(r, !dr.get()); 1309 REPORTER_ASSERT(r, !dr.get());
1310 } 1310 }
1311 } 1311 }
1312 } 1312 }
1313 #endif 1313 #endif
1314 1314
OLDNEW
« src/core/SkReadBuffer.cpp ('K') | « src/utils/SkBitmapSourceDeserializer.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698