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

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

Issue 290653004: Remove SkRecorder's kWriteOnly mode. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 6 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 | « dm/DMRecordTask.cpp ('k') | src/record/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 14
15 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. 15 // SkRecorder provides an SkCanvas interface for recording into an SkRecord.
16 16
17 class SkRecorder : public SkCanvas { 17 class SkRecorder : public SkCanvas {
18 public: 18 public:
19 // SkRecorder can work in two modes:
20 // write-only: only a core subset of SkCanvas operations (save/restore, cl ip, transform, draw)
21 // are supported, and all of the readback methods on SkCanvas will probabl y fail or lie.
22 //
23 // read-write: all methods should behave with similar semantics to SkCanva s.
24 //
25 // Write-only averages 10-20% faster, but you can't sensibly inspect the can vas while recording.
26 enum Mode { kWriteOnly_Mode, kReadWrite_Mode };
27
28 // Does not take ownership of the SkRecord. 19 // Does not take ownership of the SkRecord.
29 SkRecorder(Mode mode, SkRecord*, int width, int height); 20 SkRecorder(SkRecord*, int width, int height);
30 21
31 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor der will fail. 22 // Make SkRecorder forget entirely about its SkRecord*; all calls to SkRecor der will fail.
32 void forgetRecord(); 23 void forgetRecord();
33 24
34 void clear(SkColor) SK_OVERRIDE; 25 void clear(SkColor) SK_OVERRIDE;
35 void drawPaint(const SkPaint& paint) SK_OVERRIDE; 26 void drawPaint(const SkPaint& paint) SK_OVERRIDE;
36 void drawPoints(PointMode mode, 27 void drawPoints(PointMode mode,
37 size_t count, 28 size_t count,
38 const SkPoint pts[], 29 const SkPoint pts[],
39 const SkPaint& paint) SK_OVERRIDE; 30 const SkPaint& paint) SK_OVERRIDE;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 void onPushCull(const SkRect& cullRect) SK_OVERRIDE; 98 void onPushCull(const SkRect& cullRect) SK_OVERRIDE;
108 void onPopCull() SK_OVERRIDE; 99 void onPopCull() SK_OVERRIDE;
109 100
110 private: 101 private:
111 template <typename T> 102 template <typename T>
112 T* copy(const T*); 103 T* copy(const T*);
113 104
114 template <typename T> 105 template <typename T>
115 T* copy(const T[], unsigned count); 106 T* copy(const T[], unsigned count);
116 107
117 const Mode fMode;
118 SkRecord* fRecord; 108 SkRecord* fRecord;
119 }; 109 };
120 110
121 #endif//SkRecorder_DEFINED 111 #endif//SkRecorder_DEFINED
OLDNEW
« no previous file with comments | « dm/DMRecordTask.cpp ('k') | src/record/SkRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698