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

Unified Diff: src/core/SkDrawable.cpp

Issue 1224783002: add matrix options to drawDrawable (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: modify gm Created 5 years, 5 months 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
Index: src/core/SkDrawable.cpp
diff --git a/src/core/SkDrawable.cpp b/src/core/SkDrawable.cpp
index 64fefd2f1c6bba9a771c8882f071b9ad01f2c577..41547ee697612522a4c315734175eff93ce13a45 100644
--- a/src/core/SkDrawable.cpp
+++ b/src/core/SkDrawable.cpp
@@ -32,8 +32,11 @@ static void draw_bbox(SkCanvas* canvas, const SkRect& r) {
canvas->drawLine(r.left(), r.bottom(), r.right(), r.top(), paint);
}
-void SkDrawable::draw(SkCanvas* canvas) {
+void SkDrawable::draw(SkCanvas* canvas, const SkMatrix* matrix) {
SkAutoCanvasRestore acr(canvas, true);
+ if (matrix) {
+ canvas->concat(*matrix);
+ }
this->onDraw(canvas);
if (false) {
@@ -41,6 +44,11 @@ void SkDrawable::draw(SkCanvas* canvas) {
}
}
+void SkDrawable::draw(SkCanvas* canvas, SkScalar x, SkScalar y) {
+ SkMatrix matrix = SkMatrix::MakeTrans(x, y);
+ this->draw(canvas, &matrix);
+}
+
SkPicture* SkDrawable::newPictureSnapshot() {
return this->onNewPictureSnapshot();
}
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | src/core/SkRecordDraw.cpp » ('j') | src/core/SkRecords.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698