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

Side by Side Diff: src/core/SkPicture.cpp

Issue 1911963008: DNC - JSON of flattenables, with field names. Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add names to call sites Created 4 years, 8 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
OLDNEW
1 /* 1 /*
2 * Copyright 2007 The Android Open Source Project 2 * Copyright 2007 The Android Open Source Project
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 "SkAtomics.h" 8 #include "SkAtomics.h"
9 #include "SkImageGenerator.h" 9 #include "SkImageGenerator.h"
10 #include "SkMessageBus.h" 10 #include "SkMessageBus.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 data->serialize(stream, pixelSerializer, typefaceSet); 200 data->serialize(stream, pixelSerializer, typefaceSet);
201 } else { 201 } else {
202 stream->writeBool(false); 202 stream->writeBool(false);
203 } 203 }
204 } 204 }
205 205
206 void SkPicture::flatten(SkWriteBuffer& buffer) const { 206 void SkPicture::flatten(SkWriteBuffer& buffer) const {
207 SkPictInfo info = this->createHeader(); 207 SkPictInfo info = this->createHeader();
208 SkAutoTDelete<SkPictureData> data(this->backport()); 208 SkAutoTDelete<SkPictureData> data(this->backport());
209 209
210 buffer.writeByteArray(&info.fMagic, sizeof(info.fMagic)); 210 buffer.writeByteArray("fMagic", &info.fMagic, sizeof(info.fMagic));
211 buffer.writeUInt(info.fVersion); 211 buffer.writeUInt("fVersion", info.fVersion);
212 buffer.writeRect(info.fCullRect); 212 buffer.writeRect("fCullRect", info.fCullRect);
213 buffer.writeUInt(info.fFlags); 213 buffer.writeUInt("fFlags", info.fFlags);
214 if (data) { 214 if (data) {
215 buffer.writeBool(true); 215 buffer.writeBool("dataValid", true);
216 data->flatten(buffer); 216 data->flatten(buffer);
217 } else { 217 } else {
218 buffer.writeBool(false); 218 buffer.writeBool("dataValid", false);
219 } 219 }
220 } 220 }
221 221
222 bool SkPicture::suitableForGpuRasterization(GrContext*, const char** whyNot) con st { 222 bool SkPicture::suitableForGpuRasterization(GrContext*, const char** whyNot) con st {
223 if (this->numSlowPaths() > 5) { 223 if (this->numSlowPaths() > 5) {
224 if (whyNot) { *whyNot = "Too many slow paths (either concave or dashed). "; } 224 if (whyNot) { *whyNot = "Too many slow paths (either concave or dashed). "; }
225 return false; 225 return false;
226 } 226 }
227 return true; 227 return true;
228 } 228 }
229 229
230 // Global setting to disable security precautions for serialization. 230 // Global setting to disable security precautions for serialization.
231 void SkPicture::SetPictureIOSecurityPrecautionsEnabled_Dangerous(bool set) { 231 void SkPicture::SetPictureIOSecurityPrecautionsEnabled_Dangerous(bool set) {
232 g_AllPictureIOSecurityPrecautionsEnabled = set; 232 g_AllPictureIOSecurityPrecautionsEnabled = set;
233 } 233 }
234 234
235 bool SkPicture::PictureIOSecurityPrecautionsEnabled() { 235 bool SkPicture::PictureIOSecurityPrecautionsEnabled() {
236 return g_AllPictureIOSecurityPrecautionsEnabled; 236 return g_AllPictureIOSecurityPrecautionsEnabled;
237 } 237 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698