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

Side by Side Diff: gm/repeated_bitmap.cpp

Issue 1320673011: Minor code cleanup (left over from prior CL) (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « gm/perspshaders.cpp ('k') | gm/tileimagefilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "sk_tool_utils.h" 9 #include "sk_tool_utils.h"
10 #include "Resources.h" 10 #include "Resources.h"
11 11
12 DEF_SIMPLE_GM(repeated_bitmap, canvas, 576, 576) { 12 DEF_SIMPLE_GM(repeated_bitmap, canvas, 576, 576) {
13 sk_tool_utils::draw_checkerboard(canvas, sk_tool_utils::color_to_565(0xFF999 999), 13 sk_tool_utils::draw_checkerboard(canvas, sk_tool_utils::color_to_565(0xFF999 999),
14 SK_ColorWHITE, 12); 14 SK_ColorWHITE, 12);
15 SkRect rect = SkRect::MakeLTRB(-4.25f, -4.25f, 4.25f, 4.25f); 15 SkRect rect = SkRect::MakeLTRB(-4.25f, -4.25f, 4.25f, 4.25f);
16 SkPaint paint; 16 SkPaint paint;
17 paint.setColor(0xFF333333); 17 paint.setColor(0xFF333333);
18 SkBitmap bm; 18 SkBitmap bm;
19 if (GetResourceAsBitmap("randPixels.png", &bm)) { 19 if (GetResourceAsBitmap("randPixels.png", &bm)) {
20 for (int j = 0; j < 4; ++j) { 20 for (int j = 0; j < 4; ++j) {
21 for (int i = 0; i < 4; ++i) { 21 for (int i = 0; i < 4; ++i) {
22 SkAutoCanvasRestore autoCanvasRestore(canvas, true); 22 SkAutoCanvasRestore autoCanvasRestore(canvas, true);
23 canvas->scale(12.0f, 12.0f); 23 canvas->scale(12.0f, 12.0f);
24 canvas->translate(6.0f + 12.0f * SkIntToScalar(i), 24 canvas->translate(6.0f + 12.0f * SkIntToScalar(i),
25 6.0f + 12.0f * SkIntToScalar(j)); 25 6.0f + 12.0f * SkIntToScalar(j));
26 canvas->rotate(18.0f * (i + 4 * j)); 26 canvas->rotate(18.0f * (i + 4 * j));
27 canvas->drawRect(rect, paint); 27 canvas->drawRect(rect, paint);
28 canvas->drawBitmap(bm, -4.0f, -4.0f); 28 canvas->drawBitmap(bm, -4.0f, -4.0f);
29 } 29 }
30 } 30 }
31 } 31 }
32 } 32 }
33 33
34 DEF_SIMPLE_GM(repeated_bitmap_jpg, canvas, 576, 576) { 34 DEF_SIMPLE_GM(repeated_bitmap_jpg, canvas, 576, 576) {
35 sk_tool_utils::draw_checkerboard(canvas, sk_tool_utils::color_to_565(0xFF999 999), 35 sk_tool_utils::draw_checkerboard(canvas, sk_tool_utils::color_to_565(0xFF999 999),
36 SK_ColorWHITE, 12); 36 SK_ColorWHITE, 12);
37 SkRect rect = SkRect::MakeLTRB(-68.0f, -68.0f, 68.0f, 68.0f); 37 SkRect rect = SkRect::MakeLTRB(-68.0f, -68.0f, 68.0f, 68.0f);
38 SkPaint paint; 38 SkPaint paint;
39 paint.setColor(0xFF333333); 39 paint.setColor(0xFF333333);
40 SkBitmap bm; 40 SkBitmap bm;
41 if (GetResourceAsBitmap("color_wheel.jpg", &bm)) { 41 if (GetResourceAsBitmap("color_wheel.jpg", &bm)) {
42 for (int j = 0; j < 4; ++j) { 42 for (int j = 0; j < 4; ++j) {
43 for (int i = 0; i < 4; ++i) { 43 for (int i = 0; i < 4; ++i) {
44 SkAutoCanvasRestore autoCanvasRestore(canvas, true); 44 SkAutoCanvasRestore autoCanvasRestore(canvas, true);
45 canvas->translate(96.0f + 192.0f * SkIntToScalar(i), 45 canvas->translate(96.0f + 192.0f * SkIntToScalar(i),
46 96.0f + 192.0f * SkIntToScalar(j)); 46 96.0f + 192.0f * SkIntToScalar(j));
47 canvas->rotate(18.0f * (i + 4 * j)); 47 canvas->rotate(18.0f * (i + 4 * j));
48 canvas->drawRect(rect, paint); 48 canvas->drawRect(rect, paint);
49 canvas->drawBitmap(bm, -64.0f, -64.0f); 49 canvas->drawBitmap(bm, -64.0f, -64.0f);
50 } 50 }
51 } 51 }
52 } 52 }
53 } 53 }
OLDNEW
« no previous file with comments | « gm/perspshaders.cpp ('k') | gm/tileimagefilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698