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

Side by Side Diff: gm/cubicpaths.cpp

Issue 15875012: use SkScalar instead of int for loops, to avoid warning in canvas->translate() calls (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 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 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 #include "gm.h" 7 #include "gm.h"
8 #include "SkCanvas.h" 8 #include "SkCanvas.h"
9 #include "SkPaint.h" 9 #include "SkPaint.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 12 matching lines...) Expand all
23 SkISize onISize() { return SkISize::Make(1240, 390); } 23 SkISize onISize() { return SkISize::Make(1240, 390); }
24 24
25 virtual void onDraw(SkCanvas* canvas) { 25 virtual void onDraw(SkCanvas* canvas) {
26 SkPath path; 26 SkPath path;
27 path.moveTo(0, 0); 27 path.moveTo(0, 0);
28 path.cubicTo(140, 150, 40, 10, 170, 150); 28 path.cubicTo(140, 150, 40, 10, 170, 150);
29 29
30 SkPaint paint; 30 SkPaint paint;
31 SkRect bounds = path.getBounds(); 31 SkRect bounds = path.getBounds();
32 32
33 for (int dy = -1; dy <= 1; ++dy) { 33 for (SkScalar dy = -1; dy <= 1; dy += 1) {
34 canvas->save(); 34 canvas->save();
35 for (int dx = -1; dx <= 1; ++dx) { 35 for (SkScalar dx = -1; dx <= 1; dx += 1) {
36 canvas->save(); 36 canvas->save();
37 canvas->clipRect(bounds); 37 canvas->clipRect(bounds);
38 canvas->translate(dx, dy); 38 canvas->translate(dx, dy);
39 canvas->drawPath(path, paint); 39 canvas->drawPath(path, paint);
40 canvas->restore(); 40 canvas->restore();
41 41
42 canvas->translate(bounds.width(), 0); 42 canvas->translate(bounds.width(), 0);
43 } 43 }
44 canvas->restore(); 44 canvas->restore();
45 canvas->translate(0, bounds.height()); 45 canvas->translate(0, bounds.height());
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 335
336 private: 336 private:
337 typedef skiagm::GM INHERITED; 337 typedef skiagm::GM INHERITED;
338 }; 338 };
339 339
340 ////////////////////////////////////////////////////////////////////////////// 340 //////////////////////////////////////////////////////////////////////////////
341 341
342 DEF_GM( return new CubicPathGM; ) 342 DEF_GM( return new CubicPathGM; )
343 DEF_GM( return new CubicClosePathGM; ) 343 DEF_GM( return new CubicClosePathGM; )
344 DEF_GM( return new ClippedCubicGM; ) 344 DEF_GM( return new ClippedCubicGM; )
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