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

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

Issue 787833002: Revert of Replace EncodeBitmap with an interface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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/SkPictureData.h ('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 "SkBBoxHierarchy.h" 8 #include "SkBBoxHierarchy.h"
9 #include "SkDrawPictureCallback.h" 9 #include "SkDrawPictureCallback.h"
10 #include "SkPictureData.h" 10 #include "SkPictureData.h"
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 if (fTextBlobCount > 0) { 212 if (fTextBlobCount > 0) {
213 write_tag_size(buffer, SK_PICT_TEXTBLOB_BUFFER_TAG, fTextBlobCount); 213 write_tag_size(buffer, SK_PICT_TEXTBLOB_BUFFER_TAG, fTextBlobCount);
214 for (i = 0; i < fTextBlobCount; ++i) { 214 for (i = 0; i < fTextBlobCount; ++i) {
215 fTextBlobRefs[i]->flatten(buffer); 215 fTextBlobRefs[i]->flatten(buffer);
216 } 216 }
217 } 217 }
218 } 218 }
219 219
220 void SkPictureData::serialize(SkWStream* stream, 220 void SkPictureData::serialize(SkWStream* stream,
221 SkPixelSerializer* pixelSerializer) const { 221 SkPicture::EncodeBitmap encoder) const {
222 write_tag_size(stream, SK_PICT_READER_TAG, fOpData->size()); 222 write_tag_size(stream, SK_PICT_READER_TAG, fOpData->size());
223 stream->write(fOpData->bytes(), fOpData->size()); 223 stream->write(fOpData->bytes(), fOpData->size());
224 224
225 if (fPictureCount > 0) { 225 if (fPictureCount > 0) {
226 write_tag_size(stream, SK_PICT_PICTURE_TAG, fPictureCount); 226 write_tag_size(stream, SK_PICT_PICTURE_TAG, fPictureCount);
227 for (int i = 0; i < fPictureCount; i++) { 227 for (int i = 0; i < fPictureCount; i++) {
228 fPictureRefs[i]->serialize(stream, pixelSerializer); 228 fPictureRefs[i]->serialize(stream, encoder);
229 } 229 }
230 } 230 }
231 231
232 // Write some of our data into a writebuffer, and then serialize that 232 // Write some of our data into a writebuffer, and then serialize that
233 // into our stream 233 // into our stream
234 { 234 {
235 SkRefCntSet typefaceSet; 235 SkRefCntSet typefaceSet;
236 SkFactorySet factSet; 236 SkFactorySet factSet;
237 237
238 SkWriteBuffer buffer(SkWriteBuffer::kCrossProcess_Flag); 238 SkWriteBuffer buffer(SkWriteBuffer::kCrossProcess_Flag);
239 buffer.setTypefaceRecorder(&typefaceSet); 239 buffer.setTypefaceRecorder(&typefaceSet);
240 buffer.setFactoryRecorder(&factSet); 240 buffer.setFactoryRecorder(&factSet);
241 buffer.setPixelSerializer(pixelSerializer); 241 buffer.setBitmapEncoder(encoder);
242 242
243 this->flattenToBuffer(buffer); 243 this->flattenToBuffer(buffer);
244 244
245 // We have to write these two sets into the stream *before* we write 245 // We have to write these two sets into the stream *before* we write
246 // the buffer, since parsing that buffer will require that we already 246 // the buffer, since parsing that buffer will require that we already
247 // have these sets available to use. 247 // have these sets available to use.
248 WriteFactories(stream, factSet); 248 WriteFactories(stream, factSet);
249 WriteTypefaces(stream, typefaceSet); 249 WriteTypefaces(stream, typefaceSet);
250 250
251 write_tag_size(stream, SK_PICT_BUFFER_SIZE_TAG, buffer.bytesWritten()); 251 write_tag_size(stream, SK_PICT_BUFFER_SIZE_TAG, buffer.bytesWritten());
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
573 } 573 }
574 } 574 }
575 575
576 bool SkPictureData::suitableForLayerOptimization() const { 576 bool SkPictureData::suitableForLayerOptimization() const {
577 return fContentInfo.numLayers() > 0; 577 return fContentInfo.numLayers() > 0;
578 } 578 }
579 #endif 579 #endif
580 /////////////////////////////////////////////////////////////////////////////// 580 ///////////////////////////////////////////////////////////////////////////////
581 581
582 582
OLDNEW
« no previous file with comments | « src/core/SkPictureData.h ('k') | src/core/SkWriteBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698