diff options
author | halcanary <halcanary@google.com> | 2015-12-10 07:52:45 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-10 07:52:45 -0800 |
commit | decb21e3ae3d296976d8664e49e35971d1b4fadd (patch) | |
tree | ac1f09e066a107e22d46f68775f8f214f53380ea /experimental/fiddle/draw.cpp | |
parent | fd5f6c1b0d352b44ba08a677499c8c27b5aea7c7 (diff) |
experiment/fiddle
Review URL: https://codereview.chromium.org/1349163003
Diffstat (limited to 'experimental/fiddle/draw.cpp')
-rw-r--r-- | experimental/fiddle/draw.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/experimental/fiddle/draw.cpp b/experimental/fiddle/draw.cpp new file mode 100644 index 0000000000..dfed793701 --- /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); +} |