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

Unified Diff: gm/checkerboard.cpp

Issue 834303005: Factor out checkerboard function in gm and sampleapp into tools. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: ignore pdf gm change Created 5 years, 11 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
« gm/checkerboard.h ('K') | « gm/checkerboard.h ('k') | gm/colorwheel.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/checkerboard.cpp
diff --git a/gm/checkerboard.cpp b/gm/checkerboard.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f25117f2539fe93a39f7aab8520c1b6955edf053
--- /dev/null
+++ b/gm/checkerboard.cpp
@@ -0,0 +1,23 @@
+/*
+ * 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 "SkCanvas.h"
+#include "SkShader.h"
+#include "checkerboard.h"
+
+void skiagm::Checkerboard(SkCanvas* canvas, SkColor c1, SkColor c2) {
+ SkBitmap bm;
+ bm.allocN32Pixels(16, 16);
+ bm.eraseColor(c1);
+ bm.eraseArea(SkIRect::MakeLTRB(0, 0, 8, 8), c2);
+ bm.eraseArea(SkIRect::MakeLTRB(8, 8, 16, 16), c2);
+ SkAutoTUnref<SkShader> shader(SkShader::CreateBitmapShader(
+ bm, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode));
+ SkPaint paint;
+ paint.setShader(shader);
+ canvas->drawPaint(paint);
+}
« gm/checkerboard.h ('K') | « gm/checkerboard.h ('k') | gm/colorwheel.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698