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

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

Issue 1920423002: Prototype code that turns any/every flattenable into JSON (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix compile errors 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
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 #include <new> 7 #include <new>
8 #include "SkImageGenerator.h" 8 #include "SkImageGenerator.h"
9 #include "SkPictureData.h" 9 #include "SkPictureData.h"
10 #include "SkPictureRecord.h" 10 #include "SkPictureRecord.h"
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 write_tag_size(stream, SK_PICT_READER_TAG, fOpData->size()); 268 write_tag_size(stream, SK_PICT_READER_TAG, fOpData->size());
269 stream->write(fOpData->bytes(), fOpData->size()); 269 stream->write(fOpData->bytes(), fOpData->size());
270 270
271 // We serialize all typefaces into the typeface section of the top-level pic ture. 271 // We serialize all typefaces into the typeface section of the top-level pic ture.
272 SkRefCntSet localTypefaceSet; 272 SkRefCntSet localTypefaceSet;
273 SkRefCntSet* typefaceSet = topLevelTypeFaceSet ? topLevelTypeFaceSet : &loca lTypefaceSet; 273 SkRefCntSet* typefaceSet = topLevelTypeFaceSet ? topLevelTypeFaceSet : &loca lTypefaceSet;
274 274
275 // We delay serializing the bulk of our data until after we've serialized 275 // We delay serializing the bulk of our data until after we've serialized
276 // factories and typefaces by first serializing to an in-memory write buffer . 276 // factories and typefaces by first serializing to an in-memory write buffer .
277 SkFactorySet factSet; // buffer refs factSet, so factSet must come first. 277 SkFactorySet factSet; // buffer refs factSet, so factSet must come first.
278 SkWriteBuffer buffer(SkWriteBuffer::kCrossProcess_Flag); 278 SkBinaryWriteBuffer buffer(SkBinaryWriteBuffer::kCrossProcess_Flag);
279 buffer.setFactoryRecorder(&factSet); 279 buffer.setFactoryRecorder(&factSet);
280 buffer.setPixelSerializer(pixelSerializer); 280 buffer.setPixelSerializer(pixelSerializer);
281 buffer.setTypefaceRecorder(typefaceSet); 281 buffer.setTypefaceRecorder(typefaceSet);
282 this->flattenToBuffer(buffer); 282 this->flattenToBuffer(buffer);
283 283
284 // Dummy serialize our sub-pictures for the side effect of filling 284 // Dummy serialize our sub-pictures for the side effect of filling
285 // typefaceSet with typefaces from sub-pictures. 285 // typefaceSet with typefaces from sub-pictures.
286 struct DevNull: public SkWStream { 286 struct DevNull: public SkWStream {
287 DevNull() : fBytesWritten(0) {} 287 DevNull() : fBytesWritten(0) {}
288 size_t fBytesWritten; 288 size_t fBytesWritten;
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 } else { 660 } else {
661 return this->suitableForGpuRasterization(nullptr, reason); 661 return this->suitableForGpuRasterization(nullptr, reason);
662 } 662 }
663 } 663 }
664 664
665 bool SkPictureData::suitableForLayerOptimization() const { 665 bool SkPictureData::suitableForLayerOptimization() const {
666 return fContentInfo.numLayers() > 0; 666 return fContentInfo.numLayers() > 0;
667 } 667 }
668 #endif 668 #endif
669 /////////////////////////////////////////////////////////////////////////////// 669 ///////////////////////////////////////////////////////////////////////////////
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698