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

Side by Side Diff: gm/dstreadshuffle.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/discard.cpp ('k') | gm/fatpathfill.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 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 fConcavePath.lineTo(points[(2 * i) % 5]); 80 fConcavePath.lineTo(points[(2 * i) % 5]);
81 } 81 }
82 fConcavePath.setFillType(SkPath::kEvenOdd_FillType); 82 fConcavePath.setFillType(SkPath::kEvenOdd_FillType);
83 SkASSERT(!fConcavePath.isConvex()); 83 SkASSERT(!fConcavePath.isConvex());
84 } 84 }
85 canvas->drawPath(fConcavePath, *paint); 85 canvas->drawPath(fConcavePath, *paint);
86 break; 86 break;
87 case kText_ShapeType: { 87 case kText_ShapeType: {
88 const char* text = "Hello!"; 88 const char* text = "Hello!";
89 paint->setTextSize(30); 89 paint->setTextSize(30);
90 sk_tool_utils::set_portable_typeface(paint);
90 canvas->drawText(text, strlen(text), 0, 0, *paint); 91 canvas->drawText(text, strlen(text), 0, 0, *paint);
91 } 92 }
92 default: 93 default:
93 break; 94 break;
94 } 95 }
95 } 96 }
96 97
97 static SkColor GetColor(SkRandom* random, int i, int nextColor) { 98 static SkColor GetColor(SkRandom* random, int i, int nextColor) {
98 static SkColor colors[] = { SK_ColorRED, 99 static SkColor colors[] = { SK_ColorRED,
99 0xFFFF7F00, // Orange 100 sk_tool_utils::color_to_565(0xFFFF7F00), // Orange
100 SK_ColorYELLOW, 101 SK_ColorYELLOW,
101 SK_ColorGREEN, 102 SK_ColorGREEN,
102 SK_ColorBLUE, 103 SK_ColorBLUE,
103 0xFF4B0082, // indigo 104 sk_tool_utils::color_to_565(0xFF4B0082), // indigo
104 0xFF7F00FF }; // violet 105 sk_tool_utils::color_to_565(0xFF7F00FF) }; / / violet
105 SkColor color; 106 SkColor color;
106 int index = nextColor % SK_ARRAY_COUNT(colors); 107 int index = nextColor % SK_ARRAY_COUNT(colors);
107 switch (i) { 108 switch (i) {
108 case 0: 109 case 0:
109 color = SK_ColorTRANSPARENT; 110 color = SK_ColorTRANSPARENT;
110 break; 111 break;
111 case 1: 112 case 1:
112 color = SkColorSetARGB(0xff, 113 color = SkColorSetARGB(0xff,
113 SkColorGetR(colors[index]), 114 SkColorGetR(colors[index]),
114 SkColorGetG(colors[index]), 115 SkColorGetG(colors[index]),
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 static const int kHeight = 400; 187 static const int kHeight = 400;
187 typedef GM INHERITED; 188 typedef GM INHERITED;
188 }; 189 };
189 190
190 ////////////////////////////////////////////////////////////////////////////// 191 //////////////////////////////////////////////////////////////////////////////
191 192
192 static GM* MyFactory(void*) { return new DstReadShuffle; } 193 static GM* MyFactory(void*) { return new DstReadShuffle; }
193 static GMRegistry reg(MyFactory); 194 static GMRegistry reg(MyFactory);
194 195
195 } 196 }
OLDNEW
« no previous file with comments | « gm/discard.cpp ('k') | gm/fatpathfill.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698