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 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 void SkDrawBitmapNineCommand::execute(SkCanvas* canvas) { | 335 void SkDrawBitmapNineCommand::execute(SkCanvas* canvas) { |
336 canvas->drawBitmapNine(fBitmap, fCenter, fDst, fPaintPtr); | 336 canvas->drawBitmapNine(fBitmap, fCenter, fDst, fPaintPtr); |
337 } | 337 } |
338 | 338 |
339 bool SkDrawBitmapNineCommand::render(SkCanvas* canvas) const { | 339 bool SkDrawBitmapNineCommand::render(SkCanvas* canvas) const { |
340 render_bitmap(canvas, fBitmap); | 340 render_bitmap(canvas, fBitmap); |
341 return true; | 341 return true; |
342 } | 342 } |
343 | 343 |
344 SkDrawBitmapRectCommand::SkDrawBitmapRectCommand(const SkBitmap& bitmap, const S
kRect* src, | 344 SkDrawBitmapRectCommand::SkDrawBitmapRectCommand(const SkBitmap& bitmap, const S
kRect* src, |
345 const SkRect& dst, const SkPain
t* paint) { | 345 const SkRect& dst, const SkPain
t* paint, |
| 346 SkCanvas::DrawBitmapRectFlags f
lags) { |
346 fBitmap = bitmap; | 347 fBitmap = bitmap; |
347 if (NULL != src) { | 348 if (NULL != src) { |
348 fSrc = *src; | 349 fSrc = *src; |
349 } else { | 350 } else { |
350 fSrc.setEmpty(); | 351 fSrc.setEmpty(); |
351 } | 352 } |
352 fDst = dst; | 353 fDst = dst; |
353 | 354 |
354 if (NULL != paint) { | 355 if (NULL != paint) { |
355 fPaint = *paint; | 356 fPaint = *paint; |
356 fPaintPtr = &fPaint; | 357 fPaintPtr = &fPaint; |
357 } else { | 358 } else { |
358 fPaintPtr = NULL; | 359 fPaintPtr = NULL; |
359 } | 360 } |
| 361 fFlags = flags; |
| 362 |
360 fDrawType = DRAW_BITMAP_RECT_TO_RECT; | 363 fDrawType = DRAW_BITMAP_RECT_TO_RECT; |
361 | 364 |
362 fInfo.push(SkObjectParser::BitmapToString(bitmap)); | 365 fInfo.push(SkObjectParser::BitmapToString(bitmap)); |
363 if (NULL != src) { | 366 if (NULL != src) { |
364 fInfo.push(SkObjectParser::RectToString(*src, "Src: ")); | 367 fInfo.push(SkObjectParser::RectToString(*src, "Src: ")); |
365 } | 368 } |
366 fInfo.push(SkObjectParser::RectToString(dst, "Dst: ")); | 369 fInfo.push(SkObjectParser::RectToString(dst, "Dst: ")); |
367 if (NULL != paint) { | 370 if (NULL != paint) { |
368 fInfo.push(SkObjectParser::PaintToString(*paint)); | 371 fInfo.push(SkObjectParser::PaintToString(*paint)); |
369 } | 372 } |
| 373 fInfo.push(SkObjectParser::IntToString(fFlags, "Flags: ")); |
370 } | 374 } |
371 | 375 |
372 void SkDrawBitmapRectCommand::execute(SkCanvas* canvas) { | 376 void SkDrawBitmapRectCommand::execute(SkCanvas* canvas) { |
373 canvas->drawBitmapRectToRect(fBitmap, this->srcRect(), fDst, fPaintPtr); | 377 canvas->drawBitmapRectToRect(fBitmap, this->srcRect(), fDst, fPaintPtr, fFla
gs); |
374 } | 378 } |
375 | 379 |
376 bool SkDrawBitmapRectCommand::render(SkCanvas* canvas) const { | 380 bool SkDrawBitmapRectCommand::render(SkCanvas* canvas) const { |
377 render_bitmap(canvas, fBitmap, this->srcRect()); | 381 render_bitmap(canvas, fBitmap, this->srcRect()); |
378 return true; | 382 return true; |
379 } | 383 } |
380 | 384 |
381 SkDrawDataCommand::SkDrawDataCommand(const void* data, size_t length) { | 385 SkDrawDataCommand::SkDrawDataCommand(const void* data, size_t length) { |
382 fData = new char[length]; | 386 fData = new char[length]; |
383 memcpy(fData, data, length); | 387 memcpy(fData, data, length); |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
869 fDy = dy; | 873 fDy = dy; |
870 fDrawType = TRANSLATE; | 874 fDrawType = TRANSLATE; |
871 | 875 |
872 fInfo.push(SkObjectParser::ScalarToString(dx, "SkScalar dx: ")); | 876 fInfo.push(SkObjectParser::ScalarToString(dx, "SkScalar dx: ")); |
873 fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: ")); | 877 fInfo.push(SkObjectParser::ScalarToString(dy, "SkScalar dy: ")); |
874 } | 878 } |
875 | 879 |
876 void SkTranslateCommand::execute(SkCanvas* canvas) { | 880 void SkTranslateCommand::execute(SkCanvas* canvas) { |
877 canvas->translate(fDx, fDy); | 881 canvas->translate(fDx, fDy); |
878 } | 882 } |
OLD | NEW |