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

Unified Diff: dm/DMUtil.cpp

Issue 563723005: Add --matrix to DM, to play around with and maybe use on a bot. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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
« no previous file with comments | « dm/DMUtil.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« no previous file with comments | « dm/DMUtil.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698