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

Side by Side Diff: debugger/SkDrawCommand.h

Issue 12634024: More SkDrawCommand cleanup (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | debugger/SkDrawCommand.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 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #ifndef SKDRAWCOMMAND_H_ 9 #ifndef SKDRAWCOMMAND_H_
10 #define SKDRAWCOMMAND_H_ 10 #define SKDRAWCOMMAND_H_
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 private: 51 private:
52 bool fVisible; 52 bool fVisible;
53 }; 53 };
54 54
55 class Restore : public SkDrawCommand { 55 class Restore : public SkDrawCommand {
56 public: 56 public:
57 Restore(); 57 Restore();
58 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 58 virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
59 virtual void trackSaveState(int* state) SK_OVERRIDE; 59 virtual void trackSaveState(int* state) SK_OVERRIDE;
60
61 private:
62 typedef SkDrawCommand INHERITED;
60 }; 63 };
61 64
62 class Clear : public SkDrawCommand { 65 class Clear : public SkDrawCommand {
63 public: 66 public:
64 Clear(SkColor color); 67 Clear(SkColor color);
65 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 68 virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
66 private: 69 private:
67 SkColor fColor; 70 SkColor fColor;
71
72 typedef SkDrawCommand INHERITED;
68 }; 73 };
69 74
70 class ClipPath : public SkDrawCommand { 75 class ClipPath : public SkDrawCommand {
71 public: 76 public:
72 ClipPath(const SkPath& path, SkRegion::Op op, bool doAA, SkBitmap& bitmap); 77 ClipPath(const SkPath& path, SkRegion::Op op, bool doAA, SkBitmap& bitmap);
73 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 78 virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
74 virtual const SkBitmap* getBitmap() const SK_OVERRIDE; 79 virtual const SkBitmap* getBitmap() const SK_OVERRIDE;
75 private: 80 private:
76 SkPath fPath; 81 SkPath fPath;
77 SkRegion::Op fOp; 82 SkRegion::Op fOp;
78 bool fDoAA; 83 bool fDoAA;
79 SkBitmap fBitmap; 84 SkBitmap fBitmap;
80 85
81 typedef SkDrawCommand INHERITED; 86 typedef SkDrawCommand INHERITED;
82 }; 87 };
83 88
84 class ClipRegion : public SkDrawCommand { 89 class ClipRegion : public SkDrawCommand {
85 public: 90 public:
86 ClipRegion(const SkRegion& region, SkRegion::Op op); 91 ClipRegion(const SkRegion& region, SkRegion::Op op);
87 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 92 virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
88 private: 93 private:
89 const SkRegion* fRegion; 94 SkRegion fRegion;
90 SkRegion::Op fOp; 95 SkRegion::Op fOp;
96
97 typedef SkDrawCommand INHERITED;
91 }; 98 };
92 99
93 class ClipRect : public SkDrawCommand { 100 class ClipRect : public SkDrawCommand {
94 public: 101 public:
95 ClipRect(const SkRect& rect, SkRegion::Op op, bool doAA); 102 ClipRect(const SkRect& rect, SkRegion::Op op, bool doAA);
96 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 103 virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
97 104
98 const SkRect& rect() const { return fRect; } 105 const SkRect& rect() const { return fRect; }
99 SkRegion::Op op() const { return fOp; } 106 SkRegion::Op op() const { return fOp; }
100 bool doAA() const { return fDoAA; } 107 bool doAA() const { return fDoAA; }
(...skipping 21 matching lines...) Expand all
122 bool fDoAA; 129 bool fDoAA;
123 130
124 typedef SkDrawCommand INHERITED; 131 typedef SkDrawCommand INHERITED;
125 }; 132 };
126 133
127 class Concat : public SkDrawCommand { 134 class Concat : public SkDrawCommand {
128 public: 135 public:
129 Concat(const SkMatrix& matrix); 136 Concat(const SkMatrix& matrix);
130 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 137 virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
131 private: 138 private:
132 const SkMatrix* fMatrix; 139 SkMatrix fMatrix;
140
141 typedef SkDrawCommand INHERITED;
133 }; 142 };
134 143
135 class DrawBitmap : public SkDrawCommand { 144 class DrawBitmap : public SkDrawCommand {
136 public: 145 public:
137 DrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top, 146 DrawBitmap(const SkBitmap& bitmap, SkScalar left, SkScalar top,
138 const SkPaint* paint, SkBitmap& resizedBitmap); 147 const SkPaint* paint, SkBitmap& resizedBitmap);
139 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 148 virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
140 virtual const SkBitmap* getBitmap() const SK_OVERRIDE; 149 virtual const SkBitmap* getBitmap() const SK_OVERRIDE;
141 private: 150 private:
142 const SkPaint* fPaint; 151 SkBitmap fBitmap;
143 const SkBitmap* fBitmap;
144 SkScalar fLeft; 152 SkScalar fLeft;
145 SkScalar fTop; 153 SkScalar fTop;
154 SkPaint fPaint;
155 SkPaint* fPaintPtr;
146 SkBitmap fResizedBitmap; 156 SkBitmap fResizedBitmap;
157
158 typedef SkDrawCommand INHERITED;
147 }; 159 };
148 160
149 class DrawBitmapMatrix : public SkDrawCommand { 161 class DrawBitmapMatrix : public SkDrawCommand {
150 public: 162 public:
151 DrawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& matrix, 163 DrawBitmapMatrix(const SkBitmap& bitmap, const SkMatrix& matrix,
152 const SkPaint* paint, SkBitmap& resizedBitmap); 164 const SkPaint* paint, SkBitmap& resizedBitmap);
153 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 165 virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
154 virtual const SkBitmap* getBitmap() const SK_OVERRIDE; 166 virtual const SkBitmap* getBitmap() const SK_OVERRIDE;
155 private: 167 private:
156 const SkPaint* fPaint; 168 SkBitmap fBitmap;
157 const SkBitmap* fBitmap; 169 SkMatrix fMatrix;
158 const SkMatrix* fMatrix; 170 SkPaint fPaint;
171 SkPaint* fPaintPtr;
159 SkBitmap fResizedBitmap; 172 SkBitmap fResizedBitmap;
173
174 typedef SkDrawCommand INHERITED;
160 }; 175 };
161 176
162 class DrawBitmapNine : public SkDrawCommand { 177 class DrawBitmapNine : public SkDrawCommand {
163 public: 178 public:
164 DrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center, 179 DrawBitmapNine(const SkBitmap& bitmap, const SkIRect& center,
165 const SkRect& dst, const SkPaint* paint, SkBitmap& resizedBitmap); 180 const SkRect& dst, const SkPaint* paint,
181 SkBitmap& resizedBitmap);
166 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 182 virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
167 virtual const SkBitmap* getBitmap() const SK_OVERRIDE; 183 virtual const SkBitmap* getBitmap() const SK_OVERRIDE;
168 private: 184 private:
169 const SkBitmap* fBitmap; 185 SkBitmap fBitmap;
170 const SkIRect* fCenter; 186 SkIRect fCenter;
171 const SkRect* fDst; 187 SkRect fDst;
172 const SkPaint* fPaint; 188 SkPaint fPaint;
189 SkPaint* fPaintPtr;
173 SkBitmap fResizedBitmap; 190 SkBitmap fResizedBitmap;
191
192 typedef SkDrawCommand INHERITED;
174 }; 193 };
175 194
176 class DrawBitmapRect : public SkDrawCommand { 195 class DrawBitmapRect : public SkDrawCommand {
177 public: 196 public:
178 DrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, 197 DrawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
179 const SkRect& dst, const SkPaint* paint, 198 const SkRect& dst, const SkPaint* paint,
180 SkBitmap& resizedBitmap); 199 SkBitmap& resizedBitmap);
181 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 200 virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
182 virtual const SkBitmap* getBitmap() const SK_OVERRIDE; 201 virtual const SkBitmap* getBitmap() const SK_OVERRIDE;
183 202
184 // The non-const 'paint' method allows modification of this object's 203 // The non-const 'paint' method allows modification of this object's
185 // SkPaint. For this reason the ctor and setPaint method make a local copy. 204 // SkPaint. For this reason the ctor and setPaint method make a local copy.
186 // The 'fPaintPtr' member acts a signal that the local SkPaint is valid 205 // The 'fPaintPtr' member acts a signal that the local SkPaint is valid
187 // (since only an SkPaint* is passed into the ctor). 206 // (since only an SkPaint* is passed into the ctor).
188 const SkPaint* paint() const { return fPaintPtr; } 207 const SkPaint* paint() const { return fPaintPtr; }
189 SkPaint* paint() { return fPaintPtr; } 208 SkPaint* paint() { return fPaintPtr; }
190 209
191 void setPaint(const SkPaint& paint) { fPaint = paint; fPaintPtr = &fPaint; } 210 void setPaint(const SkPaint& paint) { fPaint = paint; fPaintPtr = &fPaint; }
192 211
193 const SkRect* srcRect() const { return fSrc.isEmpty() ? NULL : &fSrc; } 212 const SkRect* srcRect() const { return fSrc.isEmpty() ? NULL : &fSrc; }
194 const SkRect& dstRect() const { return fDst; } 213 const SkRect& dstRect() const { return fDst; }
195 214
196 private: 215 private:
197 SkRect fSrc; 216 SkBitmap fBitmap;
198 SkPaint fPaint; 217 SkRect fSrc;
218 SkRect fDst;
219 SkPaint fPaint;
199 SkPaint* fPaintPtr; 220 SkPaint* fPaintPtr;
200 SkBitmap fBitmap;
201 SkRect fDst;
202 SkBitmap fResizedBitmap; 221 SkBitmap fResizedBitmap;
203 222
204 typedef SkDrawCommand INHERITED; 223 typedef SkDrawCommand INHERITED;
205 }; 224 };
206 225
207 class DrawData : public SkDrawCommand { 226 class DrawData : public SkDrawCommand {
208 public: 227 public:
209 DrawData(const void* data, size_t length); 228 DrawData(const void* data, size_t length);
210 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 229 virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
211 private: 230 private:
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 SkScalar fDegrees; 413 SkScalar fDegrees;
395 }; 414 };
396 415
397 class Save : public SkDrawCommand { 416 class Save : public SkDrawCommand {
398 public: 417 public:
399 Save(SkCanvas::SaveFlags flags); 418 Save(SkCanvas::SaveFlags flags);
400 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 419 virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
401 virtual void trackSaveState(int* state) SK_OVERRIDE; 420 virtual void trackSaveState(int* state) SK_OVERRIDE;
402 private: 421 private:
403 SkCanvas::SaveFlags fFlags; 422 SkCanvas::SaveFlags fFlags;
423
424 typedef SkDrawCommand INHERITED;
404 }; 425 };
405 426
406 class SaveLayer : public SkDrawCommand { 427 class SaveLayer : public SkDrawCommand {
407 public: 428 public:
408 SaveLayer(const SkRect* bounds, const SkPaint* paint, 429 SaveLayer(const SkRect* bounds, const SkPaint* paint,
409 SkCanvas::SaveFlags flags); 430 SkCanvas::SaveFlags flags);
410 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 431 virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
411 virtual void trackSaveState(int* state) SK_OVERRIDE; 432 virtual void trackSaveState(int* state) SK_OVERRIDE;
412 433
413 const SkPaint* paint() const { return fPaint; } 434 const SkPaint* paint() const { return fPaintPtr; }
414 435
415 private: 436 private:
416 const SkRect* fBounds; 437 SkRect fBounds;
417 const SkPaint* fPaint; 438 SkPaint fPaint;
439 SkPaint* fPaintPtr;
418 SkCanvas::SaveFlags fFlags; 440 SkCanvas::SaveFlags fFlags;
441
442 typedef SkDrawCommand INHERITED;
419 }; 443 };
420 444
421 class Scale : public SkDrawCommand { 445 class Scale : public SkDrawCommand {
422 public: 446 public:
423 Scale(SkScalar sx, SkScalar sy); 447 Scale(SkScalar sx, SkScalar sy);
424 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; 448 virtual void execute(SkCanvas* canvas) SK_OVERRIDE;
425 449
426 SkScalar x() const { return fSx; } 450 SkScalar x() const { return fSx; }
427 SkScalar y() const { return fSy; } 451 SkScalar y() const { return fSy; }
428 452
(...skipping 26 matching lines...) Expand all
455 479
456 SkScalar x() const { return fDx; } 480 SkScalar x() const { return fDx; }
457 SkScalar y() const { return fDy; } 481 SkScalar y() const { return fDy; }
458 482
459 private: 483 private:
460 SkScalar fDx; 484 SkScalar fDx;
461 SkScalar fDy; 485 SkScalar fDy;
462 }; 486 };
463 487
464 #endif 488 #endif
OLDNEW
« no previous file with comments | « no previous file | debugger/SkDrawCommand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698