private:
enum SerializationOffsets {
-#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
- kNewFormat_SerializationShift = 29, // requires 1 bit
-#endif
+ // 1 free bit at 29
kUnused1_SerializationShift = 28, // 1 free bit
kDirection_SerializationShift = 26, // requires 2 bits
kUnused2_SerializationShift = 25, // 1 free bit
-#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
- kOldIsOval_SerializationShift = 24, // requires 1 bit
-#endif
+ // 1 free bit at 24
kConvexity_SerializationShift = 16, // requires 8 bits
kFillType_SerializationShift = 8, // requires 8 bits
-#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
- kOldSegmentMask_SerializationShift = 0 // requires 4 bits
-#endif
+ // 8 free bits at 0
};
SkAutoTUnref<SkPathRef> fPathRef;
ed.setBounds(rect);
}
-#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
- friend class SkPathRef; // just for SerializationOffsets
-#endif
friend class SkAutoPathBoundsUpdate;
friend class SkAutoDisableOvalCheck;
friend class SkAutoDisableDirectionCheck;
const SkPathRef& src,
const SkMatrix& matrix);
- static SkPathRef* CreateFromBuffer(SkRBuffer* buffer
-#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
- , bool newFormat, int32_t oldPacked
-#endif
- );
+ static SkPathRef* CreateFromBuffer(SkRBuffer* buffer);
/**
* Rollsback a path ref to zero verbs and points with the assumption that the path ref will be
// V16: Move SkPath's isOval flag to SkPathRef
// V17: SkPixelRef now writes SkImageInfo
// V18: SkBitmap now records x,y for its pixelref origin, instead of offset.
-#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
- static const uint32_t PRIOR_PICTURE_VERSION = 15; // TODO: remove when .skps regenerated
-#endif
- static const uint32_t PICTURE_VERSION = 18;
+ // V19: encode matrices and regions into the ops stream
+ static const uint32_t PICTURE_VERSION = 19;
// fPlayback, fRecord, fWidth & fHeight are protected to allow derived classes to
// install their own SkPicturePlayback-derived players,SkPictureRecord-derived
int32_t packed = (fConvexity << kConvexity_SerializationShift) |
(fFillType << kFillType_SerializationShift) |
- (fDirection << kDirection_SerializationShift)
-#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
- | (0x1 << kNewFormat_SerializationShift)
-#endif
- ;
+ (fDirection << kDirection_SerializationShift);
buffer.write32(packed);
fConvexity = (packed >> kConvexity_SerializationShift) & 0xFF;
fFillType = (packed >> kFillType_SerializationShift) & 0xFF;
fDirection = (packed >> kDirection_SerializationShift) & 0x3;
-#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
- bool newFormat = (packed >> kNewFormat_SerializationShift) & 1;
-#endif
-
- SkPathRef* pathRef = SkPathRef::CreateFromBuffer(&buffer
-#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
- , newFormat, packed
-#endif
- );
+ SkPathRef* pathRef = SkPathRef::CreateFromBuffer(&buffer);
size_t sizeRead = 0;
if (buffer.isValid()) {
SkDEBUGCODE((*dst)->validate();)
}
-SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer
-#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
- , bool newFormat, int32_t oldPacked
-#endif
- ) {
+SkPathRef* SkPathRef::CreateFromBuffer(SkRBuffer* buffer) {
SkPathRef* ref = SkNEW(SkPathRef);
bool isOval;
uint8_t segmentMask;
}
ref->fIsFinite = (packed >> kIsFinite_SerializationShift) & 1;
-
-#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
- if (newFormat) {
-#endif
- segmentMask = (packed >> kSegmentMask_SerializationShift) & 0xF;
- isOval = (packed >> kIsOval_SerializationShift) & 1;
-#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
- } else {
- segmentMask = (oldPacked >> SkPath::kOldSegmentMask_SerializationShift) & 0xF;
- isOval = (oldPacked >> SkPath::kOldIsOval_SerializationShift) & 1;
- }
-#endif
+ segmentMask = (packed >> kSegmentMask_SerializationShift) & 0xF;
+ isOval = (packed >> kIsOval_SerializationShift) & 1;
int32_t verbCount, pointCount, conicCount;
if (!buffer->readU32(&(ref->fGenerationID)) ||
return false;
}
- if (PICTURE_VERSION != info.fVersion
-#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
- // V16 is backwards compatible with V15
- && PRIOR_PICTURE_VERSION != info.fVersion // TODO: remove when .skps regenerated
-#endif
- ) {
+ if (PICTURE_VERSION != info.fVersion) {
return false;
}
//#define SK_DEBUG_SIZE
-#include "SkBitmap.h"
#include "SkBitmapHeap.h"
#include "SkChecksum.h"
#include "SkChunkAlloc.h"
-#include "SkMatrix.h"
#include "SkOrderedReadBuffer.h"
#include "SkOrderedWriteBuffer.h"
#include "SkPaint.h"
-#include "SkPath.h"
#include "SkPicture.h"
#include "SkPtrRecorder.h"
-#include "SkRegion.h"
#include "SkTDynamicHash.h"
#include "SkTRefArray.h"
-#include "SkTSearch.h"
enum DrawType {
UNUSED,
// SkFlatData: is a simple indexable container for the flattened data
// which is agnostic to the type of data is is indexing. It is
// also responsible for flattening/unflattening objects but
-// details of that operation are hidden in the provided procs
+// details of that operation are hidden in the provided traits
// SkFlatDictionary: is an abstract templated dictionary that maintains a
// searchable set of SkFlatData objects of type T.
// SkFlatController: is an interface provided to SkFlatDictionary which handles
// allocation (and unallocation in some cases). It also holds
// ref count recorders and the like.
//
-// NOTE: any class that wishes to be used in conjunction with SkFlatDictionary
-// must subclass the dictionary and provide the necessary flattening procs.
-// The end of this header contains dictionary subclasses for some common classes
-// like SkBitmap, SkMatrix, SkPaint, and SkRegion. SkFlatController must also
-// be implemented, or SkChunkFlatController can be used to use an
-// SkChunkAllocator and never do replacements.
+// NOTE: any class that wishes to be used in conjunction with SkFlatDictionary must subclass the
+// dictionary and provide the necessary flattening traits. SkFlatController must also be
+// implemented, or SkChunkFlatController can be used to use an SkChunkAllocator and never do
+// replacements.
//
//
///////////////////////////////////////////////////////////////////////////////
SkFlatData::Identity, SkFlatData::Hash, SkFlatData::Equal> fHash;
};
-///////////////////////////////////////////////////////////////////////////////
-// Some common dictionaries are defined here for both reference and convenience
-///////////////////////////////////////////////////////////////////////////////
-
-struct SkMatrixTraits {
- static void flatten(SkOrderedWriteBuffer& buffer, const SkMatrix& matrix) {
- buffer.getWriter32()->writeMatrix(matrix);
- }
- static void unflatten(SkOrderedReadBuffer& buffer, SkMatrix* matrix) {
- buffer.getReader32()->readMatrix(matrix);
- }
-};
-typedef SkFlatDictionary<SkMatrix, SkMatrixTraits> SkMatrixDictionary;
-
-
-struct SkRegionTraits {
- static void flatten(SkOrderedWriteBuffer& buffer, const SkRegion& region) {
- buffer.getWriter32()->writeRegion(region);
- }
- static void unflatten(SkOrderedReadBuffer& buffer, SkRegion* region) {
- buffer.getReader32()->readRegion(region);
- }
-};
-typedef SkFlatDictionary<SkRegion, SkRegionTraits> SkRegionDictionary;
-
-
struct SkPaintTraits {
static void flatten(SkOrderedWriteBuffer& buffer, const SkPaint& paint) {
paint.flatten(buffer);
record.fFlattenableHeap.setupPlaybacks();
fBitmaps = record.fBitmapHeap->extractBitmaps();
- fMatrices = record.fMatrices.unflattenToArray();
fPaints = record.fPaints.unflattenToArray();
- fRegions = record.fRegions.unflattenToArray();
fBitmapHeap.reset(SkSafeRef(record.fBitmapHeap));
fPathHeap.reset(SkSafeRef(record.fPathHeap));
fBitmapHeap.reset(SkSafeRef(src.fBitmapHeap.get()));
fPathHeap.reset(SkSafeRef(src.fPathHeap.get()));
- fMatrices = SkSafeRef(src.fMatrices);
- fRegions = SkSafeRef(src.fRegions);
fOpData = SkSafeRef(src.fOpData);
fBoundingHierarchy = src.fBoundingHierarchy;
void SkPicturePlayback::init() {
fBitmaps = NULL;
- fMatrices = NULL;
fPaints = NULL;
fPictureRefs = NULL;
- fRegions = NULL;
fPictureCount = 0;
fOpData = NULL;
fFactoryPlayback = NULL;
fOpData->unref();
SkSafeUnref(fBitmaps);
- SkSafeUnref(fMatrices);
SkSafeUnref(fPaints);
- SkSafeUnref(fRegions);
SkSafeUnref(fBoundingHierarchy);
SkSafeUnref(fStateTree);
}
void SkPicturePlayback::dumpSize() const {
- SkDebugf("--- picture size: ops=%d bitmaps=%d [%d] matrices=%d [%d] paints=%d [%d] paths=%d regions=%d\n",
+ SkDebugf("--- picture size: ops=%d bitmaps=%d [%d] paints=%d [%d] paths=%d\n",
fOpData->size(),
SafeCount(fBitmaps), SafeCount(fBitmaps) * sizeof(SkBitmap),
- SafeCount(fMatrices), SafeCount(fMatrices) * sizeof(SkMatrix),
SafeCount(fPaints), SafeCount(fPaints) * sizeof(SkPaint),
- SafeCount(fPathHeap.get()),
- SafeCount(fRegions));
+ SafeCount(fPathHeap.get()));
}
bool SkPicturePlayback::containsBitmaps() const {
#define PICT_BUFFER_SIZE_TAG SkSetFourByteTag('a', 'r', 'a', 'y')
// these are all inside the ARRAYS tag
#define PICT_BITMAP_BUFFER_TAG SkSetFourByteTag('b', 't', 'm', 'p')
-#define PICT_MATRIX_BUFFER_TAG SkSetFourByteTag('m', 't', 'r', 'x')
#define PICT_PAINT_BUFFER_TAG SkSetFourByteTag('p', 'n', 't', ' ')
#define PICT_PATH_BUFFER_TAG SkSetFourByteTag('p', 't', 'h', ' ')
-#define PICT_REGION_BUFFER_TAG SkSetFourByteTag('r', 'g', 'n', ' ')
// Always write this guy last (with no length field afterwards)
#define PICT_EOF_TAG SkSetFourByteTag('e', 'o', 'f', ' ')
}
}
- if ((n = SafeCount(fMatrices)) > 0) {
- writeTagSize(buffer, PICT_MATRIX_BUFFER_TAG, n);
- for (i = 0; i < n; i++) {
- buffer.writeMatrix((*fMatrices)[i]);
- }
-
- }
-
if ((n = SafeCount(fPaints)) > 0) {
writeTagSize(buffer, PICT_PAINT_BUFFER_TAG, n);
for (i = 0; i < n; i++) {
writeTagSize(buffer, PICT_PATH_BUFFER_TAG, n);
fPathHeap->flatten(buffer);
}
-
- if ((n = SafeCount(fRegions)) > 0) {
- writeTagSize(buffer, PICT_REGION_BUFFER_TAG, n);
- for (i = 0; i < n; i++) {
- buffer.writeRegion((*fRegions)[i]);
- }
- }
}
void SkPicturePlayback::serialize(SkWStream* stream,
bm->setImmutable();
}
} break;
- case PICT_MATRIX_BUFFER_TAG:
- fMatrices = SkTRefArray<SkMatrix>::Create(size);
- for (size_t i = 0; i < size; ++i) {
- buffer.readMatrix(&fMatrices->writableAt(i));
- }
- break;
case PICT_PAINT_BUFFER_TAG: {
fPaints = SkTRefArray<SkPaint>::Create(size);
for (size_t i = 0; i < size; ++i) {
fPathHeap.reset(SkNEW_ARGS(SkPathHeap, (buffer)));
}
break;
- case PICT_REGION_BUFFER_TAG: {
- fRegions = SkTRefArray<SkRegion>::Create(size);
- for (size_t i = 0; i < size; ++i) {
- buffer.readRegion(&fRegions->writableAt(i));
- }
- } break;
default:
// The tag was invalid.
return false;
}
} break;
case CLIP_REGION: {
- const SkRegion& region = getRegion(reader);
+ SkRegion region;
+ this->getRegion(reader, ®ion);
uint32_t packed = reader.readInt();
SkRegion::Op regionOp = ClipParams_unpackRegionOp(packed);
size_t offsetToRestore = reader.readInt();
reader.setOffset(offsetToRestore);
}
} break;
- case CONCAT:
- canvas.concat(*getMatrix(reader));
+ case CONCAT: {
+ SkMatrix matrix;
+ this->getMatrix(reader, &matrix);
+ canvas.concat(matrix);
break;
+ }
case DRAW_BITMAP: {
const SkPaint* paint = getPaint(reader);
const SkBitmap& bitmap = getBitmap(reader);
case DRAW_BITMAP_MATRIX: {
const SkPaint* paint = getPaint(reader);
const SkBitmap& bitmap = getBitmap(reader);
- const SkMatrix* matrix = getMatrix(reader);
- canvas.drawBitmapMatrix(bitmap, *matrix, paint);
+ SkMatrix matrix;
+ this->getMatrix(reader, &matrix);
+ canvas.drawBitmapMatrix(bitmap, matrix, paint);
} break;
case DRAW_BITMAP_NINE: {
const SkPaint* paint = getPaint(reader);
const SkPaint& paint = *getPaint(reader);
getText(reader, &text);
const SkPath& path = getPath(reader);
- const SkMatrix* matrix = getMatrix(reader);
- canvas.drawTextOnPath(text.text(), text.length(), path,
- matrix, paint);
+ SkMatrix matrix;
+ this->getMatrix(reader, &matrix);
+ canvas.drawTextOnPath(text.text(), text.length(), path, &matrix, paint);
} break;
case DRAW_VERTICES: {
SkAutoTUnref<SkXfermode> xfer;
} break;
case SET_MATRIX: {
SkMatrix matrix;
- matrix.setConcat(initialMatrix, *getMatrix(reader));
+ this->getMatrix(reader, &matrix);
+ matrix.postConcat(initialMatrix);
canvas.setMatrix(matrix);
} break;
case SKEW: {
*size = result;
return fPathCount;
}
-
-int SkPicturePlayback::regions(size_t* size) {
- size_t result = 0;
- for (int index = 0; index < fRegionCount; index++) {
- // const SkRegion& region = fRegions[index];
- result += sizeof(SkRegion); // region->size();
- }
- *size = result;
- return fRegionCount;
-}
#endif
#ifdef SK_DEBUG_DUMP
DUMP_INT(offsetToRestore);
} break;
case CLIP_REGION: {
- DUMP_PTR(SkRegion, &getRegion());
DUMP_INT(SkRegion::Op);
DUMP_INT(offsetToRestore);
} break;
DUMP_INT(offsetToRestore);
} break;
case CONCAT:
- DUMP_PTR(SkMatrix, getMatrix());
break;
case DRAW_BITMAP: {
DUMP_PTR(SkPaint, getPaint());
DUMP_PTR(SkPaint, getPaint());
DUMP_TEXT();
DUMP_PTR(SkPath, &getPath());
- DUMP_PTR(SkMatrix, getMatrix());
} break;
case RESTORE:
break;
if (fBitmapCount > 0)
SkDebugf("%s0};\n", pBuffer);
- if (fMatrixCount > 0)
- SkDebugf("// matrices (%d)\n", fMatrixCount);
- for (index = 0; index < fMatrixCount; index++) {
- const SkMatrix& matrix = fMatrices[index];
- dumpMatrix(matrix);
- }
- bufferPtr = pBuffer;
- if (fMatrixCount > 0)
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer),
- "Matrices matrices = {");
- for (index = 0; index < fMatrixCount; index++)
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer),
- "matrix%p, ", &fMatrices[index]);
- if (fMatrixCount > 0)
- SkDebugf("%s0};\n", pBuffer);
if (fPaintCount > 0)
SkDebugf("// paints (%d)\n", fPaintCount);
if (fPictureCount > 0)
SkDebugf("%s0};\n", pBuffer);
- for (index = 0; index < fRegionCount; index++) {
- const SkRegion& region = fRegions[index];
- dumpRegion(region);
- }
- bufferPtr = pBuffer;
- if (fRegionCount > 0)
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer),
- "Regions regions = {");
- for (index = 0; index < fRegionCount; index++)
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer),
- "region%p, ", &fRegions[index]);
- if (fRegionCount > 0)
- SkDebugf("%s0};\n", pBuffer);
-
const_cast<SkPicturePlayback*>(this)->dumpStream();
}
return (*fBitmaps)[index];
}
- const SkMatrix* getMatrix(SkReader32& reader) {
- int index = reader.readInt();
- if (index == 0) {
- return NULL;
- }
- return &(*fMatrices)[index - 1];
+ void getMatrix(SkReader32& reader, SkMatrix* matrix) {
+ reader.readMatrix(matrix);
}
const SkPath& getPath(SkReader32& reader) {
}
}
- const SkRegion& getRegion(SkReader32& reader) {
- int index = reader.readInt();
- return (*fRegions)[index - 1];
+ void getRegion(SkReader32& reader, SkRegion* region) {
+ reader.readRegion(region);
}
void getText(SkReader32& reader, TextContainer* text) {
int bitmaps(size_t* size);
int paints(size_t* size);
int paths(size_t* size);
- int regions(size_t* size);
#endif
#ifdef SK_DEBUG_DUMP
SkAutoTUnref<SkPathHeap> fPathHeap;
SkTRefArray<SkBitmap>* fBitmaps;
- SkTRefArray<SkMatrix>* fMatrices;
SkTRefArray<SkPaint>* fPaints;
- SkTRefArray<SkRegion>* fRegions;
SkData* fOpData; // opcodes and parameters
fBoundingHierarchy(NULL),
fStateTree(NULL),
fFlattenableHeap(HEAP_BLOCK_SIZE),
- fMatrices(&fFlattenableHeap),
fPaints(&fFlattenableHeap),
- fRegions(&fFlattenableHeap),
fRecordFlags(flags) {
#ifdef SK_DEBUG_SIZE
fPointBytes = fRectBytes = fTextBytes = 0;
bool SkPictureRecord::concat(const SkMatrix& matrix) {
this->validate(fWriter.bytesWritten(), 0);
- // op + matrix index
- uint32_t size = 2 * kUInt32Size;
+ // op + matrix
+ uint32_t size = kUInt32Size + matrix.writeToMemory(NULL);
size_t initialOffset = this->addDraw(CONCAT, &size);
addMatrix(matrix);
this->validate(initialOffset, size);
void SkPictureRecord::setMatrix(const SkMatrix& matrix) {
this->validate(fWriter.bytesWritten(), 0);
- // op + matrix index
- uint32_t size = 2 * kUInt32Size;
+ // op + matrix
+ uint32_t size = kUInt32Size + matrix.writeToMemory(NULL);
size_t initialOffset = this->addDraw(SET_MATRIX, &size);
addMatrix(matrix);
this->validate(initialOffset, size);
}
bool SkPictureRecord::clipRegion(const SkRegion& region, SkRegion::Op op) {
- // op + region index + clip params
- uint32_t size = 3 * kUInt32Size;
+ // op + clip params + region
+ uint32_t size = 2 * kUInt32Size + region.writeToMemory(NULL);
// recordRestoreOffsetPlaceholder doesn't always write an offset
if (!fRestoreOffsetStack.isEmpty()) {
// + restore offset
void SkPictureRecord::drawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& matrix,
const SkPaint* paint) {
- // id + paint index + bitmap index + matrix index
- uint32_t size = 4 * kUInt32Size;
+ // id + paint index + bitmap index + matrix
+ uint32_t size = 3 * kUInt32Size + matrix.writeToMemory(NULL);
size_t initialOffset = this->addDraw(DRAW_BITMAP_MATRIX, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_BITMAP_MATRIX, size) == fWriter.bytesWritten());
addPaintPtr(paint);
void SkPictureRecord::drawTextOnPath(const void* text, size_t byteLength,
const SkPath& path, const SkMatrix* matrix,
const SkPaint& paint) {
- // op + paint index + length + 'length' worth of data + path index + matrix index
- uint32_t size = 3 * kUInt32Size + SkAlign4(byteLength) + 2 * kUInt32Size;
+ // op + paint index + length + 'length' worth of data + path index + matrix
+ const SkMatrix& m = matrix ? *matrix : SkMatrix::I();
+ uint32_t size = 3 * kUInt32Size + SkAlign4(byteLength) + kUInt32Size + m.writeToMemory(NULL);
size_t initialOffset = this->addDraw(DRAW_TEXT_ON_PATH, &size);
SkASSERT(initialOffset+getPaintOffset(DRAW_TEXT_ON_PATH, size) == fWriter.bytesWritten());
addPaint(paint);
addText(text, byteLength);
addPath(path);
- addMatrixPtr(matrix);
+ addMatrix(m);
this->validate(initialOffset, size);
}
}
void SkPictureRecord::addMatrix(const SkMatrix& matrix) {
- addMatrixPtr(&matrix);
-}
-
-void SkPictureRecord::addMatrixPtr(const SkMatrix* matrix) {
- this->addInt(matrix ? fMatrices.find(*matrix) : 0);
+ fWriter.writeMatrix(matrix);
}
const SkFlatData* SkPictureRecord::getFlatPaintData(const SkPaint& paint) {
}
void SkPictureRecord::addRegion(const SkRegion& region) {
- addInt(fRegions.find(region));
+ fWriter.writeRegion(region);
}
void SkPictureRecord::addText(const void* text, size_t byteLength) {
void addBitmap(const SkBitmap& bitmap);
void addMatrix(const SkMatrix& matrix);
- void addMatrixPtr(const SkMatrix* matrix);
const SkFlatData* addPaint(const SkPaint& paint) { return this->addPaintPtr(&paint); }
const SkFlatData* addPaintPtr(const SkPaint* paint);
void addFlatPaint(const SkFlatData* flatPaint);
private:
SkChunkFlatController fFlattenableHeap;
- SkMatrixDictionary fMatrices;
SkPaintDictionary fPaints;
- SkRegionDictionary fRegions;
SkPathHeap* fPathHeap; // reference counted
SkWriter32 fWriter;
SkBlurMaskFilterImpl::SkBlurMaskFilterImpl(SkFlattenableReadBuffer& buffer)
: SkMaskFilter(buffer) {
-#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
- // TODO: when the skps are recaptured at > v15 the SkScalarAbs can be removed
-#endif
- fSigma = SkScalarAbs(buffer.readScalar());
+ fSigma = buffer.readScalar();
fBlurStyle = (SkBlurMaskFilter::BlurStyle)buffer.readInt();
fBlurFlags = buffer.readUInt() & SkBlurMaskFilter::kAll_BlurFlag;
SkASSERT(fSigma >= 0);
SkASSERT(buffer.getArrayCount() == sizeof(Light));
buffer.readByteArray(&fLight, sizeof(Light));
SkASSERT(fLight.fPad == 0); // for the font-cache lookup to be clean
-#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V16_AND_ALL_OTHER_INSTANCES_TOO
- // TODO: Once skps are recaptured in > v15 this SkScalarAbs can be removed
-#endif
- fBlurSigma = SkScalarAbs(buffer.readScalar());
+ fBlurSigma = buffer.readScalar();
}
void SkEmbossMaskFilter::flatten(SkFlattenableWriteBuffer& buffer) const {
referenceRecord->fBitmapHeap->count() ==
testRecord->fBitmapHeap->count(), testStep->assertMessage());
REPORTER_ASSERT_MESSAGE(reporter,
- referenceRecord->fMatrices.count() ==
- testRecord->fMatrices.count(), testStep->assertMessage());
- for (int i = 0; i < referenceRecord->fMatrices.count(); ++i) {
- REPORTER_ASSERT_MESSAGE(reporter,
- EQ(referenceRecord->fMatrices[i], testRecord->fMatrices[i]),
- testStep->assertMessage());
- }
- REPORTER_ASSERT_MESSAGE(reporter,
referenceRecord->fPaints.count() ==
testRecord->fPaints.count(), testStep->assertMessage());
for (int i = 0; i < referenceRecord->fPaints.count(); ++i) {
testStep->assertMessage());
}
REPORTER_ASSERT_MESSAGE(reporter,
- referenceRecord->fRegions.count() ==
- testRecord->fRegions.count(), testStep->assertMessage());
- for (int i = 0; i < referenceRecord->fRegions.count(); ++i) {
- REPORTER_ASSERT_MESSAGE(reporter,
- EQ(referenceRecord->fRegions[i], testRecord->fRegions[i]),
- testStep->assertMessage());
- }
- REPORTER_ASSERT_MESSAGE(reporter,
!referenceRecord->fPathHeap ==
!testRecord->fPathHeap,
testStep->assertMessage());