| OLD | NEW |
| 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 Loading... |
| 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 } |
| OLD | NEW |