OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 The Android Open Source Project | 2 * Copyright 2010 The Android Open Source Project |
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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkData.h" | 10 #include "SkData.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 static void SimpleCheckObjectOutput(skiatest::Reporter* reporter, | 113 static void SimpleCheckObjectOutput(skiatest::Reporter* reporter, |
114 SkPDFObject* obj, | 114 SkPDFObject* obj, |
115 const char* expectedResult) { | 115 const char* expectedResult) { |
116 CheckObjectOutput(reporter, obj, expectedResult, | 116 CheckObjectOutput(reporter, obj, expectedResult, |
117 strlen(expectedResult), true, false); | 117 strlen(expectedResult), true, false); |
118 } | 118 } |
119 | 119 |
120 static void TestPDFStream(skiatest::Reporter* reporter) { | 120 static void TestPDFStream(skiatest::Reporter* reporter) { |
121 char streamBytes[] = "Test\nFoo\tBar"; | 121 char streamBytes[] = "Test\nFoo\tBar"; |
122 SkAutoTUnref<SkMemoryStream> streamData(new SkMemoryStream( | 122 SkAutoTDelete<SkMemoryStream> streamData(new SkMemoryStream( |
123 streamBytes, strlen(streamBytes), true)); | 123 streamBytes, strlen(streamBytes), true)); |
124 SkAutoTUnref<SkPDFStream> stream(new SkPDFStream(streamData.get())); | 124 SkAutoTUnref<SkPDFStream> stream(new SkPDFStream(streamData.get())); |
125 SimpleCheckObjectOutput( | 125 SimpleCheckObjectOutput( |
126 reporter, stream.get(), | 126 reporter, stream.get(), |
127 "<</Length 12\n>> stream\nTest\nFoo\tBar\nendstream"); | 127 "<</Length 12\n>> stream\nTest\nFoo\tBar\nendstream"); |
128 stream->insert("Attribute", new SkPDFInt(42))->unref(); | 128 stream->insert("Attribute", new SkPDFInt(42))->unref(); |
129 SimpleCheckObjectOutput(reporter, stream.get(), | 129 SimpleCheckObjectOutput(reporter, stream.get(), |
130 "<</Length 12\n/Attribute 42\n>> stream\n" | 130 "<</Length 12\n/Attribute 42\n>> stream\n" |
131 "Test\nFoo\tBar\nendstream"); | 131 "Test\nFoo\tBar\nendstream"); |
132 | 132 |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 | 482 |
483 // Filter just created; should be unvisited. | 483 // Filter just created; should be unvisited. |
484 REPORTER_ASSERT(reporter, !filter->visited()); | 484 REPORTER_ASSERT(reporter, !filter->visited()); |
485 SkPaint paint; | 485 SkPaint paint; |
486 paint.setImageFilter(filter.get()); | 486 paint.setImageFilter(filter.get()); |
487 canvas.drawRect(SkRect::MakeWH(100, 100), paint); | 487 canvas.drawRect(SkRect::MakeWH(100, 100), paint); |
488 | 488 |
489 // Filter was used in rendering; should be visited. | 489 // Filter was used in rendering; should be visited. |
490 REPORTER_ASSERT(reporter, filter->visited()); | 490 REPORTER_ASSERT(reporter, filter->visited()); |
491 } | 491 } |
OLD | NEW |