aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/fiddle/draw.cpp
diff options
context:
space:
mode:
authorGravatar halcanary <halcanary@google.com>2016-04-18 11:50:07 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-18 11:50:07 -0700
commitf0da138c9500bab765a6ef59d97759d1466c1965 (patch)
tree1431756e9a33d8d04048e760d66e521b7dde21c3 /tools/fiddle/draw.cpp
parent382949db14cb38ffbc5b1e15a0f56bb7d4e8f7d0 (diff)
experimental/fiddle -> tools/fiddle
Diffstat (limited to 'tools/fiddle/draw.cpp')
-rw-r--r--tools/fiddle/draw.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tools/fiddle/draw.cpp b/tools/fiddle/draw.cpp
new file mode 100644
index 0000000000..78f428da2a
--- /dev/null
+++ b/tools/fiddle/draw.cpp
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+// This is an example of the translation unit that needs to be
+// assembled by the fiddler program to compile into a fiddle: an
+// implementation of the GetDrawOptions() and draw() functions.
+
+#include "fiddle_main.h"
+DrawOptions GetDrawOptions() {
+ // path *should* be absolute.
+ static const char path[] = "../../resources/color_wheel.png";
+ return DrawOptions(256, 256, true, true, true, true, path);
+}
+void draw(SkCanvas* canvas) {
+ canvas->clear(SK_ColorWHITE);
+ SkMatrix matrix;
+ matrix.setScale(0.75f, 0.75f);
+ matrix.preRotate(30.0f);
+ SkPaint paint;
+ paint.setShader(image->makeShader(SkShader::kRepeat_TileMode,
+ SkShader::kRepeat_TileMode,
+ &matrix));
+ canvas->drawPaint(paint);
+}