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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 SkPaint fPaint; | 222 SkPaint fPaint; |
223 SkPaint* fPaintPtr; | 223 SkPaint* fPaintPtr; |
224 | 224 |
225 typedef SkDrawCommand INHERITED; | 225 typedef SkDrawCommand INHERITED; |
226 }; | 226 }; |
227 | 227 |
228 class SkDrawBitmapRectCommand : public SkDrawCommand { | 228 class SkDrawBitmapRectCommand : public SkDrawCommand { |
229 public: | 229 public: |
230 SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src, | 230 SkDrawBitmapRectCommand(const SkBitmap& bitmap, const SkRect* src, |
231 const SkRect& dst, const SkPaint* paint, | 231 const SkRect& dst, const SkPaint* paint, |
232 SkCanvas::DrawBitmapRectFlags flags); | 232 SkCanvas::SrcRectConstraint); |
233 void execute(SkCanvas* canvas) const override; | 233 void execute(SkCanvas* canvas) const override; |
234 bool render(SkCanvas* canvas) const override; | 234 bool render(SkCanvas* canvas) const override; |
235 | 235 |
236 const SkBitmap& bitmap() const { return fBitmap; } | 236 const SkBitmap& bitmap() const { return fBitmap; } |
237 | 237 |
238 // The non-const 'paint' method allows modification of this object's | 238 // The non-const 'paint' method allows modification of this object's |
239 // SkPaint. For this reason the ctor and setPaint method make a local copy. | 239 // SkPaint. For this reason the ctor and setPaint method make a local copy. |
240 // The 'fPaintPtr' member acts a signal that the local SkPaint is valid | 240 // The 'fPaintPtr' member acts a signal that the local SkPaint is valid |
241 // (since only an SkPaint* is passed into the ctor). | 241 // (since only an SkPaint* is passed into the ctor). |
242 const SkPaint* paint() const { return fPaintPtr; } | 242 const SkPaint* paint() const { return fPaintPtr; } |
243 SkPaint* paint() { return fPaintPtr; } | 243 SkPaint* paint() { return fPaintPtr; } |
244 | 244 |
245 void setPaint(const SkPaint& paint) { fPaint = paint; fPaintPtr = &fPaint; } | 245 void setPaint(const SkPaint& paint) { fPaint = paint; fPaintPtr = &fPaint; } |
246 | 246 |
247 const SkRect* srcRect() const { return fSrc.isEmpty() ? NULL : &fSrc; } | 247 const SkRect* srcRect() const { return fSrc.isEmpty() ? NULL : &fSrc; } |
248 void setSrcRect(const SkRect& src) { fSrc = src; } | 248 void setSrcRect(const SkRect& src) { fSrc = src; } |
249 | 249 |
250 const SkRect& dstRect() const { return fDst; } | 250 const SkRect& dstRect() const { return fDst; } |
251 void setDstRect(const SkRect& dst) { fDst = dst; } | 251 void setDstRect(const SkRect& dst) { fDst = dst; } |
252 | 252 |
253 SkCanvas::DrawBitmapRectFlags flags() const { return fFlags; } | 253 SkCanvas::SrcRectConstraint constraint() const { return fConstraint; } |
254 void setFlags(SkCanvas::DrawBitmapRectFlags flags) { fFlags = flags; } | 254 void setConstraint(SkCanvas::SrcRectConstraint constraint) { fConstraint = c
onstraint; } |
255 | 255 |
256 private: | 256 private: |
257 SkBitmap fBitmap; | 257 SkBitmap fBitmap; |
258 SkRect fSrc; | 258 SkRect fSrc; |
259 SkRect fDst; | 259 SkRect fDst; |
260 SkPaint fPaint; | 260 SkPaint fPaint; |
261 SkPaint* fPaintPtr; | 261 SkPaint* fPaintPtr; |
262 SkCanvas::DrawBitmapRectFlags fFlags; | 262 SkCanvas::SrcRectConstraint fConstraint; |
263 | 263 |
264 typedef SkDrawCommand INHERITED; | 264 typedef SkDrawCommand INHERITED; |
265 }; | 265 }; |
266 | 266 |
267 class SkDrawOvalCommand : public SkDrawCommand { | 267 class SkDrawOvalCommand : public SkDrawCommand { |
268 public: | 268 public: |
269 SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint); | 269 SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint); |
270 void execute(SkCanvas* canvas) const override; | 270 void execute(SkCanvas* canvas) const override; |
271 bool render(SkCanvas* canvas) const override; | 271 bool render(SkCanvas* canvas) const override; |
272 private: | 272 private: |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 void setUserMatrix(const SkMatrix&) override; | 558 void setUserMatrix(const SkMatrix&) override; |
559 void execute(SkCanvas* canvas) const override; | 559 void execute(SkCanvas* canvas) const override; |
560 private: | 560 private: |
561 SkMatrix fUserMatrix; | 561 SkMatrix fUserMatrix; |
562 SkMatrix fMatrix; | 562 SkMatrix fMatrix; |
563 | 563 |
564 typedef SkDrawCommand INHERITED; | 564 typedef SkDrawCommand INHERITED; |
565 }; | 565 }; |
566 | 566 |
567 #endif | 567 #endif |
OLD | NEW |