Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(631)

Side by Side Diff: src/core/SkRecorder.h

Issue 1130283004: Revert of Sketch splitting SkPicture into an interface and SkBigPicture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkRecordDraw.cpp ('k') | src/core/SkRecorder.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
12 #include "SkCanvas.h" 11 #include "SkCanvas.h"
13 #include "SkMiniRecorder.h"
14 #include "SkRecord.h" 12 #include "SkRecord.h"
15 #include "SkRecords.h" 13 #include "SkRecords.h"
16 #include "SkTDArray.h" 14 #include "SkTDArray.h"
17 15
18 class SkBBHFactory; 16 class SkBBHFactory;
19 17
20 class SkDrawableList : SkNoncopyable { 18 class SkDrawableList : SkNoncopyable {
21 public: 19 public:
22 ~SkDrawableList(); 20 ~SkDrawableList();
23 21
24 int count() const { return fArray.count(); } 22 int count() const { return fArray.count(); }
25 SkDrawable* const* begin() const { return fArray.begin(); } 23 SkDrawable* const* begin() const { return fArray.begin(); }
26 24
27 void append(SkDrawable* drawable); 25 void append(SkDrawable* drawable);
28 26
29 // 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.
30 SkBigPicture::SnapshotArray* newDrawableSnapshot(); 28 SkPicture::SnapshotArray* newDrawableSnapshot();
31 29
32 private: 30 private:
33 SkTDArray<SkDrawable*> fArray; 31 SkTDArray<SkDrawable*> fArray;
34 }; 32 };
35 33
36 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. 34 // SkRecorder provides an SkCanvas interface for recording into an SkRecord.
37 35
38 class SkRecorder : public SkCanvas { 36 class SkRecorder : public SkCanvas {
39 public: 37 public:
40 // Does not take ownership of the SkRecord. 38 // Does not take ownership of the SkRecord.
41 SkRecorder(SkRecord*, int width, int height, SkMiniRecorder* = nullptr); / / legacy version 39 SkRecorder(SkRecord*, int width, int height); // legacy version
42 SkRecorder(SkRecord*, const SkRect& bounds, SkMiniRecorder* = nullptr); 40 SkRecorder(SkRecord*, const SkRect& bounds);
43 41
44 void reset(SkRecord*, const SkRect& bounds, SkMiniRecorder* = nullptr); 42 void reset(SkRecord*, const SkRect& bounds);
45 43
46 size_t approxBytesUsedBySubPictures() const { return fApproxBytesUsedBySubPi ctures; } 44 size_t approxBytesUsedBySubPictures() const { return fApproxBytesUsedBySubPi ctures; }
47 45
48 SkDrawableList* getDrawableList() const { return fDrawableList.get(); } 46 SkDrawableList* getDrawableList() const { return fDrawableList.get(); }
49 SkDrawableList* detachDrawableList() { return fDrawableList.detach(); } 47 SkDrawableList* detachDrawableList() { return fDrawableList.detach(); }
50 48
51 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor der will fail. 49 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor der will fail.
52 void forgetRecord(); 50 void forgetRecord();
53 51
54 void willSave() override; 52 void willSave() override;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) override; 113 void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) override;
116 114
117 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri de; 115 void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) overri de;
118 116
119 void beginCommentGroup(const char*) override; 117 void beginCommentGroup(const char*) override;
120 void addComment(const char*, const char*) override; 118 void addComment(const char*, const char*) override;
121 void endCommentGroup() override; 119 void endCommentGroup() override;
122 120
123 SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override { return NULL; } 121 SkSurface* onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override { return NULL; }
124 122
125 void flushMiniRecorder();
126
127 private: 123 private:
128 template <typename T> 124 template <typename T>
129 T* copy(const T*); 125 T* copy(const T*);
130 126
131 template <typename T> 127 template <typename T>
132 T* copy(const T[], size_t count); 128 T* copy(const T[], size_t count);
133 129
134 SkIRect devBounds() const { 130 SkIRect devBounds() const {
135 SkIRect devBounds; 131 SkIRect devBounds;
136 this->getClipDeviceBounds(&devBounds); 132 this->getClipDeviceBounds(&devBounds);
137 return devBounds; 133 return devBounds;
138 } 134 }
139 135
140 size_t fApproxBytesUsedBySubPictures; 136 size_t fApproxBytesUsedBySubPictures;
141 SkRecord* fRecord; 137 SkRecord* fRecord;
142 SkAutoTDelete<SkDrawableList> fDrawableList; 138 SkAutoTDelete<SkDrawableList> fDrawableList;
143
144 SkMiniRecorder* fMiniRecorder;
145 }; 139 };
146 140
147 #endif//SkRecorder_DEFINED 141 #endif//SkRecorder_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkRecordDraw.cpp ('k') | src/core/SkRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698