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

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

Issue 231653002: SkRecordDraw: skip draw ops when the clip is empty (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: pop cull unconditionally Created 6 years, 8 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/record/SkRecordDraw.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 #ifndef SkRecorder_DEFINED 1 #ifndef SkRecorder_DEFINED
2 #define SkRecorder_DEFINED 2 #define SkRecorder_DEFINED
3 3
4 #include "SkCanvas.h" 4 #include "SkCanvas.h"
5 #include "SkRecord.h" 5 #include "SkRecord.h"
6 #include "SkRecords.h" 6 #include "SkRecords.h"
7 7
8 // SkRecorder provides an SkCanvas interface for recording into an SkRecord. 8 // SkRecorder provides an SkCanvas interface for recording into an SkRecord.
9 9
10 class SkRecorder : public SkCanvas { 10 class SkRecorder : public SkCanvas {
11 public: 11 public:
12 // SkRecorder can work in two modes:
13 // write-only: only a core subset of SkCanvas operations (save/restore, cl ip, transform, draw)
14 // are supported, and all of the readback methods on SkCanvas will probabl y fail or lie.
15 //
16 // read-write: all methods should behave with similar semantics to SkCanva s.
17 //
18 // Write-only averages 10-20% faster, but you can't sensibly inspect the can vas while recording.
19 enum Mode { kWriteOnly_Mode, kReadWrite_Mode };
20
12 // Does not take ownership of the SkRecord. 21 // Does not take ownership of the SkRecord.
13 SkRecorder(SkRecord*, int width, int height); 22 SkRecorder(Mode mode, SkRecord*, int width, int height);
14 23
15 void clear(SkColor) SK_OVERRIDE; 24 void clear(SkColor) SK_OVERRIDE;
16 void drawPaint(const SkPaint& paint) SK_OVERRIDE; 25 void drawPaint(const SkPaint& paint) SK_OVERRIDE;
17 void drawPoints(PointMode mode, 26 void drawPoints(PointMode mode,
18 size_t count, 27 size_t count,
19 const SkPoint pts[], 28 const SkPoint pts[],
20 const SkPaint& paint) SK_OVERRIDE; 29 const SkPaint& paint) SK_OVERRIDE;
21 void drawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE; 30 void drawRect(const SkRect& rect, const SkPaint& paint) SK_OVERRIDE;
22 void drawOval(const SkRect& oval, const SkPaint&) SK_OVERRIDE; 31 void drawOval(const SkRect& oval, const SkPaint&) SK_OVERRIDE;
23 void drawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRIDE; 32 void drawRRect(const SkRRect& rrect, const SkPaint& paint) SK_OVERRIDE;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void onPushCull(const SkRect& cullRect) SK_OVERRIDE; 97 void onPushCull(const SkRect& cullRect) SK_OVERRIDE;
89 void onPopCull() SK_OVERRIDE; 98 void onPopCull() SK_OVERRIDE;
90 99
91 private: 100 private:
92 template <typename T> 101 template <typename T>
93 T* copy(const T*); 102 T* copy(const T*);
94 103
95 template <typename T> 104 template <typename T>
96 T* copy(const T[], unsigned count); 105 T* copy(const T[], unsigned count);
97 106
107 const Mode fMode;
98 SkRecord* fRecord; 108 SkRecord* fRecord;
99 }; 109 };
100 110
101 #endif//SkRecorder_DEFINED 111 #endif//SkRecorder_DEFINED
OLDNEW
« no previous file with comments | « src/record/SkRecordDraw.cpp ('k') | src/record/SkRecorder.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698