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 | 9 |
10 #include "SkDrawCommand.h" | 10 #include "SkDrawCommand.h" |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 canvas->drawBitmapNine(fBitmap, fCenter, fDst, fPaintPtr); | 313 canvas->drawBitmapNine(fBitmap, fCenter, fDst, fPaintPtr); |
314 } | 314 } |
315 | 315 |
316 bool SkDrawBitmapNineCommand::render(SkCanvas* canvas) const { | 316 bool SkDrawBitmapNineCommand::render(SkCanvas* canvas) const { |
317 render_bitmap(canvas, fBitmap); | 317 render_bitmap(canvas, fBitmap); |
318 return true; | 318 return true; |
319 } | 319 } |
320 | 320 |
321 SkDrawBitmapRectCommand::SkDrawBitmapRectCommand(const SkBitmap& bitmap, const S
kRect* src, | 321 SkDrawBitmapRectCommand::SkDrawBitmapRectCommand(const SkBitmap& bitmap, const S
kRect* src, |
322 const SkRect& dst, const SkPain
t* paint, | 322 const SkRect& dst, const SkPain
t* paint, |
323 SkCanvas::DrawBitmapRectFlags f
lags) | 323 SkCanvas::SrcRectConstraint con
straint) |
324 : INHERITED(kDrawBitmapRect_OpType) { | 324 : INHERITED(kDrawBitmapRect_OpType) { |
325 fBitmap = bitmap; | 325 fBitmap = bitmap; |
326 if (src) { | 326 if (src) { |
327 fSrc = *src; | 327 fSrc = *src; |
328 } else { | 328 } else { |
329 fSrc.setEmpty(); | 329 fSrc.setEmpty(); |
330 } | 330 } |
331 fDst = dst; | 331 fDst = dst; |
332 | 332 |
333 if (paint) { | 333 if (paint) { |
334 fPaint = *paint; | 334 fPaint = *paint; |
335 fPaintPtr = &fPaint; | 335 fPaintPtr = &fPaint; |
336 } else { | 336 } else { |
337 fPaintPtr = NULL; | 337 fPaintPtr = NULL; |
338 } | 338 } |
339 fFlags = flags; | 339 fConstraint = constraint; |
340 | 340 |
341 fInfo.push(SkObjectParser::BitmapToString(bitmap)); | 341 fInfo.push(SkObjectParser::BitmapToString(bitmap)); |
342 if (src) { | 342 if (src) { |
343 fInfo.push(SkObjectParser::RectToString(*src, "Src: ")); | 343 fInfo.push(SkObjectParser::RectToString(*src, "Src: ")); |
344 } | 344 } |
345 fInfo.push(SkObjectParser::RectToString(dst, "Dst: ")); | 345 fInfo.push(SkObjectParser::RectToString(dst, "Dst: ")); |
346 if (paint) { | 346 if (paint) { |
347 fInfo.push(SkObjectParser::PaintToString(*paint)); | 347 fInfo.push(SkObjectParser::PaintToString(*paint)); |
348 } | 348 } |
349 fInfo.push(SkObjectParser::IntToString(fFlags, "Flags: ")); | 349 fInfo.push(SkObjectParser::IntToString(fConstraint, "Constraint: ")); |
350 } | 350 } |
351 | 351 |
352 void SkDrawBitmapRectCommand::execute(SkCanvas* canvas) const { | 352 void SkDrawBitmapRectCommand::execute(SkCanvas* canvas) const { |
353 canvas->drawBitmapRectToRect(fBitmap, this->srcRect(), fDst, fPaintPtr, fFla
gs); | 353 canvas->drawBitmapRect(fBitmap, this->srcRect(), fDst, fPaintPtr, fConstrain
t); |
354 } | 354 } |
355 | 355 |
356 bool SkDrawBitmapRectCommand::render(SkCanvas* canvas) const { | 356 bool SkDrawBitmapRectCommand::render(SkCanvas* canvas) const { |
357 render_bitmap(canvas, fBitmap, this->srcRect()); | 357 render_bitmap(canvas, fBitmap, this->srcRect()); |
358 return true; | 358 return true; |
359 } | 359 } |
360 | 360 |
361 SkDrawOvalCommand::SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint) | 361 SkDrawOvalCommand::SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint) |
362 : INHERITED(kDrawOval_OpType) { | 362 : INHERITED(kDrawOval_OpType) { |
363 fOval = oval; | 363 fOval = oval; |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
887 | 887 |
888 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) { | 888 void SkSetMatrixCommand::setUserMatrix(const SkMatrix& userMatrix) { |
889 fUserMatrix = userMatrix; | 889 fUserMatrix = userMatrix; |
890 } | 890 } |
891 | 891 |
892 void SkSetMatrixCommand::execute(SkCanvas* canvas) const { | 892 void SkSetMatrixCommand::execute(SkCanvas* canvas) const { |
893 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix); | 893 SkMatrix temp = SkMatrix::Concat(fUserMatrix, fMatrix); |
894 canvas->setMatrix(temp); | 894 canvas->setMatrix(temp); |
895 } | 895 } |
896 | 896 |
OLD | NEW |