Index: src/utils/debugger/SkDrawCommand.cpp |
diff --git a/src/utils/debugger/SkDrawCommand.cpp b/src/utils/debugger/SkDrawCommand.cpp |
index 1d28d2e8e0cbb195ff4629bb82e74a6c9ebcb1b0..15fc9ca8fbba996314d3e6f390f9a408dd5c127a 100644 |
--- a/src/utils/debugger/SkDrawCommand.cpp |
+++ b/src/utils/debugger/SkDrawCommand.cpp |
@@ -36,6 +36,8 @@ const char* SkDrawCommand::GetCommandString(OpType type) { |
case kDrawBitmapRect_OpType: return "DrawBitmapRect"; |
case kDrawClear_OpType: return "DrawClear"; |
case kDrawDRRect_OpType: return "DrawDRRect"; |
+ case kDrawImage_OpType: return "DrawImage"; |
+ case kDrawImageRect_OpType: return "DrawImageRect"; |
case kDrawOval_OpType: return "DrawOval"; |
case kDrawPaint_OpType: return "DrawPaint"; |
case kDrawPatch_OpType: return "DrawPatch"; |
@@ -358,6 +360,64 @@ bool SkDrawBitmapRectCommand::render(SkCanvas* canvas) const { |
return true; |
} |
+SkDrawImageCommand::SkDrawImageCommand(const SkImage* image, SkScalar left, SkScalar top, |
+ const SkPaint* paint) |
+ : INHERITED(kDrawImage_OpType) |
+ , fImage(SkRef(image)) |
+ , fLeft(left) |
+ , fTop(top) { |
+ |
+ if (paint) { |
+ fPaint.set(*paint); |
+ } |
+} |
+ |
+void SkDrawImageCommand::execute(SkCanvas* canvas) const { |
+ canvas->drawImage(fImage, fLeft, fTop, fPaint.getMaybeNull()); |
+} |
+ |
+bool SkDrawImageCommand::render(SkCanvas* canvas) const { |
+ SkAutoCanvasRestore acr(canvas, true); |
+ canvas->clear(0xFFFFFFFF); |
+ |
+ xlate_and_scale_to_bounds(canvas, SkRect::MakeXYWH(fLeft, fTop, |
+ SkIntToScalar(fImage->width()), |
+ SkIntToScalar(fImage->height()))); |
+ this->execute(canvas); |
+ return true; |
+} |
+ |
+SkDrawImageRectCommand::SkDrawImageRectCommand(const SkImage* image, const SkRect* src, |
+ const SkRect& dst, const SkPaint* paint, |
+ SkCanvas::SrcRectConstraint constraint) |
+ : INHERITED(kDrawImageRect_OpType) |
+ , fImage(SkRef(image)) |
+ , fDst(dst) |
+ , fConstraint(constraint) { |
+ |
+ if (src) { |
+ fSrc.set(*src); |
+ } |
+ |
+ if (paint) { |
+ fPaint.set(*paint); |
+ } |
+} |
+ |
+void SkDrawImageRectCommand::execute(SkCanvas* canvas) const { |
+ canvas->drawImageRect(fImage, fSrc.getMaybeNull(), fDst, fPaint.getMaybeNull(), fConstraint); |
+} |
+ |
+bool SkDrawImageRectCommand::render(SkCanvas* canvas) const { |
+ SkAutoCanvasRestore acr(canvas, true); |
+ canvas->clear(0xFFFFFFFF); |
+ |
+ xlate_and_scale_to_bounds(canvas, fDst); |
+ |
+ this->execute(canvas); |
+ return true; |
+} |
+ |
SkDrawOvalCommand::SkDrawOvalCommand(const SkRect& oval, const SkPaint& paint) |
: INHERITED(kDrawOval_OpType) { |
fOval = oval; |