| Index: src/core/SkPictureRecord.h
|
| ===================================================================
|
| --- src/core/SkPictureRecord.h (revision 8043)
|
| +++ src/core/SkPictureRecord.h (working copy)
|
| @@ -16,6 +16,8 @@
|
| #include "SkTemplates.h"
|
| #include "SkWriter32.h"
|
|
|
| +#define SK_RECORD_BOUNDS_IN_PICTURE 0
|
| +
|
| class SkPictureStateTree;
|
| class SkBBoxHierarchy;
|
|
|
| @@ -84,8 +86,10 @@
|
| virtual void drawData(const void*, size_t) SK_OVERRIDE;
|
| virtual bool isDrawingToLayer() const SK_OVERRIDE;
|
|
|
| +#if !(SK_RECORD_BOUNDS_IN_PICTURE)
|
| void addFontMetricsTopBottom(const SkPaint& paint, const SkFlatData&,
|
| SkScalar minY, SkScalar maxY);
|
| +#endif
|
|
|
| const SkTDArray<SkPicture* >& getPictureRefs() const {
|
| return fPictureRefs;
|
| @@ -102,6 +106,7 @@
|
| void beginRecording();
|
| void endRecording();
|
|
|
| + static bool canRecordBounds(DrawType op);
|
| private:
|
| void recordRestoreOffsetPlaceholder(SkRegion::Op);
|
| void fillRestoreOffsetPlaceholdersForCurrentStackLevel(
|
| @@ -110,13 +115,16 @@
|
| SkTDArray<int32_t> fRestoreOffsetStack;
|
| int fFirstSavedLayerIndex;
|
| enum {
|
| - kNoSavedLayerIndex = -1
|
| + kNoSavedLayerIndex = -1,
|
| };
|
| + static const uint32_t kInvalidOffset = ~0;
|
|
|
| /*
|
| - * Write the 'drawType' operation and chunk size to the skp. 'size'
|
| - * can potentially be increased if the chunk size needs its own storage
|
| - * location (i.e., it overflows 24 bits).
|
| + * Write the 'drawType' operation, chunk size and optionally the draw
|
| + * bounds to the skp. 'size' can potentially be increased if the chunk
|
| + * size needs its own storage location (i.e., it overflows 24 bits).
|
| + * Bounds are recorded in device space, if canRecordBounds(drawType)
|
| + * returns true;
|
| * Returns the start offset of the chunk. This is the location at which
|
| * the opcode & size are stored.
|
| * TODO: since we are handing the size into here we could call reserve
|
| @@ -125,29 +133,9 @@
|
| * end of blocks could go unused). Possibly add a second addDraw that
|
| * operates in this manner.
|
| */
|
| - uint32_t addDraw(DrawType drawType, uint32_t* size) {
|
| - uint32_t offset = fWriter.size();
|
| + uint32_t addDraw(DrawType drawType, uint32_t* size, const SkPaint* paint = NULL,
|
| + const SkRect* localBounds = NULL);
|
|
|
| - this->predrawNotify();
|
| -
|
| - #ifdef SK_DEBUG_TRACE
|
| - SkDebugf("add %s\n", DrawTypeToString(drawType));
|
| - #endif
|
| -
|
| - SkASSERT(0 != *size);
|
| - SkASSERT(((uint8_t) drawType) == drawType);
|
| -
|
| - if (0 != (*size & ~MASK_24) || *size == MASK_24) {
|
| - fWriter.writeInt(PACK_8_24(drawType, MASK_24));
|
| - *size += 1;
|
| - fWriter.writeInt(*size);
|
| - } else {
|
| - fWriter.writeInt(PACK_8_24(drawType, *size));
|
| - }
|
| -
|
| - return offset;
|
| - }
|
| -
|
| void addInt(int value) {
|
| fWriter.writeInt(value);
|
| }
|
|
|