OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef SkRecorder_DEFINED | 8 #ifndef SkRecorder_DEFINED |
9 #define SkRecorder_DEFINED | 9 #define SkRecorder_DEFINED |
10 | 10 |
11 #include "SkCanvas.h" | 11 #include "SkCanvas.h" |
12 #include "SkRecord.h" | 12 #include "SkRecord.h" |
13 #include "SkRecords.h" | 13 #include "SkRecords.h" |
14 #include "SkTDArray.h" | 14 #include "SkTDArray.h" |
15 | 15 |
16 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. | 16 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. |
17 | 17 |
18 class SkRecorder : public SkCanvas { | 18 class SkRecorder : public SkCanvas { |
19 public: | 19 public: |
20 // Does not take ownership of the SkRecord. | 20 // Does not take ownership of the SkRecord. |
21 SkRecorder(SkRecord*, int width, int height); | 21 SkRecorder(SkRecord*, int width, int height); |
| 22 virtual ~SkRecorder() SK_OVERRIDE; |
| 23 |
| 24 // return a (new or ref'd) data containing the array of pictures that were |
| 25 // snapped from our drawables. |
| 26 SkData* newDrawableSnapshot(SkBBHFactory*, uint32_t recordFlags); |
22 | 27 |
23 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor
der will fail. | 28 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor
der will fail. |
24 void forgetRecord(); | 29 void forgetRecord(); |
25 | 30 |
26 void clear(SkColor) SK_OVERRIDE; | 31 void clear(SkColor) SK_OVERRIDE; |
27 void drawPaint(const SkPaint& paint) SK_OVERRIDE; | 32 void drawPaint(const SkPaint& paint) SK_OVERRIDE; |
28 void drawPoints(PointMode mode, | 33 void drawPoints(PointMode mode, |
29 size_t count, | 34 size_t count, |
30 const SkPoint pts[], | 35 const SkPoint pts[], |
31 const SkPaint& paint) SK_OVERRIDE; | 36 const SkPaint& paint) SK_OVERRIDE; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 | 75 |
71 void willSave() SK_OVERRIDE; | 76 void willSave() SK_OVERRIDE; |
72 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SkCanvas::Sav
eFlags) SK_OVERRIDE; | 77 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SkCanvas::Sav
eFlags) SK_OVERRIDE; |
73 void willRestore() SK_OVERRIDE {} | 78 void willRestore() SK_OVERRIDE {} |
74 void didRestore() SK_OVERRIDE; | 79 void didRestore() SK_OVERRIDE; |
75 | 80 |
76 void didConcat(const SkMatrix&) SK_OVERRIDE; | 81 void didConcat(const SkMatrix&) SK_OVERRIDE; |
77 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; | 82 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; |
78 | 83 |
79 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID
E; | 84 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID
E; |
| 85 void onDrawDrawable(SkCanvasDrawable*) SK_OVERRIDE; |
80 void onDrawText(const void* text, | 86 void onDrawText(const void* text, |
81 size_t byteLength, | 87 size_t byteLength, |
82 SkScalar x, | 88 SkScalar x, |
83 SkScalar y, | 89 SkScalar y, |
84 const SkPaint& paint) SK_OVERRIDE; | 90 const SkPaint& paint) SK_OVERRIDE; |
85 void onDrawPosText(const void* text, | 91 void onDrawPosText(const void* text, |
86 size_t byteLength, | 92 size_t byteLength, |
87 const SkPoint pos[], | 93 const SkPoint pos[], |
88 const SkPaint& paint) SK_OVERRIDE; | 94 const SkPaint& paint) SK_OVERRIDE; |
89 void onDrawPosTextH(const void* text, | 95 void onDrawPosTextH(const void* text, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 SkIRect devBounds() const { | 138 SkIRect devBounds() const { |
133 SkIRect devBounds; | 139 SkIRect devBounds; |
134 this->getClipDeviceBounds(&devBounds); | 140 this->getClipDeviceBounds(&devBounds); |
135 return devBounds; | 141 return devBounds; |
136 } | 142 } |
137 | 143 |
138 SkRecord* fRecord; | 144 SkRecord* fRecord; |
139 | 145 |
140 int fSaveLayerCount; | 146 int fSaveLayerCount; |
141 SkTDArray<SkBool8> fSaveIsSaveLayer; | 147 SkTDArray<SkBool8> fSaveIsSaveLayer; |
| 148 SkTDArray<SkCanvasDrawable*> fDrawableList; |
142 }; | 149 }; |
143 | 150 |
144 #endif//SkRecorder_DEFINED | 151 #endif//SkRecorder_DEFINED |
OLD | NEW |