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

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

Issue 784643002: Replace EncodeBitmap with an interface. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Undefine macro, fix callsites, define in chrome, leave EncodeBitmap for PDF. 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
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2007 The Android Open Source Project 3 * Copyright 2007 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkPictureFlat.h" 10 #include "SkPictureFlat.h"
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after
447 // This for compatibility with serialization code only. This is not cheap. 447 // This for compatibility with serialization code only. This is not cheap.
448 SkPictureData* SkPicture::Backport(const SkRecord& src, const SkPictInfo& info, 448 SkPictureData* SkPicture::Backport(const SkRecord& src, const SkPictInfo& info,
449 SkPicture const* const drawablePicts[], int d rawableCount) { 449 SkPicture const* const drawablePicts[], int d rawableCount) {
450 SkPictureRecord rec(SkISize::Make(info.fCullRect.width(), info.fCullRect.hei ght()), 0/*flags*/); 450 SkPictureRecord rec(SkISize::Make(info.fCullRect.width(), info.fCullRect.hei ght()), 0/*flags*/);
451 rec.beginRecording(); 451 rec.beginRecording();
452 SkRecordDraw(src, &rec, drawablePicts, NULL, drawableCount, NULL/*bbh*/, NULL/*callback*/); 452 SkRecordDraw(src, &rec, drawablePicts, NULL, drawableCount, NULL/*bbh*/, NULL/*callback*/);
453 rec.endRecording(); 453 rec.endRecording();
454 return SkNEW_ARGS(SkPictureData, (rec, info, false/*deep copy ops?*/)); 454 return SkNEW_ARGS(SkPictureData, (rec, info, false/*deep copy ops?*/));
455 } 455 }
456 456
457 void SkPicture::serialize(SkWStream* stream, EncodeBitmap encoder) const { 457 void SkPicture::serialize(SkWStream* stream, SkPixelSerializer* pixelSerializer) const {
458 SkPictInfo info; 458 SkPictInfo info;
459 this->createHeader(&info); 459 this->createHeader(&info);
460 SkAutoTDelete<SkPictureData> data(Backport(*fRecord, info, this->drawablePic ts(), 460 SkAutoTDelete<SkPictureData> data(Backport(*fRecord, info, this->drawablePic ts(),
461 this->drawableCount())); 461 this->drawableCount()));
462 462
463 stream->write(&info, sizeof(info)); 463 stream->write(&info, sizeof(info));
464 if (data) { 464 if (data) {
465 stream->writeBool(true); 465 stream->writeBool(true);
466 data->serialize(stream, encoder); 466 data->serialize(stream, pixelSerializer);
467 } else { 467 } else {
468 stream->writeBool(false); 468 stream->writeBool(false);
469 } 469 }
470 } 470 }
471 471
472 void SkPicture::flatten(SkWriteBuffer& buffer) const { 472 void SkPicture::flatten(SkWriteBuffer& buffer) const {
473 SkPictInfo info; 473 SkPictInfo info;
474 this->createHeader(&info); 474 this->createHeader(&info);
475 SkAutoTDelete<SkPictureData> data(Backport(*fRecord, info, this->drawablePic ts(), 475 SkAutoTDelete<SkPictureData> data(Backport(*fRecord, info, this->drawablePic ts(),
476 this->drawableCount())); 476 this->drawableCount()));
(...skipping 22 matching lines...) Expand all
499 499
500 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr awablePicts, 500 SkPicture::SkPicture(const SkRect& cullRect, SkRecord* record, SnapshotArray* dr awablePicts,
501 SkBBoxHierarchy* bbh) 501 SkBBoxHierarchy* bbh)
502 : fUniqueID(next_picture_generation_id()) 502 : fUniqueID(next_picture_generation_id())
503 , fCullRect(cullRect) 503 , fCullRect(cullRect)
504 , fRecord(SkRef(record)) 504 , fRecord(SkRef(record))
505 , fBBH(SkSafeRef(bbh)) 505 , fBBH(SkSafeRef(bbh))
506 , fDrawablePicts(drawablePicts) // take ownership 506 , fDrawablePicts(drawablePicts) // take ownership
507 , fAnalysis(*fRecord) 507 , fAnalysis(*fRecord)
508 {} 508 {}
OLDNEW
« gm/gmmain.cpp ('K') | « include/core/SkWriteBuffer.h ('k') | src/core/SkPictureData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698