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

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

Issue 750723002: add endRecordingAsDrawable experiment (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: seems to work, TODO around immediate mode drawing Created 6 years, 1 month 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/SkRecord.h ('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 "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;
17
18 class SkCanvasDrawableList : SkNoncopyable {
19 public:
20 ~SkCanvasDrawableList();
21
22 int count() const { return fArray.count(); }
23 void append(SkCanvasDrawable* drawable);
24
25 // Return a new or ref'd array of pictures that were snapped from our drawab les.
26 SkPicture::SnapshotArray* newDrawableSnapshot();
27
28 private:
29 SkTDArray<SkCanvasDrawable*> fArray;
30 };
31
16 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. 32 // SkRecorder provides an SkCanvas interface for recording into an SkRecord.
17 33
18 class SkRecorder : public SkCanvas { 34 class SkRecorder : public SkCanvas {
19 public: 35 public:
20 // Does not take ownership of the SkRecord. 36 // Does not take ownership of the SkRecord.
21 SkRecorder(SkRecord*, int width, int height); // legacy version 37 SkRecorder(SkRecord*, int width, int height); // legacy version
22 SkRecorder(SkRecord*, const SkRect& bounds); 38 SkRecorder(SkRecord*, const SkRect& bounds);
23 virtual ~SkRecorder() SK_OVERRIDE;
24 39
25 // Return a new or ref'd array of pictures that were snapped from our drawab les. 40 SkCanvasDrawableList* detachDrawableList() {
41 return fDrawableList.detach();
42 }
43
26 SkPicture::SnapshotArray* newDrawableSnapshot(SkBBHFactory*, uint32_t record Flags); 44 SkPicture::SnapshotArray* newDrawableSnapshot(SkBBHFactory*, uint32_t record Flags);
27 45
28 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor der will fail. 46 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor der will fail.
29 void forgetRecord(); 47 void forgetRecord();
30 48
31 void clear(SkColor) SK_OVERRIDE; 49 void clear(SkColor) SK_OVERRIDE;
32 void drawPaint(const SkPaint& paint) SK_OVERRIDE; 50 void drawPaint(const SkPaint& paint) SK_OVERRIDE;
33 void drawPoints(PointMode mode, 51 void drawPoints(PointMode mode,
34 size_t count, 52 size_t count,
35 const SkPoint pts[], 53 const SkPoint pts[],
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 SkIRect devBounds() const { 156 SkIRect devBounds() const {
139 SkIRect devBounds; 157 SkIRect devBounds;
140 this->getClipDeviceBounds(&devBounds); 158 this->getClipDeviceBounds(&devBounds);
141 return devBounds; 159 return devBounds;
142 } 160 }
143 161
144 SkRecord* fRecord; 162 SkRecord* fRecord;
145 163
146 int fSaveLayerCount; 164 int fSaveLayerCount;
147 SkTDArray<SkBool8> fSaveIsSaveLayer; 165 SkTDArray<SkBool8> fSaveIsSaveLayer;
148 SkTDArray<SkCanvasDrawable*> fDrawableList; 166 SkAutoTDelete<SkCanvasDrawableList> fDrawableList;
149 }; 167 };
150 168
151 #endif//SkRecorder_DEFINED 169 #endif//SkRecorder_DEFINED
OLDNEW
« no previous file with comments | « src/core/SkRecord.h ('k') | src/core/SkRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698