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

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

Issue 2333713002: change SkStreams to work with sk_sp<SkData> instead of SkData* (Closed)
Patch Set: fix xpsdevice Created 4 years, 3 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 | « tools/debugger/SkDrawCommand.cpp ('k') | tools/get_images_from_skps.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 #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
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 }
OLDNEW
« no previous file with comments | « tools/debugger/SkDrawCommand.cpp ('k') | tools/get_images_from_skps.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698