#define SkRecords_DEFINED
#include "SkCanvas.h"
+#include "SkPicture.h"
+#include "SkTextBlob.h"
namespace SkRecords {
M(SaveLayer) \
M(PushCull) \
M(PopCull) \
- M(PairedPushCull) /*From SkRecordAnnotateCullingPairs*/ \
- M(Concat) \
M(SetMatrix) \
M(ClipPath) \
M(ClipRRect) \
M(ClipRect) \
M(ClipRegion) \
M(Clear) \
+ M(BeginCommentGroup) \
+ M(AddComment) \
+ M(EndCommentGroup) \
M(DrawBitmap) \
M(DrawBitmapMatrix) \
M(DrawBitmapNine) \
M(DrawOval) \
M(DrawPaint) \
M(DrawPath) \
+ M(DrawPatch) \
+ M(DrawPicture) \
M(DrawPoints) \
M(DrawPosText) \
M(DrawPosTextH) \
+ M(DrawText) \
+ M(DrawTextOnPath) \
M(DrawRRect) \
M(DrawRect) \
M(DrawSprite) \
- M(DrawText) \
- M(DrawTextOnPath) \
- M(DrawVertices) \
- M(BoundedDrawPosTextH) /*From SkRecordBoundDrawPosTextH*/
+ M(DrawTextBlob) \
+ M(DrawData) \
+ M(DrawVertices)
// Defines SkRecords::Type, an enum of all record types.
#define ENUM(T) T##_Type,
A a; B b; C c; D d; E e; \
};
-#define ACT_AS_PTR(ptr) \
- operator T*() { return ptr; } \
- operator const T*() const { return ptr; } \
- T* operator->() { return ptr; } \
- const T* operator->() const { return ptr; }
+#define ACT_AS_PTR(ptr) \
+ operator T*() const { return ptr; } \
+ T* operator->() const { return ptr; }
+
+template <typename T>
+class RefBox : SkNoncopyable {
+public:
+ RefBox(T* obj) : fObj(SkSafeRef(obj)) {}
+ ~RefBox() { SkSafeUnref(fObj); }
+
+ ACT_AS_PTR(fObj);
+
+private:
+ T* fObj;
+};
// An Optional doesn't own the pointer's memory, but may need to destroy non-POD data.
template <typename T>
// Like SkBitmap, but deep copies pixels if they're not immutable.
// Using this, we guarantee the immutability of all bitmaps we record.
-class ImmutableBitmap {
+class ImmutableBitmap : SkNoncopyable {
public:
explicit ImmutableBitmap(const SkBitmap& bitmap) {
if (bitmap.isImmutable()) {
RECORD0(NoOp);
-RECORD0(Restore);
-RECORD1(Save, SkCanvas::SaveFlags, flags);
+RECORD2(Restore, SkIRect, devBounds, SkMatrix, matrix);
+RECORD0(Save);
RECORD3(SaveLayer, Optional<SkRect>, bounds, Optional<SkPaint>, paint, SkCanvas::SaveFlags, flags);
RECORD1(PushCull, SkRect, rect);
RECORD0(PopCull);
-RECORD1(Concat, SkMatrix, matrix);
RECORD1(SetMatrix, SkMatrix, matrix);
-RECORD3(ClipPath, SkPath, path, SkRegion::Op, op, bool, doAA);
-RECORD3(ClipRRect, SkRRect, rrect, SkRegion::Op, op, bool, doAA);
-RECORD3(ClipRect, SkRect, rect, SkRegion::Op, op, bool, doAA);
-RECORD2(ClipRegion, SkRegion, region, SkRegion::Op, op);
+RECORD4(ClipPath, SkIRect, devBounds, SkPath, path, SkRegion::Op, op, bool, doAA);
+RECORD4(ClipRRect, SkIRect, devBounds, SkRRect, rrect, SkRegion::Op, op, bool, doAA);
+RECORD4(ClipRect, SkIRect, devBounds, SkRect, rect, SkRegion::Op, op, bool, doAA);
+RECORD3(ClipRegion, SkIRect, devBounds, SkRegion, region, SkRegion::Op, op);
RECORD1(Clear, SkColor, color);
+
+RECORD1(BeginCommentGroup, PODArray<char>, description);
+RECORD2(AddComment, PODArray<char>, key, PODArray<char>, value);
+RECORD0(EndCommentGroup);
+
// While not strictly required, if you have an SkPaint, it's fastest to put it first.
RECORD4(DrawBitmap, Optional<SkPaint>, paint,
ImmutableBitmap, bitmap,
RECORD2(DrawOval, SkPaint, paint, SkRect, oval);
RECORD1(DrawPaint, SkPaint, paint);
RECORD2(DrawPath, SkPaint, paint, SkPath, path);
+RECORD3(DrawPicture, Optional<SkPaint>, paint,
+ RefBox<const SkPicture>, picture,
+ Optional<SkMatrix>, matrix);
RECORD4(DrawPoints, SkPaint, paint, SkCanvas::PointMode, mode, size_t, count, SkPoint*, pts);
RECORD4(DrawPosText, SkPaint, paint,
PODArray<char>, text,
size_t, byteLength,
SkScalar, x,
SkScalar, y);
+RECORD4(DrawTextBlob, SkPaint, paint,
+ RefBox<const SkTextBlob>, blob,
+ SkScalar, x,
+ SkScalar, y);
RECORD5(DrawTextOnPath, SkPaint, paint,
PODArray<char>, text,
size_t, byteLength,
SkPath, path,
Optional<SkMatrix>, matrix);
+RECORD2(DrawData, PODArray<char>, data, size_t, length);
+
+RECORD5(DrawPatch, SkPaint, paint,
+ PODArray<SkPoint>, cubics,
+ PODArray<SkColor>, colors,
+ PODArray<SkPoint>, texCoords,
+ RefBox<SkXfermode>, xmode);
+
// This guy is so ugly we just write it manually.
struct DrawVertices {
static const Type kType = DrawVertices_Type;
int indexCount;
};
-// Records added by optimizations.
-RECORD2(PairedPushCull, Adopted<PushCull>, base, unsigned, skip);
-RECORD3(BoundedDrawPosTextH, Adopted<DrawPosTextH>, base, SkScalar, minY, SkScalar, maxY);
-
#undef RECORD0
#undef RECORD1
#undef RECORD2