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

Side by Side Diff: tests/PictureTest.cpp

Issue 1511183002: Revert of default SkPixelSerializer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years 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
« no previous file with comments | « src/ports/SkImageDecoder_empty.cpp ('k') | tools/sk_tool_utils.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "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
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 SkAutoTUnref<SkPixelSerializer> serializer( 854 sk_tool_utils::PngPixelSerializer serializer;
855 SkImageEncoder::CreatePixelSerializer()); 855 picture->serialize(&wStream, &serializer);
856 picture->serialize(&wStream, serializer);
857 return wStream.copyToData(); 856 return wStream.copyToData();
858 } 857 }
859 858
860 struct ErrorContext { 859 struct ErrorContext {
861 int fErrors; 860 int fErrors;
862 skiatest::Reporter* fReporter; 861 skiatest::Reporter* fReporter;
863 }; 862 };
864 863
865 static void assert_one_parse_error_cb(SkError error, void* context) { 864 static void assert_one_parse_error_cb(SkError error, void* context) {
866 ErrorContext* errorContext = static_cast<ErrorContext*>(context); 865 ErrorContext* errorContext = static_cast<ErrorContext*>(context);
(...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after
1380 1379
1381 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream()); 1380 SkAutoTDelete<SkStream> rstream(wstream.detachAsStream());
1382 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr eam)); 1381 SkAutoTUnref<SkPicture> deserializedPicture(SkPicture::CreateFromStream(rstr eam));
1383 1382
1384 REPORTER_ASSERT(r, SkToBool(deserializedPicture)); 1383 REPORTER_ASSERT(r, SkToBool(deserializedPicture));
1385 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1); 1384 REPORTER_ASSERT(r, deserializedPicture->cullRect().left() == 1);
1386 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2); 1385 REPORTER_ASSERT(r, deserializedPicture->cullRect().top() == 2);
1387 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3); 1386 REPORTER_ASSERT(r, deserializedPicture->cullRect().right() == 3);
1388 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4); 1387 REPORTER_ASSERT(r, deserializedPicture->cullRect().bottom() == 4);
1389 } 1388 }
OLDNEW
« no previous file with comments | « src/ports/SkImageDecoder_empty.cpp ('k') | tools/sk_tool_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698