| 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 | 9 |
| 10 #include <GL/osmesa.h> | 10 #include <GL/osmesa.h> |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 } | 130 } |
| 131 draw(surface->getCanvas()); | 131 draw(surface->getCanvas()); |
| 132 gpuData.reset(encode_snapshot(surface)); | 132 gpuData.reset(encode_snapshot(surface)); |
| 133 } | 133 } |
| 134 if (osMesaContext) { | 134 if (osMesaContext) { |
| 135 OSMesaDestroyContext(osMesaContext); | 135 OSMesaDestroyContext(osMesaContext); |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 if (options.pdf) { | 138 if (options.pdf) { |
| 139 SkDynamicMemoryWStream pdfStream; | 139 SkDynamicMemoryWStream pdfStream; |
| 140 sk_sp<SkDocument> document(SkDocument::CreatePDF(&pdfStream)); | 140 sk_sp<SkDocument> document(SkDocument::MakePDF(&pdfStream)); |
| 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.reset(pdfStream.copyToData()); |
| 144 } | 144 } |
| 145 if (options.skp) { | 145 if (options.skp) { |
| 146 SkSize size; | 146 SkSize size; |
| 147 size = options.size; | 147 size = options.size; |
| 148 SkPictureRecorder recorder; | 148 SkPictureRecorder recorder; |
| 149 draw(recorder.beginRecording(size.width(), size.height())); | 149 draw(recorder.beginRecording(size.width(), size.height())); |
| 150 auto picture = recorder.finishRecordingAsPicture(); | 150 auto picture = recorder.finishRecordingAsPicture(); |
| 151 SkDynamicMemoryWStream skpStream; | 151 SkDynamicMemoryWStream skpStream; |
| 152 picture->serialize(&skpStream); | 152 picture->serialize(&skpStream); |
| 153 skpData.reset(skpStream.copyToData()); | 153 skpData.reset(skpStream.copyToData()); |
| 154 } | 154 } |
| 155 | 155 |
| 156 printf("{\n"); | 156 printf("{\n"); |
| 157 dump_output(rasterData, "Raster", !gpuData && !pdfData && !skpData); | 157 dump_output(rasterData, "Raster", !gpuData && !pdfData && !skpData); |
| 158 dump_output(gpuData, "Gpu", !pdfData && !skpData); | 158 dump_output(gpuData, "Gpu", !pdfData && !skpData); |
| 159 dump_output(pdfData, "Pdf", !skpData); | 159 dump_output(pdfData, "Pdf", !skpData); |
| 160 dump_output(skpData, "Skp"); | 160 dump_output(skpData, "Skp"); |
| 161 printf("}\n"); | 161 printf("}\n"); |
| 162 | 162 |
| 163 return 0; | 163 return 0; |
| 164 } | 164 } |
| OLD | NEW |