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,44 +115,27 @@ |
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). |
robertphillips
2013/03/08 20:40:04
Ignore if you want, I would have the two return va
Justin Novosad
2013/03/08 22:35:42
Done.
|
* Returns the start offset of the chunk. This is the location at which |
* the opcode & size are stored. |
+ * Bounds are recorded in device space, if canRecordBounds(drawType) |
+ * returns true; |
* TODO: since we are handing the size into here we could call reserve |
* and then return a pointer to the memory storage. This could decrease |
* allocation overhead but could lead to more wasted space (the tail |
* 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); |
} |