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

Side by Side Diff: tools/fiddle/fiddle_main.cpp

Issue 1936283003: documentation: SkDocument::MakePDF() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2016-05-02 (Monday) 17:27:37 EDT Created 4 years, 7 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 | « src/utils/SkLua.cpp ('k') | tools/skhello.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 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
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 }
OLDNEW
« no previous file with comments | « src/utils/SkLua.cpp ('k') | tools/skhello.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698