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

Side by Side Diff: gm/tilemodes.cpp

Issue 23617003: Remove blur from text labels in tilemodes* GMs (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 2011 Google Inc. 3 * Copyright 2011 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 "SkPath.h" 9 #include "SkPath.h"
10 #include "SkRegion.h" 10 #include "SkRegion.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 paint->setShader(shader)->unref(); 49 paint->setShader(shader)->unref();
50 paint->setFilterBitmap(filter); 50 paint->setFilterBitmap(filter);
51 } 51 }
52 52
53 static const SkBitmap::Config gConfigs[] = { 53 static const SkBitmap::Config gConfigs[] = {
54 SkBitmap::kARGB_8888_Config, 54 SkBitmap::kARGB_8888_Config,
55 SkBitmap::kRGB_565_Config, 55 SkBitmap::kRGB_565_Config,
56 }; 56 };
57 57
58 class TilingGM : public skiagm::GM { 58 class TilingGM : public skiagm::GM {
59 SkBlurDrawLooper fLooper;
60 public: 59 public:
61 TilingGM(bool powerOfTwoSize) 60 TilingGM(bool powerOfTwoSize)
62 : fLooper(SkIntToScalar(1), SkIntToScalar(2), SkIntToScalar(2), 0x88 000000) 61 : fPowerOfTwoSize(powerOfTwoSize) {
63 , fPowerOfTwoSize(powerOfTwoSize) {
64 } 62 }
65 63
66 SkBitmap fTexture[SK_ARRAY_COUNT(gConfigs)]; 64 SkBitmap fTexture[SK_ARRAY_COUNT(gConfigs)];
67 65
68 protected: 66 protected:
69 67
70 enum { 68 enum {
71 kPOTSize = 32, 69 kPOTSize = 32,
72 kNPOTSize = 21, 70 kNPOTSize = 21,
73 }; 71 };
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 103
106 SkScalar y = SkIntToScalar(24); 104 SkScalar y = SkIntToScalar(24);
107 SkScalar x = SkIntToScalar(10); 105 SkScalar x = SkIntToScalar(10);
108 106
109 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) { 107 for (size_t kx = 0; kx < SK_ARRAY_COUNT(gModes); kx++) {
110 for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) { 108 for (size_t ky = 0; ky < SK_ARRAY_COUNT(gModes); ky++) {
111 SkPaint p; 109 SkPaint p;
112 SkString str; 110 SkString str;
113 p.setAntiAlias(true); 111 p.setAntiAlias(true);
114 p.setDither(true); 112 p.setDither(true);
115 p.setLooper(&fLooper);
116 str.printf("[%s,%s]", gModeNames[kx], gModeNames[ky]); 113 str.printf("[%s,%s]", gModeNames[kx], gModeNames[ky]);
117 114
118 p.setTextAlign(SkPaint::kCenter_Align); 115 p.setTextAlign(SkPaint::kCenter_Align);
119 canvas->drawText(str.c_str(), str.size(), x + r.width()/2, y, p) ; 116 canvas->drawText(str.c_str(), str.size(), x + r.width()/2, y, p) ;
120 117
121 x += r.width() * 4 / 3; 118 x += r.width() * 4 / 3;
122 } 119 }
123 } 120 }
124 121
125 y += SkIntToScalar(16); 122 y += SkIntToScalar(16);
(...skipping 18 matching lines...) Expand all
144 canvas->drawRect(r, paint); 141 canvas->drawRect(r, paint);
145 canvas->restore(); 142 canvas->restore();
146 143
147 x += r.width() * 4 / 3; 144 x += r.width() * 4 / 3;
148 } 145 }
149 } 146 }
150 { 147 {
151 SkPaint p; 148 SkPaint p;
152 SkString str; 149 SkString str;
153 p.setAntiAlias(true); 150 p.setAntiAlias(true);
154 p.setLooper(&fLooper);
155 str.printf("%s, %s", gConfigNames[i], gFilterNames[j]); 151 str.printf("%s, %s", gConfigNames[i], gFilterNames[j]);
156 canvas->drawText(str.c_str(), str.size(), x, y + r.height() * 2 / 3, p); 152 canvas->drawText(str.c_str(), str.size(), x, y + r.height() * 2 / 3, p);
157 } 153 }
158 154
159 y += r.height() * 4 / 3; 155 y += r.height() * 4 / 3;
160 } 156 }
161 } 157 }
162 } 158 }
163 159
164 private: 160 private:
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 private: 262 private:
267 typedef skiagm::GM INHERITED; 263 typedef skiagm::GM INHERITED;
268 }; 264 };
269 265
270 ////////////////////////////////////////////////////////////////////////////// 266 //////////////////////////////////////////////////////////////////////////////
271 267
272 DEF_GM( return new TilingGM(true); ) 268 DEF_GM( return new TilingGM(true); )
273 DEF_GM( return new TilingGM(false); ) 269 DEF_GM( return new TilingGM(false); )
274 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); ) 270 DEF_GM( return new Tiling2GM(make_bm, "bitmap"); )
275 DEF_GM( return new Tiling2GM(make_grad, "gradient"); ) 271 DEF_GM( return new Tiling2GM(make_grad, "gradient"); )
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698