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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 /*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "SkCanvas.h"
9 #include "SkShader.h"
10 #include "checkerboard.h"
11
12 void skiagm::Checkerboard(SkCanvas* canvas, SkColor c1, SkColor c2) {
13 SkBitmap bm;
14 bm.allocN32Pixels(16, 16);
15 bm.eraseColor(c1);
16 bm.eraseArea(SkIRect::MakeLTRB(0, 0, 8, 8), c2);
17 bm.eraseArea(SkIRect::MakeLTRB(8, 8, 16, 16), c2);
18 SkAutoTUnref<SkShader> shader(SkShader::CreateBitmapShader(
19 bm, SkShader::kRepeat_TileMode, SkShader::kRepeat_TileMode));
20 SkPaint paint;
21 paint.setShader(shader);
22 canvas->drawPaint(paint);
23 }
OLDNEW
« 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