| 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 "SkBigPicture.h" |
| 11 #include "SkCanvas.h" | 12 #include "SkCanvas.h" |
| 13 #include "SkMiniRecorder.h" |
| 12 #include "SkRecord.h" | 14 #include "SkRecord.h" |
| 13 #include "SkRecords.h" | 15 #include "SkRecords.h" |
| 14 #include "SkTDArray.h" | 16 #include "SkTDArray.h" |
| 15 | 17 |
| 16 class SkBBHFactory; | 18 class SkBBHFactory; |
| 17 | 19 |
| 18 class SkDrawableList : SkNoncopyable { | 20 class SkDrawableList : SkNoncopyable { |
| 19 public: | 21 public: |
| 20 ~SkDrawableList(); | 22 ~SkDrawableList(); |
| 21 | 23 |
| 22 int count() const { return fArray.count(); } | 24 int count() const { return fArray.count(); } |
| 23 SkDrawable* const* begin() const { return fArray.begin(); } | 25 SkDrawable* const* begin() const { return fArray.begin(); } |
| 24 | 26 |
| 25 void append(SkDrawable* drawable); | 27 void append(SkDrawable* drawable); |
| 26 | 28 |
| 27 // Return a new or ref'd array of pictures that were snapped from our drawab
les. | 29 // Return a new or ref'd array of pictures that were snapped from our drawab
les. |
| 28 SkPicture::SnapshotArray* newDrawableSnapshot(); | 30 SkBigPicture::SnapshotArray* newDrawableSnapshot(); |
| 29 | 31 |
| 30 private: | 32 private: |
| 31 SkTDArray<SkDrawable*> fArray; | 33 SkTDArray<SkDrawable*> fArray; |
| 32 }; | 34 }; |
| 33 | 35 |
| 34 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. | 36 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. |
| 35 | 37 |
| 36 class SkRecorder : public SkCanvas { | 38 class SkRecorder : public SkCanvas { |
| 37 public: | 39 public: |
| 38 // Does not take ownership of the SkRecord. | 40 // Does not take ownership of the SkRecord. |
| 39 SkRecorder(SkRecord*, int width, int height); // legacy version | 41 SkRecorder(SkRecord*, int width, int height, SkMiniRecorder* = nullptr); /
/ legacy version |
| 40 SkRecorder(SkRecord*, const SkRect& bounds); | 42 SkRecorder(SkRecord*, const SkRect& bounds, SkMiniRecorder* = nullptr); |
| 41 | 43 |
| 42 void reset(SkRecord*, const SkRect& bounds); | 44 void reset(SkRecord*, const SkRect& bounds, SkMiniRecorder* = nullptr); |
| 43 | 45 |
| 44 size_t approxBytesUsedBySubPictures() const { return fApproxBytesUsedBySubPi
ctures; } | 46 size_t approxBytesUsedBySubPictures() const { return fApproxBytesUsedBySubPi
ctures; } |
| 45 | 47 |
| 46 SkDrawableList* getDrawableList() const { return fDrawableList.get(); } | 48 SkDrawableList* getDrawableList() const { return fDrawableList.get(); } |
| 47 SkDrawableList* detachDrawableList() { return fDrawableList.detach(); } | 49 SkDrawableList* detachDrawableList() { return fDrawableList.detach(); } |
| 48 | 50 |
| 49 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor
der will fail. | 51 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor
der will fail. |
| 50 void forgetRecord(); | 52 void forgetRecord(); |
| 51 | 53 |
| 52 void willSave() override; | 54 void willSave() override; |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) override; | 115 void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) override; |
| 114 | 116 |
| 115 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri
de; | 117 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri
de; |
| 116 | 118 |
| 117 void beginCommentGroup(const char*) override; | 119 void beginCommentGroup(const char*) override; |
| 118 void addComment(const char*, const char*) override; | 120 void addComment(const char*, const char*) override; |
| 119 void endCommentGroup() override; | 121 void endCommentGroup() override; |
| 120 | 122 |
| 121 SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override
{ return NULL; } | 123 SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override
{ return NULL; } |
| 122 | 124 |
| 125 void flushMiniRecorder(); |
| 126 |
| 123 private: | 127 private: |
| 124 template <typename T> | 128 template <typename T> |
| 125 T* copy(const T*); | 129 T* copy(const T*); |
| 126 | 130 |
| 127 template <typename T> | 131 template <typename T> |
| 128 T* copy(const T[], size_t count); | 132 T* copy(const T[], size_t count); |
| 129 | 133 |
| 130 SkIRect devBounds() const { | 134 SkIRect devBounds() const { |
| 131 SkIRect devBounds; | 135 SkIRect devBounds; |
| 132 this->getClipDeviceBounds(&devBounds); | 136 this->getClipDeviceBounds(&devBounds); |
| 133 return devBounds; | 137 return devBounds; |
| 134 } | 138 } |
| 135 | 139 |
| 136 size_t fApproxBytesUsedBySubPictures; | 140 size_t fApproxBytesUsedBySubPictures; |
| 137 SkRecord* fRecord; | 141 SkRecord* fRecord; |
| 138 SkAutoTDelete<SkDrawableList> fDrawableList; | 142 SkAutoTDelete<SkDrawableList> fDrawableList; |
| 143 |
| 144 SkMiniRecorder* fMiniRecorder; |
| 139 }; | 145 }; |
| 140 | 146 |
| 141 #endif//SkRecorder_DEFINED | 147 #endif//SkRecorder_DEFINED |
| OLD | NEW |