Index: src/core/SkPictureData.cpp |
diff --git a/src/core/SkPictureData.cpp b/src/core/SkPictureData.cpp |
index 123c414b53de2269e8a14fcc765e9c13343c3bb5..140ca88b34ef4f157884d525578e710ffcab5f86 100644 |
--- a/src/core/SkPictureData.cpp |
+++ b/src/core/SkPictureData.cpp |
@@ -40,42 +40,6 @@ SkPictureData::SkPictureData(const SkPictureRecord& record, |
const SkPictInfo& info, |
bool deepCopyOps) |
: fInfo(info) { |
-#ifdef SK_DEBUG_SIZE |
- size_t overallBytes, bitmapBytes, matricesBytes, |
- paintBytes, pathBytes, pictureBytes, regionBytes; |
- int bitmaps = record.bitmaps(&bitmapBytes); |
- int matrices = record.matrices(&matricesBytes); |
- int paints = record.paints(&paintBytes); |
- int paths = record.paths(&pathBytes); |
- int pictures = record.pictures(&pictureBytes); |
- int regions = record.regions(®ionBytes); |
- SkDebugf("picture record mem used %zd (stream %zd) ", record.size(), |
- record.streamlen()); |
- if (bitmaps != 0) |
- SkDebugf("bitmaps size %zd (bitmaps:%d) ", bitmapBytes, bitmaps); |
- if (matrices != 0) |
- SkDebugf("matrices size %zd (matrices:%d) ", matricesBytes, matrices); |
- if (paints != 0) |
- SkDebugf("paints size %zd (paints:%d) ", paintBytes, paints); |
- if (paths != 0) |
- SkDebugf("paths size %zd (paths:%d) ", pathBytes, paths); |
- if (pictures != 0) |
- SkDebugf("pictures size %zd (pictures:%d) ", pictureBytes, pictures); |
- if (regions != 0) |
- SkDebugf("regions size %zd (regions:%d) ", regionBytes, regions); |
- if (record.fPointWrites != 0) |
- SkDebugf("points size %zd (points:%d) ", record.fPointBytes, record.fPointWrites); |
- if (record.fRectWrites != 0) |
- SkDebugf("rects size %zd (rects:%d) ", record.fRectBytes, record.fRectWrites); |
- if (record.fTextWrites != 0) |
- SkDebugf("text size %zd (text strings:%d) ", record.fTextBytes, record.fTextWrites); |
- |
- SkDebugf("\n"); |
-#endif |
-#ifdef SK_DEBUG_DUMP |
- record.dumpMatrices(); |
- record.dumpPaints(); |
-#endif |
this->init(); |
@@ -112,27 +76,6 @@ SkPictureData::SkPictureData(const SkPictureRecord& record, |
fPictureRefs[i]->ref(); |
} |
} |
- |
-#ifdef SK_DEBUG_SIZE |
- int overall = fPlayback->size(&overallBytes); |
- bitmaps = fPlayback->bitmaps(&bitmapBytes); |
- paints = fPlayback->paints(&paintBytes); |
- paths = fPlayback->paths(&pathBytes); |
- pictures = fPlayback->pictures(&pictureBytes); |
- regions = fPlayback->regions(®ionBytes); |
- SkDebugf("playback size %zd (objects:%d) ", overallBytes, overall); |
- if (bitmaps != 0) |
- SkDebugf("bitmaps size %zd (bitmaps:%d) ", bitmapBytes, bitmaps); |
- if (paints != 0) |
- SkDebugf("paints size %zd (paints:%d) ", paintBytes, paints); |
- if (paths != 0) |
- SkDebugf("paths size %zd (paths:%d) ", pathBytes, paths); |
- if (pictures != 0) |
- SkDebugf("pictures size %zd (pictures:%d) ", pictureBytes, pictures); |
- if (regions != 0) |
- SkDebugf("regions size %zd (regions:%d) ", regionBytes, regions); |
- SkDebugf("\n"); |
-#endif |
} |
#ifdef SK_SUPPORT_LEGACY_PICTURE_CLONE |
@@ -218,15 +161,6 @@ SkPictureData::~SkPictureData() { |
SkDELETE(fFactoryPlayback); |
} |
-void SkPictureData::dumpSize() const { |
- SkDebugf("--- picture size: ops=%d bitmaps=%d [%d] paints=%d [%d]\n", |
- fOpData->size(), |
- SafeCount(fBitmaps), SafeCount(fBitmaps) * sizeof(SkBitmap), |
- SafeCount(fPaints), SafeCount(fPaints) * sizeof(SkPaint)); |
- SkDebugf("--- picture size: paths=%d\n", |
- SafeCount(fPathHeap.get())); |
-} |
- |
bool SkPictureData::containsBitmaps() const { |
if (fBitmaps && fBitmaps->count() > 0) { |
return true; |
@@ -287,7 +221,6 @@ void SkPictureData::WriteFactories(SkWStream* stream, const SkFactorySet& rec) { |
for (int i = 0; i < count; i++) { |
const char* name = SkFlattenable::FactoryToName(array[i]); |
-// SkDebugf("---- write factories [%d] %p <%s>\n", i, array[i], name); |
if (NULL == name || 0 == *name) { |
stream->writePackedUInt(0); |
} else { |
@@ -687,511 +620,4 @@ bool SkPictureData::suitableForGpuRasterization(GrContext* context, const char * |
#endif |
/////////////////////////////////////////////////////////////////////////////// |
-#ifdef SK_DEBUG_SIZE |
-int SkPictureData::size(size_t* sizePtr) { |
- int objects = bitmaps(sizePtr); |
- objects += paints(sizePtr); |
- objects += paths(sizePtr); |
- objects += pictures(sizePtr); |
- objects += regions(sizePtr); |
- *sizePtr = fOpData.size(); |
- return objects; |
-} |
- |
-int SkPictureData::bitmaps(size_t* size) { |
- size_t result = 0; |
- for (int index = 0; index < fBitmapCount; index++) { |
- // const SkBitmap& bitmap = fBitmaps[index]; |
- result += sizeof(SkBitmap); // bitmap->size(); |
- } |
- *size = result; |
- return fBitmapCount; |
-} |
- |
-int SkPictureData::paints(size_t* size) { |
- size_t result = 0; |
- for (int index = 0; index < fPaintCount; index++) { |
- // const SkPaint& paint = fPaints[index]; |
- result += sizeof(SkPaint); // paint->size(); |
- } |
- *size = result; |
- return fPaintCount; |
-} |
- |
-int SkPictureData::paths(size_t* size) { |
- size_t result = 0; |
- for (int index = 0; index < fPathCount; index++) { |
- const SkPath& path = fPaths[index]; |
- result += path.flatten(NULL); |
- } |
- *size = result; |
- return fPathCount; |
-} |
-#endif |
- |
-#ifdef SK_DEBUG_DUMP |
-void SkPictureData::dumpBitmap(const SkBitmap& bitmap) const { |
- char pBuffer[DUMP_BUFFER_SIZE]; |
- char* bufferPtr = pBuffer; |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "BitmapData bitmap%p = {", &bitmap); |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kWidth, %d}, ", bitmap.width()); |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kHeight, %d}, ", bitmap.height()); |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kRowBytes, %d}, ", bitmap.rowBytes()); |
-// start here; |
- SkDebugf("%s{0}};\n", pBuffer); |
-} |
- |
-void dumpMatrix(const SkMatrix& matrix) const { |
- SkMatrix defaultMatrix; |
- defaultMatrix.reset(); |
- char pBuffer[DUMP_BUFFER_SIZE]; |
- char* bufferPtr = pBuffer; |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "MatrixData matrix%p = {", &matrix); |
- SkScalar scaleX = matrix.getScaleX(); |
- if (scaleX != defaultMatrix.getScaleX()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kScaleX, %g}, ", SkScalarToFloat(scaleX)); |
- SkScalar scaleY = matrix.getScaleY(); |
- if (scaleY != defaultMatrix.getScaleY()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kScaleY, %g}, ", SkScalarToFloat(scaleY)); |
- SkScalar skewX = matrix.getSkewX(); |
- if (skewX != defaultMatrix.getSkewX()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kSkewX, %g}, ", SkScalarToFloat(skewX)); |
- SkScalar skewY = matrix.getSkewY(); |
- if (skewY != defaultMatrix.getSkewY()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kSkewY, %g}, ", SkScalarToFloat(skewY)); |
- SkScalar translateX = matrix.getTranslateX(); |
- if (translateX != defaultMatrix.getTranslateX()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kTranslateX, %g}, ", SkScalarToFloat(translateX)); |
- SkScalar translateY = matrix.getTranslateY(); |
- if (translateY != defaultMatrix.getTranslateY()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kTranslateY, %g}, ", SkScalarToFloat(translateY)); |
- SkScalar perspX = matrix.getPerspX(); |
- if (perspX != defaultMatrix.getPerspX()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kPerspX, %g}, ", perspX); |
- SkScalar perspY = matrix.getPerspY(); |
- if (perspY != defaultMatrix.getPerspY()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kPerspY, %g}, ", perspY); |
- SkDebugf("%s{0}};\n", pBuffer); |
-} |
- |
-void dumpPaint(const SkPaint& paint) const { |
- SkPaint defaultPaint; |
- char pBuffer[DUMP_BUFFER_SIZE]; |
- char* bufferPtr = pBuffer; |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "PaintPointers paintPtrs%p = {", &paint); |
- const SkTypeface* typeface = paint.getTypeface(); |
- if (typeface != defaultPaint.getTypeface()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kTypeface, %p}, ", typeface); |
- const SkPathEffect* pathEffect = paint.getPathEffect(); |
- if (pathEffect != defaultPaint.getPathEffect()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kPathEffect, %p}, ", pathEffect); |
- const SkShader* shader = paint.getShader(); |
- if (shader != defaultPaint.getShader()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kShader, %p}, ", shader); |
- const SkXfermode* xfermode = paint.getXfermode(); |
- if (xfermode != defaultPaint.getXfermode()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kXfermode, %p}, ", xfermode); |
- const SkMaskFilter* maskFilter = paint.getMaskFilter(); |
- if (maskFilter != defaultPaint.getMaskFilter()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kMaskFilter, %p}, ", maskFilter); |
- const SkColorFilter* colorFilter = paint.getColorFilter(); |
- if (colorFilter != defaultPaint.getColorFilter()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kColorFilter, %p}, ", colorFilter); |
- const SkRasterizer* rasterizer = paint.getRasterizer(); |
- if (rasterizer != defaultPaint.getRasterizer()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kRasterizer, %p}, ", rasterizer); |
- const SkDrawLooper* drawLooper = paint.getLooper(); |
- if (drawLooper != defaultPaint.getLooper()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kDrawLooper, %p}, ", drawLooper); |
- SkDebugf("%s{0}};\n", pBuffer); |
- bufferPtr = pBuffer; |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "PaintScalars paintScalars%p = {", &paint); |
- SkScalar textSize = paint.getTextSize(); |
- if (textSize != defaultPaint.getTextSize()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kTextSize, %g}, ", SkScalarToFloat(textSize)); |
- SkScalar textScaleX = paint.getTextScaleX(); |
- if (textScaleX != defaultPaint.getTextScaleX()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kTextScaleX, %g}, ", SkScalarToFloat(textScaleX)); |
- SkScalar textSkewX = paint.getTextSkewX(); |
- if (textSkewX != defaultPaint.getTextSkewX()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kTextSkewX, %g}, ", SkScalarToFloat(textSkewX)); |
- SkScalar strokeWidth = paint.getStrokeWidth(); |
- if (strokeWidth != defaultPaint.getStrokeWidth()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kStrokeWidth, %g}, ", SkScalarToFloat(strokeWidth)); |
- SkScalar strokeMiter = paint.getStrokeMiter(); |
- if (strokeMiter != defaultPaint.getStrokeMiter()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kStrokeMiter, %g}, ", SkScalarToFloat(strokeMiter)); |
- SkDebugf("%s{0}};\n", pBuffer); |
- bufferPtr = pBuffer; |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "PaintInts = paintInts%p = {", &paint); |
- unsigned color = paint.getColor(); |
- if (color != defaultPaint.getColor()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kColor, 0x%x}, ", color); |
- unsigned flags = paint.getFlags(); |
- if (flags != defaultPaint.getFlags()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kFlags, 0x%x}, ", flags); |
- int align = paint.getTextAlign(); |
- if (align != defaultPaint.getTextAlign()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kAlign, 0x%x}, ", align); |
- int strokeCap = paint.getStrokeCap(); |
- if (strokeCap != defaultPaint.getStrokeCap()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kStrokeCap, 0x%x}, ", strokeCap); |
- int strokeJoin = paint.getStrokeJoin(); |
- if (strokeJoin != defaultPaint.getStrokeJoin()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kAlign, 0x%x}, ", strokeJoin); |
- int style = paint.getStyle(); |
- if (style != defaultPaint.getStyle()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kStyle, 0x%x}, ", style); |
- int textEncoding = paint.getTextEncoding(); |
- if (textEncoding != defaultPaint.getTextEncoding()) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "{kTextEncoding, 0x%x}, ", textEncoding); |
- SkDebugf("%s{0}};\n", pBuffer); |
- |
- SkDebugf("PaintData paint%p = {paintPtrs%p, paintScalars%p, paintInts%p};\n", |
- &paint, &paint, &paint, &paint); |
-} |
- |
-void SkPictureData::dumpPath(const SkPath& path) const { |
- SkDebugf("path dump unimplemented\n"); |
-} |
- |
-void SkPictureData::dumpPicture(const SkPicture& picture) const { |
- SkDebugf("picture dump unimplemented\n"); |
-} |
- |
-void SkPictureData::dumpRegion(const SkRegion& region) const { |
- SkDebugf("region dump unimplemented\n"); |
-} |
- |
-int SkPictureData::dumpDrawType(char* bufferPtr, char* buffer, DrawType drawType) { |
- return snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - buffer), |
- "k%s, ", DrawTypeToString(drawType)); |
-} |
- |
-int SkPictureData::dumpInt(char* bufferPtr, char* buffer, char* name) { |
- return snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - buffer), |
- "%s:%d, ", name, getInt()); |
-} |
- |
-int SkPictureData::dumpRect(char* bufferPtr, char* buffer, char* name) { |
- const SkRect* rect = fReader.skipRect(); |
- return snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - buffer), |
- "%s:{l:%g t:%g r:%g b:%g}, ", name, SkScalarToFloat(rect.fLeft), |
- SkScalarToFloat(rect.fTop), |
- SkScalarToFloat(rect.fRight), SkScalarToFloat(rect.fBottom)); |
-} |
- |
-int SkPictureData::dumpPoint(char* bufferPtr, char* buffer, char* name) { |
- SkPoint pt; |
- getPoint(&pt); |
- return snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - buffer), |
- "%s:{x:%g y:%g}, ", name, SkScalarToFloat(pt.fX), |
- SkScalarToFloat(pt.fY)); |
-} |
- |
-void SkPictureData::dumpPointArray(char** bufferPtrPtr, char* buffer, int count) { |
- char* bufferPtr = *bufferPtrPtr; |
- const SkPoint* pts = (const SkPoint*)fReadStream.getAtPos(); |
- fReadStream.skip(sizeof(SkPoint) * count); |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - buffer), |
- "count:%d {", count); |
- for (int index = 0; index < count; index++) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - buffer), |
- "{x:%g y:%g}, ", SkScalarToFloat(pts[index].fX), |
- SkScalarToFloat(pts[index].fY)); |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - buffer), |
- "} "); |
- *bufferPtrPtr = bufferPtr; |
-} |
- |
-int SkPictureData::dumpPtr(char* bufferPtr, char* buffer, char* name, void* ptr) { |
- return snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - buffer), |
- "%s:%p, ", name, ptr); |
-} |
- |
-int SkPictureData::dumpRectPtr(char* bufferPtr, char* buffer, char* name) { |
- char result; |
- fReadStream.read(&result, sizeof(result)); |
- if (result) |
- return dumpRect(bufferPtr, buffer, name); |
- else |
- return snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - buffer), |
- "%s:NULL, ", name); |
-} |
- |
-int SkPictureData::dumpScalar(char* bufferPtr, char* buffer, char* name) { |
- return snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - buffer), |
- "%s:%d, ", name, getScalar()); |
-} |
-void SkPictureData::dumpText(char** bufferPtrPtr, char* buffer) { |
- char* bufferPtr = *bufferPtrPtr; |
- int length = getInt(); |
- bufferPtr += dumpDrawType(bufferPtr, buffer); |
- fReadStream.skipToAlign4(); |
- char* text = (char*) fReadStream.getAtPos(); |
- fReadStream.skip(length); |
- bufferPtr += dumpInt(bufferPtr, buffer, "length"); |
- int limit = DUMP_BUFFER_SIZE - (bufferPtr - buffer) - 2; |
- length >>= 1; |
- if (limit > length) |
- limit = length; |
- if (limit > 0) { |
- *bufferPtr++ = '"'; |
- for (int index = 0; index < limit; index++) { |
- *bufferPtr++ = *(unsigned short*) text; |
- text += sizeof(unsigned short); |
- } |
- *bufferPtr++ = '"'; |
- } |
- *bufferPtrPtr = bufferPtr; |
-} |
- |
-#define DUMP_DRAWTYPE(drawType) \ |
- bufferPtr += dumpDrawType(bufferPtr, buffer, drawType) |
- |
-#define DUMP_INT(name) \ |
- bufferPtr += dumpInt(bufferPtr, buffer, #name) |
- |
-#define DUMP_RECT_PTR(name) \ |
- bufferPtr += dumpRectPtr(bufferPtr, buffer, #name) |
- |
-#define DUMP_POINT(name) \ |
- bufferPtr += dumpRect(bufferPtr, buffer, #name) |
- |
-#define DUMP_RECT(name) \ |
- bufferPtr += dumpRect(bufferPtr, buffer, #name) |
- |
-#define DUMP_POINT_ARRAY(count) \ |
- dumpPointArray(&bufferPtr, buffer, count) |
- |
-#define DUMP_PTR(name, ptr) \ |
- bufferPtr += dumpPtr(bufferPtr, buffer, #name, (void*) ptr) |
- |
-#define DUMP_SCALAR(name) \ |
- bufferPtr += dumpScalar(bufferPtr, buffer, #name) |
- |
-#define DUMP_TEXT() \ |
- dumpText(&bufferPtr, buffer) |
- |
-void SkPictureData::dumpStream() { |
- SkDebugf("RecordStream stream = {\n"); |
- DrawType drawType; |
- fReadStream.rewind(); |
- char buffer[DUMP_BUFFER_SIZE], * bufferPtr; |
- while (fReadStream.read(&drawType, sizeof(drawType))) { |
- bufferPtr = buffer; |
- DUMP_DRAWTYPE(drawType); |
- switch (drawType) { |
- case CLIP_PATH: { |
- DUMP_PTR(SkPath, &getPath()); |
- DUMP_INT(SkRegion::Op); |
- DUMP_INT(offsetToRestore); |
- } break; |
- case CLIP_REGION: { |
- DUMP_INT(SkRegion::Op); |
- DUMP_INT(offsetToRestore); |
- } break; |
- case CLIP_RECT: { |
- DUMP_RECT(rect); |
- DUMP_INT(SkRegion::Op); |
- DUMP_INT(offsetToRestore); |
- } break; |
- case CONCAT: |
- break; |
- case DRAW_BITMAP: { |
- DUMP_PTR(SkPaint, getPaint()); |
- DUMP_PTR(SkBitmap, &getBitmap()); |
- DUMP_SCALAR(left); |
- DUMP_SCALAR(top); |
- } break; |
- case DRAW_PAINT: |
- DUMP_PTR(SkPaint, getPaint()); |
- break; |
- case DRAW_PATH: { |
- DUMP_PTR(SkPaint, getPaint()); |
- DUMP_PTR(SkPath, &getPath()); |
- } break; |
- case DRAW_PICTURE: { |
- DUMP_PTR(SkPicture, &getPicture()); |
- } break; |
- case DRAW_POINTS: { |
- DUMP_PTR(SkPaint, getPaint()); |
- (void)getInt(); // PointMode |
- size_t count = getInt(); |
- fReadStream.skipToAlign4(); |
- DUMP_POINT_ARRAY(count); |
- } break; |
- case DRAW_POS_TEXT: { |
- DUMP_PTR(SkPaint, getPaint()); |
- DUMP_TEXT(); |
- size_t points = getInt(); |
- fReadStream.skipToAlign4(); |
- DUMP_POINT_ARRAY(points); |
- } break; |
- case DRAW_POS_TEXT_H: { |
- DUMP_PTR(SkPaint, getPaint()); |
- DUMP_TEXT(); |
- size_t points = getInt(); |
- fReadStream.skipToAlign4(); |
- DUMP_SCALAR(top); |
- DUMP_SCALAR(bottom); |
- DUMP_SCALAR(constY); |
- DUMP_POINT_ARRAY(points); |
- } break; |
- case DRAW_RECT: { |
- DUMP_PTR(SkPaint, getPaint()); |
- DUMP_RECT(rect); |
- } break; |
- case DRAW_SPRITE: { |
- DUMP_PTR(SkPaint, getPaint()); |
- DUMP_PTR(SkBitmap, &getBitmap()); |
- DUMP_SCALAR(left); |
- DUMP_SCALAR(top); |
- } break; |
- case DRAW_TEXT: { |
- DUMP_PTR(SkPaint, getPaint()); |
- DUMP_TEXT(); |
- DUMP_SCALAR(x); |
- DUMP_SCALAR(y); |
- } break; |
- case DRAW_TEXT_ON_PATH: { |
- DUMP_PTR(SkPaint, getPaint()); |
- DUMP_TEXT(); |
- DUMP_PTR(SkPath, &getPath()); |
- } break; |
- case RESTORE: |
- break; |
- case ROTATE: |
- DUMP_SCALAR(rotate); |
- break; |
- case SAVE: |
- DUMP_INT(SkCanvas::SaveFlags); |
- break; |
- case SAVE_LAYER: { |
- DUMP_RECT_PTR(layer); |
- DUMP_PTR(SkPaint, getPaint()); |
- DUMP_INT(SkCanvas::SaveFlags); |
- } break; |
- case SCALE: { |
- DUMP_SCALAR(sx); |
- DUMP_SCALAR(sy); |
- } break; |
- case SKEW: { |
- DUMP_SCALAR(sx); |
- DUMP_SCALAR(sy); |
- } break; |
- case TRANSLATE: { |
- DUMP_SCALAR(dx); |
- DUMP_SCALAR(dy); |
- } break; |
- default: |
- SkASSERT(0); |
- } |
- SkDebugf("%s\n", buffer); |
- } |
-} |
- |
-void SkPictureData::dump() const { |
- char pBuffer[DUMP_BUFFER_SIZE]; |
- char* bufferPtr = pBuffer; |
- int index; |
- if (fBitmapCount > 0) |
- SkDebugf("// bitmaps (%d)\n", fBitmapCount); |
- for (index = 0; index < fBitmapCount; index++) { |
- const SkBitmap& bitmap = fBitmaps[index]; |
- dumpBitmap(bitmap); |
- } |
- if (fBitmapCount > 0) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "Bitmaps bitmaps = {"); |
- for (index = 0; index < fBitmapCount; index++) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "bitmap%p, ", &fBitmaps[index]); |
- if (fBitmapCount > 0) |
- SkDebugf("%s0};\n", pBuffer); |
- |
- |
- if (fPaintCount > 0) |
- SkDebugf("// paints (%d)\n", fPaintCount); |
- for (index = 0; index < fPaintCount; index++) { |
- const SkPaint& paint = fPaints[index]; |
- dumpPaint(paint); |
- } |
- bufferPtr = pBuffer; |
- if (fPaintCount > 0) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "Paints paints = {"); |
- for (index = 0; index < fPaintCount; index++) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "paint%p, ", &fPaints[index]); |
- if (fPaintCount > 0) |
- SkDebugf("%s0};\n", pBuffer); |
- |
- for (index = 0; index < fPathCount; index++) { |
- const SkPath& path = fPaths[index]; |
- dumpPath(path); |
- } |
- bufferPtr = pBuffer; |
- if (fPathCount > 0) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "Paths paths = {"); |
- for (index = 0; index < fPathCount; index++) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "path%p, ", &fPaths[index]); |
- if (fPathCount > 0) |
- SkDebugf("%s0};\n", pBuffer); |
- |
- for (index = 0; index < fPictureCount; index++) { |
- dumpPicture(*fPictureRefs[index]); |
- } |
- bufferPtr = pBuffer; |
- if (fPictureCount > 0) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "Pictures pictures = {"); |
- for (index = 0; index < fPictureCount; index++) |
- bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer), |
- "picture%p, ", fPictureRefs[index]); |
- if (fPictureCount > 0) |
- SkDebugf("%s0};\n", pBuffer); |
- |
- const_cast<SkPictureData*>(this)->dumpStream(); |
-} |
- |
-#endif |