| 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 class SkBBHFactory; | 16 class SkBBHFactory; |
| 17 | 17 |
| 18 class SkCanvasDrawableList : SkNoncopyable { | 18 class SkDrawableList : SkNoncopyable { |
| 19 public: | 19 public: |
| 20 ~SkCanvasDrawableList(); | 20 ~SkDrawableList(); |
| 21 | 21 |
| 22 int count() const { return fArray.count(); } | 22 int count() const { return fArray.count(); } |
| 23 SkCanvasDrawable* const* begin() const { return fArray.begin(); } | 23 SkDrawable* const* begin() const { return fArray.begin(); } |
| 24 | 24 |
| 25 void append(SkCanvasDrawable* drawable); | 25 void append(SkDrawable* drawable); |
| 26 | 26 |
| 27 // Return a new or ref'd array of pictures that were snapped from our drawab
les. | 27 // Return a new or ref'd array of pictures that were snapped from our drawab
les. |
| 28 SkPicture::SnapshotArray* newDrawableSnapshot(); | 28 SkPicture::SnapshotArray* newDrawableSnapshot(); |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 SkTDArray<SkCanvasDrawable*> fArray; | 31 SkTDArray<SkDrawable*> fArray; |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. | 34 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. |
| 35 | 35 |
| 36 class SkRecorder : public SkCanvas { | 36 class SkRecorder : public SkCanvas { |
| 37 public: | 37 public: |
| 38 // Does not take ownership of the SkRecord. | 38 // Does not take ownership of the SkRecord. |
| 39 SkRecorder(SkRecord*, int width, int height); // legacy version | 39 SkRecorder(SkRecord*, int width, int height); // legacy version |
| 40 SkRecorder(SkRecord*, const SkRect& bounds); | 40 SkRecorder(SkRecord*, const SkRect& bounds); |
| 41 | 41 |
| 42 SkCanvasDrawableList* getDrawableList() const { return fDrawableList.get();
} | 42 SkDrawableList* getDrawableList() const { return fDrawableList.get(); } |
| 43 SkCanvasDrawableList* detachDrawableList() { return fDrawableList.detach();
} | 43 SkDrawableList* detachDrawableList() { return fDrawableList.detach(); } |
| 44 | 44 |
| 45 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor
der will fail. | 45 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor
der will fail. |
| 46 void forgetRecord(); | 46 void forgetRecord(); |
| 47 | 47 |
| 48 void willSave() SK_OVERRIDE; | 48 void willSave() SK_OVERRIDE; |
| 49 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SkCanvas::Sav
eFlags) SK_OVERRIDE; | 49 SaveLayerStrategy willSaveLayer(const SkRect*, const SkPaint*, SkCanvas::Sav
eFlags) SK_OVERRIDE; |
| 50 void willRestore() SK_OVERRIDE {} | 50 void willRestore() SK_OVERRIDE {} |
| 51 void didRestore() SK_OVERRIDE; | 51 void didRestore() SK_OVERRIDE; |
| 52 | 52 |
| 53 void didConcat(const SkMatrix&) SK_OVERRIDE; | 53 void didConcat(const SkMatrix&) SK_OVERRIDE; |
| 54 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; | 54 void didSetMatrix(const SkMatrix&) SK_OVERRIDE; |
| 55 | 55 |
| 56 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID
E; | 56 void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) SK_OVERRID
E; |
| 57 void onDrawDrawable(SkCanvasDrawable*) SK_OVERRIDE; | 57 void onDrawDrawable(SkDrawable*) SK_OVERRIDE; |
| 58 void onDrawText(const void* text, | 58 void onDrawText(const void* text, |
| 59 size_t byteLength, | 59 size_t byteLength, |
| 60 SkScalar x, | 60 SkScalar x, |
| 61 SkScalar y, | 61 SkScalar y, |
| 62 const SkPaint& paint) SK_OVERRIDE; | 62 const SkPaint& paint) SK_OVERRIDE; |
| 63 void onDrawPosText(const void* text, | 63 void onDrawPosText(const void* text, |
| 64 size_t byteLength, | 64 size_t byteLength, |
| 65 const SkPoint pos[], | 65 const SkPoint pos[], |
| 66 const SkPaint& paint) SK_OVERRIDE; | 66 const SkPaint& paint) SK_OVERRIDE; |
| 67 void onDrawPosTextH(const void* text, | 67 void onDrawPosTextH(const void* text, |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 T* copy(const T[], size_t count); | 124 T* copy(const T[], size_t count); |
| 125 | 125 |
| 126 SkIRect devBounds() const { | 126 SkIRect devBounds() const { |
| 127 SkIRect devBounds; | 127 SkIRect devBounds; |
| 128 this->getClipDeviceBounds(&devBounds); | 128 this->getClipDeviceBounds(&devBounds); |
| 129 return devBounds; | 129 return devBounds; |
| 130 } | 130 } |
| 131 | 131 |
| 132 SkRecord* fRecord; | 132 SkRecord* fRecord; |
| 133 | 133 |
| 134 SkAutoTDelete<SkCanvasDrawableList> fDrawableList; | 134 SkAutoTDelete<SkDrawableList> fDrawableList; |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 #endif//SkRecorder_DEFINED | 137 #endif//SkRecorder_DEFINED |
| OLD | NEW |