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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 }; | 193 }; |
194 | 194 |
195 class DrawBitmapRect : public SkDrawCommand { | 195 class DrawBitmapRect : public SkDrawCommand { |
196 public: | 196 public: |
197 DrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, | 197 DrawBitmapRect(const SkBitmap& bitmap, const SkRect* src, |
198 const SkRect& dst, const SkPaint* paint, | 198 const SkRect& dst, const SkPaint* paint, |
199 SkBitmap& resizedBitmap); | 199 SkBitmap& resizedBitmap); |
200 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; | 200 virtual void execute(SkCanvas* canvas) SK_OVERRIDE; |
201 virtual const SkBitmap* getBitmap() const SK_OVERRIDE; | 201 virtual const SkBitmap* getBitmap() const SK_OVERRIDE; |
202 | 202 |
| 203 const SkBitmap& bitmap() const { return fBitmap; } |
| 204 |
203 // The non-const 'paint' method allows modification of this object's | 205 // The non-const 'paint' method allows modification of this object's |
204 // SkPaint. For this reason the ctor and setPaint method make a local copy. | 206 // SkPaint. For this reason the ctor and setPaint method make a local copy. |
205 // The 'fPaintPtr' member acts a signal that the local SkPaint is valid | 207 // The 'fPaintPtr' member acts a signal that the local SkPaint is valid |
206 // (since only an SkPaint* is passed into the ctor). | 208 // (since only an SkPaint* is passed into the ctor). |
207 const SkPaint* paint() const { return fPaintPtr; } | 209 const SkPaint* paint() const { return fPaintPtr; } |
208 SkPaint* paint() { return fPaintPtr; } | 210 SkPaint* paint() { return fPaintPtr; } |
209 | 211 |
210 void setPaint(const SkPaint& paint) { fPaint = paint; fPaintPtr = &fPaint; } | 212 void setPaint(const SkPaint& paint) { fPaint = paint; fPaintPtr = &fPaint; } |
211 | 213 |
212 const SkRect* srcRect() const { return fSrc.isEmpty() ? NULL : &fSrc; } | 214 const SkRect* srcRect() const { return fSrc.isEmpty() ? NULL : &fSrc; } |
213 const SkRect& dstRect() const { return fDst; } | 215 const SkRect& dstRect() const { return fDst; } |
214 | 216 |
| 217 void setSrcRect(const SkRect& src) { fSrc = src; } |
| 218 void setDstRect(const SkRect& dst) { fDst = dst; } |
| 219 |
215 private: | 220 private: |
216 SkBitmap fBitmap; | 221 SkBitmap fBitmap; |
217 SkRect fSrc; | 222 SkRect fSrc; |
218 SkRect fDst; | 223 SkRect fDst; |
219 SkPaint fPaint; | 224 SkPaint fPaint; |
220 SkPaint* fPaintPtr; | 225 SkPaint* fPaintPtr; |
221 SkBitmap fResizedBitmap; | 226 SkBitmap fResizedBitmap; |
222 | 227 |
223 typedef SkDrawCommand INHERITED; | 228 typedef SkDrawCommand INHERITED; |
224 }; | 229 }; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 SkScalar y() const { return fDy; } | 516 SkScalar y() const { return fDy; } |
512 | 517 |
513 private: | 518 private: |
514 SkScalar fDx; | 519 SkScalar fDx; |
515 SkScalar fDy; | 520 SkScalar fDy; |
516 | 521 |
517 typedef SkDrawCommand INHERITED; | 522 typedef SkDrawCommand INHERITED; |
518 }; | 523 }; |
519 | 524 |
520 #endif | 525 #endif |
OLD | NEW |