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

Side by Side Diff: gm/colorwheel.cpp

Issue 680533002: add gm: colorwheel (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « no previous file | gm/gm.h » ('j') | gm/gm.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 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 "Resources.h"
9 #include "SkData.h"
10 #include "SkDecodingImageGenerator.h"
11 #include "gm.h"
12
13 static void checkerboard(SkCanvas* canvas, int w, int h) {
14 SkASSERT(w > 0);
15 SkASSERT(h > 0);
16 w = ((w - 1) | 0xF) + 1;
17 h = ((h - 1) | 0xF) + 1;
18 SkPaint light;
19 light.setColor(0xFF999999);
20 canvas->drawRect(SkRect::MakeXYWH(0, 0, w, h), light);
21 SkPaint dark;
22 dark.setColor(0xFF666666);
23 for (int y = 0; y < w; y += 16) {
24 SkScalar ty = SkIntToScalar(y);
25 for (int x = 0; x < h; x += 16) {
26 SkScalar tx = SkIntToScalar(x);
27 canvas->drawRect(SkRect::MakeXYWH(tx + 0, ty + 0, 8, 8), dark);
28 canvas->drawRect(SkRect::MakeXYWH(tx + 8, ty + 8, 8, 8), dark);
29 }
30 }
31 }
32
33 static void colorwheel(SkCanvas* canvas) {
mtklein 2014/10/24 16:47:48 // Here is why we run this GM: ...
hal.canary 2014/10/24 17:22:01 Done.
34 canvas->clear(SK_ColorWHITE);
35 checkerboard(canvas, 256, 256);
36 SkBitmap bitmap;
37 if (GetResourceAsBitmap("color_wheel.png", &bitmap)) {
38 canvas->drawBitmap(bitmap, 0, 0); // top left
39 }
40 if (GetResourceAsBitmap("color_wheel.gif", &bitmap)) {
41 canvas->drawBitmap(bitmap, 128, 0); // top right
42 }
43 if (GetResourceAsBitmap("color_wheel.webp", &bitmap)) {
44 canvas->drawBitmap(bitmap, 0, 128); // bottom left
45 }
46 if (GetResourceAsBitmap("color_wheel.jpg", &bitmap)) {
47 canvas->drawBitmap(bitmap, 128, 128); // bottom right
48 }
49 }
50 DEF_SIMPLE_GM(colorwheel, 256, 256)
OLDNEW
« no previous file with comments | « no previous file | gm/gm.h » ('j') | gm/gm.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698