diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkFlattenable.cpp | 45 | ||||
-rw-r--r-- | src/core/SkPictureFlat.cpp | 10 | ||||
-rw-r--r-- | src/core/SkPictureFlat.h | 8 | ||||
-rw-r--r-- | src/core/SkPicturePlayback.cpp | 24 | ||||
-rw-r--r-- | src/core/SkPictureRecord.cpp | 8 | ||||
-rw-r--r-- | src/core/SkPictureRecord.h | 4 | ||||
-rw-r--r-- | src/core/SkPtrRecorder.cpp | 8 |
7 files changed, 52 insertions, 55 deletions
diff --git a/src/core/SkFlattenable.cpp b/src/core/SkFlattenable.cpp index dcdaa92d35..7ad147222c 100644 --- a/src/core/SkFlattenable.cpp +++ b/src/core/SkFlattenable.cpp @@ -117,48 +117,45 @@ void* SkFlattenableReadBuffer::readFunctionPtr() { SkFlattenableWriteBuffer::SkFlattenableWriteBuffer(size_t minSize) : INHERITED(minSize) { fFlags = (Flags)0; - fRCRecorder = NULL; - fTFRecorder = NULL; - fFactoryRecorder = NULL; + fRCSet = NULL; + fTFSet = NULL; + fFactorySet = NULL; } SkFlattenableWriteBuffer::~SkFlattenableWriteBuffer() { - SkSafeUnref(fRCRecorder); - SkSafeUnref(fTFRecorder); - SkSafeUnref(fFactoryRecorder); + SkSafeUnref(fRCSet); + SkSafeUnref(fTFSet); + SkSafeUnref(fFactorySet); } -SkRefCntRecorder* SkFlattenableWriteBuffer::setRefCntRecorder( - SkRefCntRecorder* rec) { - SkRefCnt_SafeAssign(fRCRecorder, rec); +SkRefCntSet* SkFlattenableWriteBuffer::setRefCntRecorder(SkRefCntSet* rec) { + SkRefCnt_SafeAssign(fRCSet, rec); return rec; } -SkRefCntRecorder* SkFlattenableWriteBuffer::setTypefaceRecorder( - SkRefCntRecorder* rec) { - SkRefCnt_SafeAssign(fTFRecorder, rec); +SkRefCntSet* SkFlattenableWriteBuffer::setTypefaceRecorder(SkRefCntSet* rec) { + SkRefCnt_SafeAssign(fTFSet, rec); return rec; } -SkFactoryRecorder* SkFlattenableWriteBuffer::setFactoryRecorder( - SkFactoryRecorder* rec) { - SkRefCnt_SafeAssign(fFactoryRecorder, rec); +SkFactorySet* SkFlattenableWriteBuffer::setFactoryRecorder(SkFactorySet* rec) { + SkRefCnt_SafeAssign(fFactorySet, rec); return rec; } void SkFlattenableWriteBuffer::writeTypeface(SkTypeface* obj) { - if (NULL == obj || NULL == fTFRecorder) { + if (NULL == obj || NULL == fTFSet) { this->write32(0); } else { - this->write32(fTFRecorder->record(obj)); + this->write32(fTFSet->add(obj)); } } void SkFlattenableWriteBuffer::writeRefCnt(SkRefCnt* obj) { - if (NULL == obj || NULL == fRCRecorder) { + if (NULL == obj || NULL == fRCSet) { this->write32(0); } else { - this->write32(fRCRecorder->record(obj)); + this->write32(fRCSet->add(obj)); } } @@ -168,8 +165,8 @@ void SkFlattenableWriteBuffer::writeFlattenable(SkFlattenable* flattenable) { factory = flattenable->getFactory(); } - if (fFactoryRecorder) { - this->write32(fFactoryRecorder->record(factory)); + if (fFactorySet) { + this->write32(fFactorySet->add(factory)); } else { this->writeFunctionPtr((void*)factory); } @@ -193,16 +190,16 @@ void SkFlattenableWriteBuffer::writeFunctionPtr(void* proc) { /////////////////////////////////////////////////////////////////////////////// -SkRefCntRecorder::~SkRefCntRecorder() { +SkRefCntSet::~SkRefCntSet() { // call this now, while our decPtr() is sill in scope this->reset(); } -void SkRefCntRecorder::incPtr(void* ptr) { +void SkRefCntSet::incPtr(void* ptr) { ((SkRefCnt*)ptr)->ref(); } -void SkRefCntRecorder::decPtr(void* ptr) { +void SkRefCntSet::decPtr(void* ptr) { ((SkRefCnt*)ptr)->unref(); } diff --git a/src/core/SkPictureFlat.cpp b/src/core/SkPictureFlat.cpp index 3b02752a3f..5c5ea0b7c9 100644 --- a/src/core/SkPictureFlat.cpp +++ b/src/core/SkPictureFlat.cpp @@ -16,7 +16,7 @@ SkFlatData* SkFlatData::Alloc(SkChunkAlloc* heap, int32_t size, int index) { } SkFlatBitmap* SkFlatBitmap::Flatten(SkChunkAlloc* heap, const SkBitmap& bitmap, - int index, SkRefCntRecorder* rec) { + int index, SkRefCntSet* rec) { SkFlattenableWriteBuffer buffer(1024); buffer.setRefCntRecorder(rec); @@ -82,8 +82,8 @@ void SkFlatMatrix::dump() const { /////////////////////////////////////////////////////////////////////////////// SkFlatPaint* SkFlatPaint::Flatten(SkChunkAlloc* heap, const SkPaint& paint, - int index, SkRefCntRecorder* rec, - SkRefCntRecorder* faceRecorder) { + int index, SkRefCntSet* rec, + SkRefCntSet* faceRecorder) { SkFlattenableWriteBuffer buffer(2*sizeof(SkPaint)); buffer.setRefCntRecorder(rec); buffer.setTypefaceRecorder(faceRecorder); @@ -221,7 +221,7 @@ SkRefCntPlayback::~SkRefCntPlayback() { this->reset(NULL); } -void SkRefCntPlayback::reset(const SkRefCntRecorder* rec) { +void SkRefCntPlayback::reset(const SkRefCntSet* rec) { for (int i = 0; i < fCount; i++) { SkASSERT(fArray[i]); fArray[i]->unref(); @@ -231,7 +231,7 @@ void SkRefCntPlayback::reset(const SkRefCntRecorder* rec) { if (rec) { fCount = rec->count(); fArray = SkNEW_ARRAY(SkRefCnt*, fCount); - rec->get(fArray); + rec->copyToArray(fArray); for (int i = 0; i < fCount; i++) { fArray[i]->ref(); } diff --git a/src/core/SkPictureFlat.h b/src/core/SkPictureFlat.h index 54a02fbb27..dae7b8aed0 100644 --- a/src/core/SkPictureFlat.h +++ b/src/core/SkPictureFlat.h @@ -57,7 +57,7 @@ public: int count() const { return fCount; } - void reset(const SkRefCntRecorder*); + void reset(const SkRefCntSet*); void setCount(int count); SkRefCnt* set(int index, SkRefCnt*); @@ -121,7 +121,7 @@ protected: class SkFlatBitmap : public SkFlatData { public: static SkFlatBitmap* Flatten(SkChunkAlloc*, const SkBitmap&, int index, - SkRefCntRecorder*); + SkRefCntSet*); void unflatten(SkBitmap* bitmap, SkRefCntPlayback* rcp) const { SkFlattenableReadBuffer buffer(fBitmapData); @@ -168,8 +168,8 @@ private: class SkFlatPaint : public SkFlatData { public: static SkFlatPaint* Flatten(SkChunkAlloc* heap, const SkPaint& paint, - int index, SkRefCntRecorder*, - SkRefCntRecorder* faceRecorder); + int index, SkRefCntSet*, + SkRefCntSet* faceRecorder); void unflatten(SkPaint* result, SkRefCntPlayback* rcp, SkTypefacePlayback* facePlayback) const { diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp index a7e2d165c0..67b68655a8 100644 --- a/src/core/SkPicturePlayback.cpp +++ b/src/core/SkPicturePlayback.cpp @@ -65,10 +65,10 @@ SkPicturePlayback::SkPicturePlayback(const SkPictureRecord& record) { // copy over the refcnt dictionary to our reader // - fRCPlayback.reset(&record.fRCRecorder); + fRCPlayback.reset(&record.fRCSet); fRCPlayback.setupBuffer(fReader); - fTFPlayback.reset(&record.fTFRecorder); + fTFPlayback.reset(&record.fTFSet); fTFPlayback.setupBuffer(fReader); const SkTDArray<const SkFlatBitmap* >& bitmaps = record.getBitmaps(); @@ -297,14 +297,14 @@ static void writeTagSize(SkWStream* stream, uint32_t tag, stream->write32(size); } -static void writeFactories(SkWStream* stream, const SkFactoryRecorder& rec) { +static void writeFactories(SkWStream* stream, const SkFactorySet& rec) { int count = rec.count(); writeTagSize(stream, PICT_FACTORY_TAG, count); SkAutoSTMalloc<16, SkFlattenable::Factory> storage(count); SkFlattenable::Factory* array = (SkFlattenable::Factory*)storage.get(); - rec.get(array); + rec.copyToArray(array); for (int i = 0; i < count; i++) { const char* name = SkFlattenable::FactoryToName(array[i]); @@ -319,14 +319,14 @@ static void writeFactories(SkWStream* stream, const SkFactoryRecorder& rec) { } } -static void writeTypefaces(SkWStream* stream, const SkRefCntRecorder& rec) { +static void writeTypefaces(SkWStream* stream, const SkRefCntSet& rec) { int count = rec.count(); writeTagSize(stream, PICT_TYPEFACE_TAG, count); SkAutoSTMalloc<16, SkTypeface*> storage(count); SkTypeface** array = (SkTypeface**)storage.get(); - rec.get((SkRefCnt**)array); + rec.copyToArray((SkRefCnt**)array); for (int i = 0; i < count; i++) { array[i]->serialize(stream); @@ -337,14 +337,14 @@ void SkPicturePlayback::serialize(SkWStream* stream) const { writeTagSize(stream, PICT_READER_TAG, fReader.size()); stream->write(fReader.base(), fReader.size()); - SkRefCntRecorder typefaceRecorder; - SkFactoryRecorder factRecorder; + SkRefCntSet typefaceSet; + SkFactorySet factSet; SkFlattenableWriteBuffer buffer(1024); buffer.setFlags(SkFlattenableWriteBuffer::kCrossProcess_Flag); - buffer.setTypefaceRecorder(&typefaceRecorder); - buffer.setFactoryRecorder(&factRecorder); + buffer.setTypefaceRecorder(&typefaceSet); + buffer.setFactoryRecorder(&factSet); int i; @@ -385,8 +385,8 @@ void SkPicturePlayback::serialize(SkWStream* stream) const { // now we can write to the stream again - writeFactories(stream, factRecorder); - writeTypefaces(stream, typefaceRecorder); + writeFactories(stream, factSet); + writeTypefaces(stream, typefaceSet); writeTagSize(stream, PICT_PICTURE_TAG, fPictureCount); for (i = 0; i < fPictureCount; i++) { diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index a48d0e4deb..6b2b330c55 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -440,8 +440,8 @@ void SkPictureRecord::reset() { fRestoreOffsetStack.setCount(1); fRestoreOffsetStack.top() = 0; - fRCRecorder.reset(); - fTFRecorder.reset(); + fRCSet.reset(); + fTFSet.reset(); } void SkPictureRecord::addBitmap(const SkBitmap& bitmap) { @@ -544,7 +544,7 @@ void SkPictureRecord::addText(const void* text, size_t byteLength) { int SkPictureRecord::find(SkTDArray<const SkFlatBitmap* >& bitmaps, const SkBitmap& bitmap) { SkFlatBitmap* flat = SkFlatBitmap::Flatten(&fHeap, bitmap, fBitmapIndex, - &fRCRecorder); + &fRCSet); int index = SkTSearch<SkFlatData>((const SkFlatData**) bitmaps.begin(), bitmaps.count(), (SkFlatData*) flat, sizeof(flat), &SkFlatData::Compare); if (index >= 0) { @@ -577,7 +577,7 @@ int SkPictureRecord::find(SkTDArray<const SkFlatPaint* >& paints, const SkPaint* } SkFlatPaint* flat = SkFlatPaint::Flatten(&fHeap, *paint, fPaintIndex, - &fRCRecorder, &fTFRecorder); + &fRCSet, &fTFSet); int index = SkTSearch<SkFlatData>((const SkFlatData**) paints.begin(), paints.count(), (SkFlatData*) flat, sizeof(flat), &SkFlatData::Compare); if (index >= 0) { diff --git a/src/core/SkPictureRecord.h b/src/core/SkPictureRecord.h index 14d1ffd196..e0d6a508ae 100644 --- a/src/core/SkPictureRecord.h +++ b/src/core/SkPictureRecord.h @@ -175,8 +175,8 @@ private: SkTDArray<SkPicture*> fPictureRefs; SkTDArray<SkShape*> fShapes; - SkRefCntRecorder fRCRecorder; - SkRefCntRecorder fTFRecorder; + SkRefCntSet fRCSet; + SkRefCntSet fTFSet; uint32_t fRecordFlags; diff --git a/src/core/SkPtrRecorder.cpp b/src/core/SkPtrRecorder.cpp index 4f774ec6ab..fa640cb32b 100644 --- a/src/core/SkPtrRecorder.cpp +++ b/src/core/SkPtrRecorder.cpp @@ -1,7 +1,7 @@ #include "SkPtrRecorder.h" #include "SkTSearch.h" -void SkPtrRecorder::reset() { +void SkPtrSet::reset() { Pair* p = fList.begin(); Pair* stop = fList.end(); while (p < stop) { @@ -11,11 +11,11 @@ void SkPtrRecorder::reset() { fList.reset(); } -int SkPtrRecorder::Cmp(const Pair& a, const Pair& b) { +int SkPtrSet::Cmp(const Pair& a, const Pair& b) { return (char*)a.fPtr - (char*)b.fPtr; } -uint32_t SkPtrRecorder::recordPtr(void* ptr) { +uint32_t SkPtrSet::add(void* ptr) { if (NULL == ptr) { return 0; } @@ -36,7 +36,7 @@ uint32_t SkPtrRecorder::recordPtr(void* ptr) { } } -void SkPtrRecorder::getPtrs(void* array[]) const { +void SkPtrSet::copyToArray(void* array[]) const { int count = fList.count(); if (count > 0) { SkASSERT(array); |