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

Side by Side Diff: tests/SerializationTest.cpp

Issue 1853383002: Revert of Delete SkFlattenable::Type (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « tests/ImageFilterTest.cpp ('k') | tools/chrome_fuzz.cpp » ('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 2013 Google Inc. 2 * Copyright 2013 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 "SkAnnotationKeys.h" 8 #include "SkAnnotationKeys.h"
9 #include "Resources.h" 9 #include "Resources.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 24 matching lines...) Expand all
35 size_t bytesReadFromMemory = testObj->readFromMemory(dataWritten, bytesWritt enToMemory); 35 size_t bytesReadFromMemory = testObj->readFromMemory(dataWritten, bytesWritt enToMemory);
36 REPORTER_ASSERT(reporter, SkAlign4(bytesReadFromMemory) == bytesReadFromMemo ry); 36 REPORTER_ASSERT(reporter, SkAlign4(bytesReadFromMemory) == bytesReadFromMemo ry);
37 } 37 }
38 38
39 template<typename T> struct SerializationUtils { 39 template<typename T> struct SerializationUtils {
40 // Generic case for flattenables 40 // Generic case for flattenables
41 static void Write(SkWriteBuffer& writer, const T* flattenable) { 41 static void Write(SkWriteBuffer& writer, const T* flattenable) {
42 writer.writeFlattenable(flattenable); 42 writer.writeFlattenable(flattenable);
43 } 43 }
44 static void Read(SkValidatingReadBuffer& reader, T** flattenable) { 44 static void Read(SkValidatingReadBuffer& reader, T** flattenable) {
45 *flattenable = (T*)reader.readFlattenable(); 45 *flattenable = (T*)reader.readFlattenable(T::GetFlattenableType());
46 } 46 }
47 }; 47 };
48 48
49 template<> struct SerializationUtils<SkMatrix> { 49 template<> struct SerializationUtils<SkMatrix> {
50 static void Write(SkWriteBuffer& writer, const SkMatrix* matrix) { 50 static void Write(SkWriteBuffer& writer, const SkMatrix* matrix) {
51 writer.writeMatrix(*matrix); 51 writer.writeMatrix(*matrix);
52 } 52 }
53 static void Read(SkValidatingReadBuffer& reader, SkMatrix* matrix) { 53 static void Read(SkValidatingReadBuffer& reader, SkMatrix* matrix) {
54 reader.readMatrix(matrix); 54 reader.readMatrix(matrix);
55 } 55 }
(...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), d1 }, 620 { r1, SkAnnotationKeys::Define_Named_Dest_Key(), d1 },
621 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), d2 }, 621 { r2, SkAnnotationKeys::Link_Named_Dest_Key(), d2 },
622 }; 622 };
623 623
624 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture()); 624 sk_sp<SkPicture> pict0(recorder.finishRecordingAsPicture());
625 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get())); 625 sk_sp<SkPicture> pict1(copy_picture_via_serialization(pict0.get()));
626 626
627 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs)); 627 TestAnnotationCanvas canvas(reporter, recs, SK_ARRAY_COUNT(recs));
628 canvas.drawPicture(pict1); 628 canvas.drawPicture(pict1);
629 } 629 }
OLDNEW
« no previous file with comments | « tests/ImageFilterTest.cpp ('k') | tools/chrome_fuzz.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698