| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 if (document) { | 139 if (document) { |
| 140 srand(0); | 140 srand(0); |
| 141 draw(document->beginPage(options.size.width(), options.size.height()
)); | 141 draw(document->beginPage(options.size.width(), options.size.height()
)); |
| 142 document->close(); | 142 document->close(); |
| 143 pdfData.reset(pdfStream.copyToData()); | 143 pdfData = pdfStream.detachAsData(); |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 if (options.skp) { | 146 if (options.skp) { |
| 147 SkSize size; | 147 SkSize size; |
| 148 size = options.size; | 148 size = options.size; |
| 149 SkPictureRecorder recorder; | 149 SkPictureRecorder recorder; |
| 150 srand(0); | 150 srand(0); |
| 151 draw(recorder.beginRecording(size.width(), size.height())); | 151 draw(recorder.beginRecording(size.width(), size.height())); |
| 152 auto picture = recorder.finishRecordingAsPicture(); | 152 auto picture = recorder.finishRecordingAsPicture(); |
| 153 SkDynamicMemoryWStream skpStream; | 153 SkDynamicMemoryWStream skpStream; |
| 154 picture->serialize(&skpStream); | 154 picture->serialize(&skpStream); |
| 155 skpData.reset(skpStream.copyToData()); | 155 skpData = skpStream.detachAsData(); |
| 156 } | 156 } |
| 157 | 157 |
| 158 printf("{\n"); | 158 printf("{\n"); |
| 159 dump_output(rasterData, "Raster", !gpuData && !pdfData && !skpData); | 159 dump_output(rasterData, "Raster", !gpuData && !pdfData && !skpData); |
| 160 dump_output(gpuData, "Gpu", !pdfData && !skpData); | 160 dump_output(gpuData, "Gpu", !pdfData && !skpData); |
| 161 dump_output(pdfData, "Pdf", !skpData); | 161 dump_output(pdfData, "Pdf", !skpData); |
| 162 dump_output(skpData, "Skp"); | 162 dump_output(skpData, "Skp"); |
| 163 printf("}\n"); | 163 printf("}\n"); |
| 164 | 164 |
| 165 return 0; | 165 return 0; |
| 166 } | 166 } |
| OLD | NEW |