Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(908)

Unified Diff: src/utils/debugger/SkDrawCommand.cpp

Issue 1529803004: Revert of remove drawSprite from canvas (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/utils/debugger/SkDrawCommand.h ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/debugger/SkDrawCommand.cpp
diff --git a/src/utils/debugger/SkDrawCommand.cpp b/src/utils/debugger/SkDrawCommand.cpp
index 9ebb81e74ae63d94c97a809b613173398c8c101c..330c2c9183cecf156a995c0b0b4d2feddeeb8190 100644
--- a/src/utils/debugger/SkDrawCommand.cpp
+++ b/src/utils/debugger/SkDrawCommand.cpp
@@ -48,6 +48,7 @@
case kDrawPosTextH_OpType: return "DrawPosTextH";
case kDrawRect_OpType: return "DrawRect";
case kDrawRRect_OpType: return "DrawRRect";
+ case kDrawSprite_OpType: return "DrawSprite";
case kDrawText_OpType: return "DrawText";
case kDrawTextBlob_OpType: return "DrawTextBlob";
case kDrawTextOnPath_OpType: return "DrawTextOnPath";
@@ -798,6 +799,36 @@
return true;
}
+SkDrawSpriteCommand::SkDrawSpriteCommand(const SkBitmap& bitmap, int left, int top,
+ const SkPaint* paint)
+ : INHERITED(kDrawSprite_OpType) {
+ fBitmap = bitmap;
+ fLeft = left;
+ fTop = top;
+ if (paint) {
+ fPaint = *paint;
+ fPaintPtr = &fPaint;
+ } else {
+ fPaintPtr = nullptr;
+ }
+
+ fInfo.push(SkObjectParser::BitmapToString(bitmap));
+ fInfo.push(SkObjectParser::IntToString(left, "Left: "));
+ fInfo.push(SkObjectParser::IntToString(top, "Top: "));
+ if (paint) {
+ fInfo.push(SkObjectParser::PaintToString(*paint));
+ }
+}
+
+void SkDrawSpriteCommand::execute(SkCanvas* canvas) const {
+ canvas->drawSprite(fBitmap, fLeft, fTop, fPaintPtr);
+}
+
+bool SkDrawSpriteCommand::render(SkCanvas* canvas) const {
+ render_bitmap(canvas, fBitmap);
+ return true;
+}
+
SkDrawTextCommand::SkDrawTextCommand(const void* text, size_t byteLength, SkScalar x, SkScalar y,
const SkPaint& paint)
: INHERITED(kDrawText_OpType) {
« no previous file with comments | « src/utils/debugger/SkDrawCommand.h ('k') | tests/ImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698