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

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 copyright dates in new files 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/core/SkPaint.cpp ('k') | src/core/SkWriteBuffer.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 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 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 write_tag_size(stream, SK_PICT_READER_TAG, fOpData->size()); 267 write_tag_size(stream, SK_PICT_READER_TAG, fOpData->size());
268 stream->write(fOpData->bytes(), fOpData->size()); 268 stream->write(fOpData->bytes(), fOpData->size());
269 269
270 // We serialize all typefaces into the typeface section of the top-level pic ture. 270 // We serialize all typefaces into the typeface section of the top-level pic ture.
271 SkRefCntSet localTypefaceSet; 271 SkRefCntSet localTypefaceSet;
272 SkRefCntSet* typefaceSet = topLevelTypeFaceSet ? topLevelTypeFaceSet : &loca lTypefaceSet; 272 SkRefCntSet* typefaceSet = topLevelTypeFaceSet ? topLevelTypeFaceSet : &loca lTypefaceSet;
273 273
274 // We delay serializing the bulk of our data until after we've serialized 274 // We delay serializing the bulk of our data until after we've serialized
275 // factories and typefaces by first serializing to an in-memory write buffer . 275 // factories and typefaces by first serializing to an in-memory write buffer .
276 SkFactorySet factSet; // buffer refs factSet, so factSet must come first. 276 SkFactorySet factSet; // buffer refs factSet, so factSet must come first.
277 SkWriteBuffer buffer(SkWriteBuffer::kCrossProcess_Flag); 277 SkBinaryWriteBuffer buffer(SkBinaryWriteBuffer::kCrossProcess_Flag);
278 buffer.setFactoryRecorder(&factSet); 278 buffer.setFactoryRecorder(&factSet);
279 buffer.setPixelSerializer(pixelSerializer); 279 buffer.setPixelSerializer(pixelSerializer);
280 buffer.setTypefaceRecorder(typefaceSet); 280 buffer.setTypefaceRecorder(typefaceSet);
281 this->flattenToBuffer(buffer); 281 this->flattenToBuffer(buffer);
282 282
283 // Dummy serialize our sub-pictures for the side effect of filling 283 // Dummy serialize our sub-pictures for the side effect of filling
284 // typefaceSet with typefaces from sub-pictures. 284 // typefaceSet with typefaces from sub-pictures.
285 struct DevNull: public SkWStream { 285 struct DevNull: public SkWStream {
286 DevNull() : fBytesWritten(0) {} 286 DevNull() : fBytesWritten(0) {}
287 size_t fBytesWritten; 287 size_t fBytesWritten;
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 } else { 659 } else {
660 return this->suitableForGpuRasterization(nullptr, reason); 660 return this->suitableForGpuRasterization(nullptr, reason);
661 } 661 }
662 } 662 }
663 663
664 bool SkPictureData::suitableForLayerOptimization() const { 664 bool SkPictureData::suitableForLayerOptimization() const {
665 return fContentInfo.numLayers() > 0; 665 return fContentInfo.numLayers() > 0;
666 } 666 }
667 #endif 667 #endif
668 /////////////////////////////////////////////////////////////////////////////// 668 ///////////////////////////////////////////////////////////////////////////////
OLDNEW
« no previous file with comments | « src/core/SkPaint.cpp ('k') | src/core/SkWriteBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698