Chromium Code Reviews| Index: src/core/SkRecords.h |
| diff --git a/src/core/SkRecords.h b/src/core/SkRecords.h |
| index c1c5596b1585c1719f789dd075f8f76b614156a1..c06d276cfaa2e4a6a3ce4835030a41f785e9cc81 100644 |
| --- a/src/core/SkRecords.h |
| +++ b/src/core/SkRecords.h |
| @@ -118,17 +118,15 @@ struct T { \ |
| A a; B b; C c; D d; E e; \ |
| }; |
| -#define ACT_AS_PTR(ptr) \ |
| - operator T*() { return ptr; } \ |
|
tfarina
2014/09/18 17:35:43
why not keep non-const and const versions?
it see
mtklein
2014/09/18 17:52:38
Mostly this is because it is inconvenient to use t
|
| - 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(SkRef(obj)) {} |
| - ~RefBox() { fObj->unref(); } |
| + RefBox(T* obj) : fObj(SkSafeRef(obj)) {} |
| + ~RefBox() { SkSafeUnref(fObj); } |
| ACT_AS_PTR(fObj); |
| @@ -239,7 +237,6 @@ RECORD3(DrawDRRect, SkPaint, paint, SkRRect, outer, SkRRect, inner); |
| RECORD2(DrawOval, SkPaint, paint, SkRect, oval); |
| RECORD1(DrawPaint, SkPaint, paint); |
| RECORD2(DrawPath, SkPaint, paint, SkPath, path); |
| -//RECORD2(DrawPatch, SkPaint, paint, SkPatch, patch); |
| RECORD3(DrawPicture, Optional<SkPaint>, paint, |
| RefBox<const SkPicture>, picture, |
| Optional<SkMatrix>, matrix); |
| @@ -273,6 +270,12 @@ RECORD5(DrawTextOnPath, SkPaint, paint, |
| 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; |
| @@ -307,24 +310,6 @@ struct DrawVertices { |
| int indexCount; |
| }; |
| -struct DrawPatch { |
| - static const Type kType = DrawPatch_Type; |
| - |
| - DrawPatch(const SkPaint& paint, SkPoint cubics[12], SkColor colors[4], |
| - SkPoint texCoords[4], SkXfermode* xmode) |
| - : paint(paint) |
| - , cubics(cubics) |
| - , colors(colors) |
| - , texCoords(texCoords) |
| - , xmode(SkSafeRef(xmode)) { } |
| - |
| - SkPaint paint; |
| - PODArray<SkPoint> cubics; |
| - PODArray<SkColor> colors; |
| - PODArray<SkPoint> texCoords; |
| - SkAutoTUnref<SkXfermode> xmode; |
| -}; |
| - |
| #undef RECORD0 |
| #undef RECORD1 |
| #undef RECORD2 |