Index: dm/DMUtil.cpp |
diff --git a/dm/DMUtil.cpp b/dm/DMUtil.cpp |
index 19b1c0f397f99e9cee8f75c41a4c0b21e243e95e..a702bbe874953492729164c157b7277cf10a995b 100644 |
--- a/dm/DMUtil.cpp |
+++ b/dm/DMUtil.cpp |
@@ -1,11 +1,25 @@ |
#include "DMUtil.h" |
#include "SkColorPriv.h" |
+#include "SkCommandLineFlags.h" |
#include "SkPicture.h" |
#include "SkPictureRecorder.h" |
+DEFINE_string(matrix, "1 0 0 0 1 0 0 0 1", |
+ "Matrix to apply to the canvas before drawing."); |
+ |
namespace DM { |
+void CanvasPreflight(SkCanvas* canvas) { |
+ if (FLAGS_matrix.count() == 9) { |
+ SkMatrix m; |
+ for (int i = 0; i < 9; i++) { |
+ m[i] = (SkScalar)atof(FLAGS_matrix[i]); |
+ } |
+ canvas->concat(m); |
+ } |
+} |
+ |
SkString UnderJoin(const char* a, const char* b) { |
SkString s; |
s.appendf("%s_%s", a, b); |
@@ -27,6 +41,7 @@ SkPicture* RecordPicture(skiagm::GM* gm, SkBBHFactory* factory, bool skr) { |
SkCanvas* canvas = skr ? recorder.EXPERIMENTAL_beginRecording(w, h, factory) |
: recorder. DEPRECATED_beginRecording(w, h, factory); |
+ CanvasPreflight(canvas); |
canvas->concat(gm->getInitialTransform()); |
gm->draw(canvas); |
canvas->flush(); |