OLD | NEW |
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 SkRect fDst; | 186 SkRect fDst; |
187 SkPaint fPaint; | 187 SkPaint fPaint; |
188 SkPaint* fPaintPtr; | 188 SkPaint* fPaintPtr; |
189 | 189 |
190 typedef SkDrawCommand INHERITED; | 190 typedef SkDrawCommand INHERITED; |
191 }; | 191 }; |
192 | 192 |
193 class SkDrawBitmapRectCommand : public SkDrawCommand { | 193 class SkDrawBitmapRectCommand : public SkDrawCommand { |
194 public: | 194 public: |
195 SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src, | 195 SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src, |
196 const SkRect& dst, const SkPaint* paint); | 196 const SkRect& dst, const SkPaint* paint, |
| 197 SkCanvas::DrawBitmapRectFlags flags); |
197 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; | 198 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
198 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; | 199 virtual bool render(SkCanvas* canvas) const SK_OVERRIDE; |
199 | 200 |
200 const SkBitmap& bitmap() const { return fBitmap; } | 201 const SkBitmap& bitmap() const { return fBitmap; } |
201 | 202 |
202 // The non-const 'paint' method allows modification of this object's | 203 // The non-const 'paint' method allows modification of this object's |
203 // 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. |
204 // 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 |
205 // (since only an SkPaint* is passed into the ctor). | 206 // (since only an SkPaint* is passed into the ctor). |
206 const SkPaint* paint() const { return fPaintPtr; } | 207 const SkPaint* paint() const { return fPaintPtr; } |
207 SkPaint* paint() { return fPaintPtr; } | 208 SkPaint* paint() { return fPaintPtr; } |
208 | 209 |
209 void setPaint(const SkPaint& paint) { fPaint = paint; fPaintPtr = &fPaint; } | 210 void setPaint(const SkPaint& paint) { fPaint = paint; fPaintPtr = &fPaint; } |
210 | 211 |
211 const SkRect* srcRect() const { return fSrc.isEmpty() ? NULL : &fSrc; } | 212 const SkRect* srcRect() const { return fSrc.isEmpty() ? NULL : &fSrc; } |
| 213 void setSrcRect(const SkRect& src) { fSrc = src; } |
| 214 |
212 const SkRect& dstRect() const { return fDst; } | 215 const SkRect& dstRect() const { return fDst; } |
213 | |
214 void setSrcRect(const SkRect& src) { fSrc = src; } | |
215 void setDstRect(const SkRect& dst) { fDst = dst; } | 216 void setDstRect(const SkRect& dst) { fDst = dst; } |
216 | 217 |
| 218 SkCanvas::DrawBitmapRectFlags flags() const { return fFlags; } |
| 219 void setFlags(SkCanvas::DrawBitmapRectFlags flags) { fFlags = flags; } |
| 220 |
217 private: | 221 private: |
218 SkBitmap fBitmap; | 222 SkBitmap fBitmap; |
219 SkRect fSrc; | 223 SkRect fSrc; |
220 SkRect fDst; | 224 SkRect fDst; |
221 SkPaint fPaint; | 225 SkPaint fPaint; |
222 SkPaint* fPaintPtr; | 226 SkPaint* fPaintPtr; |
| 227 SkCanvas::DrawBitmapRectFlags fFlags; |
223 | 228 |
224 typedef SkDrawCommand INHERITED; | 229 typedef SkDrawCommand INHERITED; |
225 }; | 230 }; |
226 | 231 |
227 class SkDrawDataCommand : public SkDrawCommand { | 232 class SkDrawDataCommand : public SkDrawCommand { |
228 public: | 233 public: |
229 SkDrawDataCommand(const void* data, size_t length); | 234 SkDrawDataCommand(const void* data, size_t length); |
230 virtual ~SkDrawDataCommand() { delete [] fData; } | 235 virtual ~SkDrawDataCommand() { delete [] fData; } |
231 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; | 236 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
232 private: | 237 private: |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
544 SkScalar y() const { return fDy; } | 549 SkScalar y() const { return fDy; } |
545 | 550 |
546 private: | 551 private: |
547 SkScalar fDx; | 552 SkScalar fDx; |
548 SkScalar fDy; | 553 SkScalar fDy; |
549 | 554 |
550 typedef SkDrawCommand INHERITED; | 555 typedef SkDrawCommand INHERITED; |
551 }; | 556 }; |
552 | 557 |
553 #endif | 558 #endif |
OLD | NEW |