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

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

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

Powered by Google App Engine
This is Rietveld 408576698