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

Side by Side Diff: gm/discard.cpp

Issue 1262703002: make tests portable by using 565 compatible colors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix dstreadshuffle text portable gm Created 5 years, 4 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/colorcube.cpp ('k') | gm/dstreadshuffle.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 2014 Google Inc. 2 * Copyright 2014 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorShader.h" 10 #include "SkColorShader.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 return; 51 return;
52 } 52 }
53 53
54 canvas->clear(SK_ColorBLACK); 54 canvas->clear(SK_ColorBLACK);
55 55
56 SkRandom rand; 56 SkRandom rand;
57 for (int x = 0; x < 10; ++x) { 57 for (int x = 0; x < 10; ++x) {
58 for (int y = 0; y < 10; ++y) { 58 for (int y = 0; y < 10; ++y) {
59 surface->getCanvas()->discard(); 59 surface->getCanvas()->discard();
60 // Make something that isn't too close to the background color, bl ack. 60 // Make something that isn't too close to the background color, bl ack.
61 SkColor color = rand.nextU() | 0xFF404040; 61 SkColor color = sk_tool_utils::color_to_565(rand.nextU() | 0xFF404 040);
62 switch (rand.nextULessThan(3)) { 62 switch (rand.nextULessThan(3)) {
63 case 0: 63 case 0:
64 surface->getCanvas()->drawColor(color); 64 surface->getCanvas()->drawColor(color);
65 break; 65 break;
66 case 1: 66 case 1:
67 surface->getCanvas()->clear(color); 67 surface->getCanvas()->clear(color);
68 break; 68 break;
69 case 2: 69 case 2:
70 SkColorShader shader(color); 70 SkColorShader shader(color);
71 SkPaint paint; 71 SkPaint paint;
(...skipping 13 matching lines...) Expand all
85 typedef GM INHERITED; 85 typedef GM INHERITED;
86 }; 86 };
87 87
88 ////////////////////////////////////////////////////////////////////////////// 88 //////////////////////////////////////////////////////////////////////////////
89 89
90 DEF_GM( return SkNEW(DiscardGM); ) 90 DEF_GM( return SkNEW(DiscardGM); )
91 91
92 } // end namespace 92 } // end namespace
93 93
94 #endif 94 #endif
OLDNEW
« no previous file with comments | « gm/colorcube.cpp ('k') | gm/dstreadshuffle.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698