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

Unified Diff: experimental/fiddle/draw.cpp

Issue 1349163003: experiment/fiddle (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-12-10 (Thursday) 10:34:44 EST 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 | « experimental/fiddle/.gitignore ('k') | experimental/fiddle/fiddle_main.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/fiddle/draw.cpp
diff --git a/experimental/fiddle/draw.cpp b/experimental/fiddle/draw.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..dfed793701a4ef10e5853a9f330473f03dff86da
--- /dev/null
+++ b/experimental/fiddle/draw.cpp
@@ -0,0 +1,30 @@
+/*
+ * 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);
+ SkAutoTUnref<SkShader> shader(
+ image->newShader(SkShader::kRepeat_TileMode,
+ SkShader::kRepeat_TileMode,
+ &matrix));
+ SkPaint paint;
+ paint.setShader(shader);
+ canvas->drawPaint(paint);
+}
« no previous file with comments | « experimental/fiddle/.gitignore ('k') | experimental/fiddle/fiddle_main.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698