OLD | NEW |
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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 write_tag_size(stream, SK_PICT_READER_TAG, fOpData->size()); | 248 write_tag_size(stream, SK_PICT_READER_TAG, fOpData->size()); |
249 stream->write(fOpData->bytes(), fOpData->size()); | 249 stream->write(fOpData->bytes(), fOpData->size()); |
250 | 250 |
251 // We serialize all typefaces into the typeface section of the top-level pic
ture. | 251 // We serialize all typefaces into the typeface section of the top-level pic
ture. |
252 SkRefCntSet localTypefaceSet; | 252 SkRefCntSet localTypefaceSet; |
253 SkRefCntSet* typefaceSet = topLevelTypeFaceSet ? topLevelTypeFaceSet : &loca
lTypefaceSet; | 253 SkRefCntSet* typefaceSet = topLevelTypeFaceSet ? topLevelTypeFaceSet : &loca
lTypefaceSet; |
254 | 254 |
255 // We delay serializing the bulk of our data until after we've serialized | 255 // We delay serializing the bulk of our data until after we've serialized |
256 // factories and typefaces by first serializing to an in-memory write buffer
. | 256 // factories and typefaces by first serializing to an in-memory write buffer
. |
257 SkFactorySet factSet; // buffer refs factSet, so factSet must come first. | 257 SkFactorySet factSet; // buffer refs factSet, so factSet must come first. |
258 SkWriteBuffer buffer(SkWriteBuffer::kCrossProcess_Flag); | 258 SkBinaryWriteBuffer buffer(SkBinaryWriteBuffer::kCrossProcess_Flag); |
259 buffer.setFactoryRecorder(&factSet); | 259 buffer.setFactoryRecorder(&factSet); |
260 buffer.setPixelSerializer(pixelSerializer); | 260 buffer.setPixelSerializer(pixelSerializer); |
261 buffer.setTypefaceRecorder(typefaceSet); | 261 buffer.setTypefaceRecorder(typefaceSet); |
262 this->flattenToBuffer(buffer); | 262 this->flattenToBuffer(buffer); |
263 | 263 |
264 // Dummy serialize our sub-pictures for the side effect of filling | 264 // Dummy serialize our sub-pictures for the side effect of filling |
265 // typefaceSet with typefaces from sub-pictures. | 265 // typefaceSet with typefaces from sub-pictures. |
266 struct DevNull: public SkWStream { | 266 struct DevNull: public SkWStream { |
267 DevNull() : fBytesWritten(0) {} | 267 DevNull() : fBytesWritten(0) {} |
268 size_t fBytesWritten; | 268 size_t fBytesWritten; |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
623 } else { | 623 } else { |
624 return this->suitableForGpuRasterization(nullptr, reason); | 624 return this->suitableForGpuRasterization(nullptr, reason); |
625 } | 625 } |
626 } | 626 } |
627 | 627 |
628 bool SkPictureData::suitableForLayerOptimization() const { | 628 bool SkPictureData::suitableForLayerOptimization() const { |
629 return fContentInfo.numLayers() > 0; | 629 return fContentInfo.numLayers() > 0; |
630 } | 630 } |
631 #endif | 631 #endif |
632 /////////////////////////////////////////////////////////////////////////////// | 632 /////////////////////////////////////////////////////////////////////////////// |
OLD | NEW |