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

Unified Diff: gm/drawable.cpp

Issue 1212363005: Make sp- via support SkDrawables; add a GM to test it. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: wtf Created 5 years, 5 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/DMSrcSink.cpp ('k') | src/core/SkRecorder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/drawable.cpp
diff --git a/gm/drawable.cpp b/gm/drawable.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..375ce73cbe6dc6fe9ca98fa377067c41b6fdbec0
--- /dev/null
+++ b/gm/drawable.cpp
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "gm.h"
+#include "SkCanvas.h"
+#include "SkDrawable.h"
+
+struct MyDrawable : public SkDrawable {
+ SkRect onGetBounds() override {
+ return SkRect::MakeWH(640, 480);
+ }
+
+ void onDraw(SkCanvas* canvas) override {
+ SkPath path;
+ path.moveTo(10, 10);
+ path.conicTo(10, 90, 50, 90, 0.9f);
+
+ SkPaint paint;
+ paint.setColor(SK_ColorBLUE);
+ canvas->drawRect(path.getBounds(), paint);
+
+ paint.setAntiAlias(true);
+ paint.setColor(SK_ColorWHITE);
+ canvas->drawPath(path, paint);
+ }
+};
+
+DEF_SIMPLE_GM(Drawables, canvas, 640, 480) {
+ SkAutoTUnref<SkDrawable> d(new MyDrawable);
+ canvas->drawDrawable(d);
+}
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | src/core/SkRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698