| OLD | NEW |
| 1 #ifndef SkRecorder_DEFINED | 1 #ifndef SkRecorder_DEFINED |
| 2 #define SkRecorder_DEFINED | 2 #define SkRecorder_DEFINED |
| 3 | 3 |
| 4 #include "SkCanvas.h" | 4 #include "SkCanvas.h" |
| 5 #include "SkRecord.h" | 5 #include "SkRecord.h" |
| 6 #include "SkRecords.h" | 6 #include "SkRecords.h" |
| 7 | 7 |
| 8 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. | 8 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. |
| 9 | 9 |
| 10 class SkRecorder : public SkCanvas { | 10 class SkRecorder : public SkCanvas { |
| 11 public: | 11 public: |
| 12 // SkRecorder can work in two modes: |
| 13 // write-only: only a core subset of SkCanvas operations (save/restore, cl
ip, transform, draw) |
| 14 // are supported, and all of the readback methods on SkCanvas will probabl
y fail or lie. |
| 15 // |
| 16 // read-write: all methods should behave with similar semantics to SkCanva
s. |
| 17 // |
| 18 // Write-only averages 10-20% faster, but you can't sensibly inspect the can
vas while recording. |
| 19 enum Mode { kWriteOnly_Mode, kReadWrite_Mode }; |
| 20 |
| 12 // Does not take ownership of the SkRecord. | 21 // Does not take ownership of the SkRecord. |
| 13 SkRecorder(SkRecord*, int width, int height); | 22 SkRecorder(Mode mode, SkRecord*, int width, int height); |
| 14 | 23 |
| 15 void clear(SkColor) SK_OVERRIDE; | 24 void clear(SkColor) SK_OVERRIDE; |
| 16 void drawPaint(const SkPaint& paint) SK_OVERRIDE; | 25 void drawPaint(const SkPaint& paint) SK_OVERRIDE; |
| 17 void drawPoints(PointMode mode, | 26 void drawPoints(PointMode mode, |
| 18 size_t count, | 27 size_t count, |
| 19 const SkPoint pts[], | 28 const SkPoint pts[], |
| 20 const SkPaint& paint) SK_OVERRIDE; | 29 const SkPaint& paint) SK_OVERRIDE; |
| 21 void drawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE; | 30 void drawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE; |
| 22 void drawOval(const SkRect& oval, const SkPaint&) SK_OVERRIDE; | 31 void drawOval(const SkRect& oval, const SkPaint&) SK_OVERRIDE; |
| 23 void drawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRIDE; | 32 void drawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRIDE; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 void onPushCull(const SkRect& cullRect) SK_OVERRIDE; | 97 void onPushCull(const SkRect& cullRect) SK_OVERRIDE; |
| 89 void onPopCull() SK_OVERRIDE; | 98 void onPopCull() SK_OVERRIDE; |
| 90 | 99 |
| 91 private: | 100 private: |
| 92 template <typename T> | 101 template <typename T> |
| 93 T* copy(const T*); | 102 T* copy(const T*); |
| 94 | 103 |
| 95 template <typename T> | 104 template <typename T> |
| 96 T* copy(const T[], unsigned count); | 105 T* copy(const T[], unsigned count); |
| 97 | 106 |
| 107 const Mode fMode; |
| 98 SkRecord* fRecord; | 108 SkRecord* fRecord; |
| 99 }; | 109 }; |
| 100 | 110 |
| 101 #endif//SkRecorder_DEFINED | 111 #endif//SkRecorder_DEFINED |
| OLD | NEW |