| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 <stdio.h> | 8 #include <stdio.h> |
| 9 #include <stdlib.h> | 9 #include <stdlib.h> |
| 10 #include "SkForceLinking.h" | 10 #include "SkForceLinking.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 exit(1); | 129 exit(1); |
| 130 } | 130 } |
| 131 srand(0); | 131 srand(0); |
| 132 draw(surface->getCanvas()); | 132 draw(surface->getCanvas()); |
| 133 gpuData.reset(encode_snapshot(surface)); | 133 gpuData.reset(encode_snapshot(surface)); |
| 134 } | 134 } |
| 135 } | 135 } |
| 136 if (options.pdf) { | 136 if (options.pdf) { |
| 137 SkDynamicMemoryWStream pdfStream; | 137 SkDynamicMemoryWStream pdfStream; |
| 138 sk_sp<SkDocument> document(SkDocument::MakePDF(&pdfStream)); | 138 sk_sp<SkDocument> document(SkDocument::MakePDF(&pdfStream)); |
| 139 srand(0); | 139 if (document) { |
| 140 draw(document->beginPage(options.size.width(), options.size.height())); | 140 srand(0); |
| 141 document->close(); | 141 draw(document->beginPage(options.size.width(), options.size.height()
)); |
| 142 pdfData.reset(pdfStream.copyToData()); | 142 document->close(); |
| 143 pdfData.reset(pdfStream.copyToData()); |
| 144 } |
| 143 } | 145 } |
| 144 if (options.skp) { | 146 if (options.skp) { |
| 145 SkSize size; | 147 SkSize size; |
| 146 size = options.size; | 148 size = options.size; |
| 147 SkPictureRecorder recorder; | 149 SkPictureRecorder recorder; |
| 148 srand(0); | 150 srand(0); |
| 149 draw(recorder.beginRecording(size.width(), size.height())); | 151 draw(recorder.beginRecording(size.width(), size.height())); |
| 150 auto picture = recorder.finishRecordingAsPicture(); | 152 auto picture = recorder.finishRecordingAsPicture(); |
| 151 SkDynamicMemoryWStream skpStream; | 153 SkDynamicMemoryWStream skpStream; |
| 152 picture->serialize(&skpStream); | 154 picture->serialize(&skpStream); |
| 153 skpData.reset(skpStream.copyToData()); | 155 skpData.reset(skpStream.copyToData()); |
| 154 } | 156 } |
| 155 | 157 |
| 156 printf("{\n"); | 158 printf("{\n"); |
| 157 dump_output(rasterData, "Raster", !gpuData && !pdfData && !skpData); | 159 dump_output(rasterData, "Raster", !gpuData && !pdfData && !skpData); |
| 158 dump_output(gpuData, "Gpu", !pdfData && !skpData); | 160 dump_output(gpuData, "Gpu", !pdfData && !skpData); |
| 159 dump_output(pdfData, "Pdf", !skpData); | 161 dump_output(pdfData, "Pdf", !skpData); |
| 160 dump_output(skpData, "Skp"); | 162 dump_output(skpData, "Skp"); |
| 161 printf("}\n"); | 163 printf("}\n"); |
| 162 | 164 |
| 163 return 0; | 165 return 0; |
| 164 } | 166 } |
| OLD | NEW |