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

Side by Side Diff: gm/gradients.cpp

Issue 23851037: make gradients gm view size larger, as it is choping from the pained canvas. (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 | « expectations/gm/ignored-tests.txt ('k') | 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 "SkGradientShader.h" 9 #include "SkGradientShader.h"
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 public: 101 public:
102 GradientsGM() { 102 GradientsGM() {
103 this->setBGColor(0xFFDDDDDD); 103 this->setBGColor(0xFFDDDDDD);
104 } 104 }
105 105
106 protected: 106 protected:
107 SkString onShortName() { 107 SkString onShortName() {
108 return SkString("gradients"); 108 return SkString("gradients");
109 } 109 }
110 110
111 virtual SkISize onISize() { return make_isize(640, 615); } 111 virtual SkISize onISize() { return SkISize::Make(840, 815); }
112 112
113 virtual void onDraw(SkCanvas* canvas) { 113 virtual void onDraw(SkCanvas* canvas) {
114 114
115 SkPoint pts[2] = { 115 SkPoint pts[2] = {
116 { 0, 0 }, 116 { 0, 0 },
117 { SkIntToScalar(100), SkIntToScalar(100) } 117 { SkIntToScalar(100), SkIntToScalar(100) }
118 }; 118 };
119 SkShader::TileMode tm = SkShader::kClamp_TileMode; 119 SkShader::TileMode tm = SkShader::kClamp_TileMode;
120 SkRect r = { 0, 0, SkIntToScalar(100), SkIntToScalar(100) }; 120 SkRect r = { 0, 0, SkIntToScalar(100), SkIntToScalar(100) };
121 SkPaint paint; 121 SkPaint paint;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 public: 154 public:
155 GradientsLocalPerspectiveGM() { 155 GradientsLocalPerspectiveGM() {
156 this->setBGColor(0xFFDDDDDD); 156 this->setBGColor(0xFFDDDDDD);
157 } 157 }
158 158
159 protected: 159 protected:
160 SkString onShortName() { 160 SkString onShortName() {
161 return SkString("gradients_local_perspective"); 161 return SkString("gradients_local_perspective");
162 } 162 }
163 163
164 virtual SkISize onISize() { return make_isize(640, 615); } 164 virtual SkISize onISize() { return SkISize::Make(840, 815); }
165 165
166 virtual void onDraw(SkCanvas* canvas) { 166 virtual void onDraw(SkCanvas* canvas) {
167 167
168 SkPoint pts[2] = { 168 SkPoint pts[2] = {
169 { 0, 0 }, 169 { 0, 0 },
170 { SkIntToScalar(100), SkIntToScalar(100) } 170 { SkIntToScalar(100), SkIntToScalar(100) }
171 }; 171 };
172 SkShader::TileMode tm = SkShader::kClamp_TileMode; 172 SkShader::TileMode tm = SkShader::kClamp_TileMode;
173 SkRect r = { 0, 0, SkIntToScalar(100), SkIntToScalar(100) }; 173 SkRect r = { 0, 0, SkIntToScalar(100), SkIntToScalar(100) };
174 SkPaint paint; 174 SkPaint paint;
(...skipping 30 matching lines...) Expand all
205 }; 205 };
206 206
207 // Based on the original gradient slide, but with perspective applied to 207 // Based on the original gradient slide, but with perspective applied to
208 // the view matrix 208 // the view matrix
209 class GradientsViewPerspectiveGM : public GradientsGM { 209 class GradientsViewPerspectiveGM : public GradientsGM {
210 protected: 210 protected:
211 SkString onShortName() { 211 SkString onShortName() {
212 return SkString("gradients_view_perspective"); 212 return SkString("gradients_view_perspective");
213 } 213 }
214 214
215 virtual SkISize onISize() { return make_isize(640, 400); } 215 virtual SkISize onISize() { return SkISize::Make(840, 500); }
216 216
217 virtual void onDraw(SkCanvas* canvas) { 217 virtual void onDraw(SkCanvas* canvas) {
218 SkMatrix perspective; 218 SkMatrix perspective;
219 perspective.setIdentity(); 219 perspective.setIdentity();
220 perspective.setPerspY(SkScalarDiv(SK_Scalar1, SkIntToScalar(1000))); 220 perspective.setPerspY(SkScalarDiv(SK_Scalar1, SkIntToScalar(1000)));
221 perspective.setSkewX(SkScalarDiv(SkIntToScalar(8), SkIntToScalar(25))); 221 perspective.setSkewX(SkScalarDiv(SkIntToScalar(8), SkIntToScalar(25)));
222 canvas->concat(perspective); 222 canvas->concat(perspective);
223 INHERITED::onDraw(canvas); 223 INHERITED::onDraw(canvas);
224 } 224 }
225 225
(...skipping 19 matching lines...) Expand all
245 */ 245 */
246 class GradientsDegenrate2PointGM : public GM { 246 class GradientsDegenrate2PointGM : public GM {
247 public: 247 public:
248 GradientsDegenrate2PointGM() {} 248 GradientsDegenrate2PointGM() {}
249 249
250 protected: 250 protected:
251 SkString onShortName() { 251 SkString onShortName() {
252 return SkString("gradients_degenerate_2pt"); 252 return SkString("gradients_degenerate_2pt");
253 } 253 }
254 254
255 virtual SkISize onISize() { return make_isize(320, 320); } 255 virtual SkISize onISize() { return SkISize::Make(320, 320); }
256 256
257 void drawBG(SkCanvas* canvas) { 257 void drawBG(SkCanvas* canvas) {
258 canvas->drawColor(SK_ColorBLUE); 258 canvas->drawColor(SK_ColorBLUE);
259 } 259 }
260 260
261 virtual void onDraw(SkCanvas* canvas) { 261 virtual void onDraw(SkCanvas* canvas) {
262 this->drawBG(canvas); 262 this->drawBG(canvas);
263 263
264 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorGREEN, SK_Color RED }; 264 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorGREEN, SK_Color RED };
265 SkScalar pos[] = { 0, SkFloatToScalar(0.01f), SkFloatToScalar(0.99f), SK _Scalar1 }; 265 SkScalar pos[] = { 0, SkFloatToScalar(0.01f), SkFloatToScalar(0.99f), SK _Scalar1 };
(...skipping 17 matching lines...) Expand all
283 283
284 /// Tests correctness of *optimized* codepaths in gradients. 284 /// Tests correctness of *optimized* codepaths in gradients.
285 285
286 class ClampedGradientsGM : public GM { 286 class ClampedGradientsGM : public GM {
287 public: 287 public:
288 ClampedGradientsGM() {} 288 ClampedGradientsGM() {}
289 289
290 protected: 290 protected:
291 SkString onShortName() { return SkString("clamped_gradients"); } 291 SkString onShortName() { return SkString("clamped_gradients"); }
292 292
293 virtual SkISize onISize() { return make_isize(640, 510); } 293 virtual SkISize onISize() { return SkISize::Make(640, 510); }
294 294
295 void drawBG(SkCanvas* canvas) { 295 void drawBG(SkCanvas* canvas) {
296 canvas->drawColor(0xFFDDDDDD); 296 canvas->drawColor(0xFFDDDDDD);
297 } 297 }
298 298
299 virtual void onDraw(SkCanvas* canvas) { 299 virtual void onDraw(SkCanvas* canvas) {
300 this->drawBG(canvas); 300 this->drawBG(canvas);
301 301
302 SkRect r = { 0, 0, SkIntToScalar(100), SkIntToScalar(300) }; 302 SkRect r = { 0, 0, SkIntToScalar(100), SkIntToScalar(300) };
303 SkPaint paint; 303 SkPaint paint;
(...skipping 17 matching lines...) Expand all
321 321
322 /// Checks quality of large radial gradients, which may display 322 /// Checks quality of large radial gradients, which may display
323 /// some banding. 323 /// some banding.
324 324
325 class RadialGradientGM : public GM { 325 class RadialGradientGM : public GM {
326 public: 326 public:
327 RadialGradientGM() {} 327 RadialGradientGM() {}
328 328
329 protected: 329 protected:
330 SkString onShortName() { return SkString("radial_gradient"); } 330 SkString onShortName() { return SkString("radial_gradient"); }
331 virtual SkISize onISize() { return make_isize(1280, 1280); } 331 virtual SkISize onISize() { return SkISize::Make(1280, 1280); }
332 void drawBG(SkCanvas* canvas) { 332 void drawBG(SkCanvas* canvas) {
333 canvas->drawColor(0xFF000000); 333 canvas->drawColor(0xFF000000);
334 } 334 }
335 virtual void onDraw(SkCanvas* canvas) { 335 virtual void onDraw(SkCanvas* canvas) {
336 const SkISize dim = this->getISize(); 336 const SkISize dim = this->getISize();
337 337
338 this->drawBG(canvas); 338 this->drawBG(canvas);
339 339
340 SkPaint paint; 340 SkPaint paint;
341 paint.setDither(true); 341 paint.setDither(true);
(...skipping 18 matching lines...) Expand all
360 typedef GM INHERITED; 360 typedef GM INHERITED;
361 }; 361 };
362 362
363 363
364 class RadialGradient2GM : public GM { 364 class RadialGradient2GM : public GM {
365 public: 365 public:
366 RadialGradient2GM() {} 366 RadialGradient2GM() {}
367 367
368 protected: 368 protected:
369 SkString onShortName() { return SkString("radial_gradient2"); } 369 SkString onShortName() { return SkString("radial_gradient2"); }
370 virtual SkISize onISize() { return make_isize(800, 400); } 370 virtual SkISize onISize() { return SkISize::Make(800, 400); }
371 void drawBG(SkCanvas* canvas) { 371 void drawBG(SkCanvas* canvas) {
372 canvas->drawColor(0xFF000000); 372 canvas->drawColor(0xFF000000);
373 } 373 }
374 374
375 // Reproduces the example given in bug 7671058. 375 // Reproduces the example given in bug 7671058.
376 virtual void onDraw(SkCanvas* canvas) { 376 virtual void onDraw(SkCanvas* canvas) {
377 SkPaint paint1, paint2, paint3; 377 SkPaint paint1, paint2, paint3;
378 paint1.setStyle(SkPaint::kFill_Style); 378 paint1.setStyle(SkPaint::kFill_Style);
379 paint2.setStyle(SkPaint::kFill_Style); 379 paint2.setStyle(SkPaint::kFill_Style);
380 paint3.setStyle(SkPaint::kFill_Style); 380 paint3.setStyle(SkPaint::kFill_Style);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 439
440 static GM* MyFactory5(void*) { return new GradientsLocalPerspectiveGM; } 440 static GM* MyFactory5(void*) { return new GradientsLocalPerspectiveGM; }
441 static GMRegistry reg5(MyFactory5); 441 static GMRegistry reg5(MyFactory5);
442 442
443 static GM* MyFactory6(void*) { return new GradientsViewPerspectiveGM; } 443 static GM* MyFactory6(void*) { return new GradientsViewPerspectiveGM; }
444 static GMRegistry reg6(MyFactory6); 444 static GMRegistry reg6(MyFactory6);
445 445
446 static GM* MyFactory7(void*) { return new RadialGradient2GM; } 446 static GM* MyFactory7(void*) { return new RadialGradient2GM; }
447 static GMRegistry reg7(MyFactory7); 447 static GMRegistry reg7(MyFactory7);
448 } 448 }
OLDNEW
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698