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

Side by Side Diff: tests/PictureTest.cpp

Issue 1507123002: default SkPixelSerializer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-12-10 (Thursday) 13:15:57 EST 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 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
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 }
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