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

Side by Side Diff: gm/stringart.cpp

Issue 24276003: One more try at fixing warnings (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: trying to reupload files 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 * Copyright 2013 Google Inc. 2 * Copyright 2013 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 "SkPath.h" 10 #include "SkPath.h"
11 11
12 // Reproduces https://code.google.com/p/chromium/issues/detail?id=279014 12 // Reproduces https://code.google.com/p/chromium/issues/detail?id=279014
13 13
14 static const SkScalar kWidth = SkIntToScalar(640); 14 static const int kWidth = 640;
15 static const SkScalar kHeight = SkIntToScalar(480); 15 static const int kHeight = 480;
16 static const SkScalar kAngle = 0.305f; 16 static const SkScalar kAngle = 0.305f;
17 17
18 // Renders a string art shape. 18 // Renders a string art shape.
19 // The particular shape rendered can be controlled by adjusting kAngle, from 0 t o 1 19 // The particular shape rendered can be controlled by adjusting kAngle, from 0 t o 1
20 20
21 class StringArtGM : public skiagm::GM { 21 class StringArtGM : public skiagm::GM {
22 public: 22 public:
23 StringArtGM() {} 23 StringArtGM() {}
24 24
25 protected: 25 protected:
26 virtual SkString onShortName() { 26 virtual SkString onShortName() {
27 return SkString("stringart"); 27 return SkString("stringart");
28 } 28 }
29 29
30 virtual SkISize onISize() { 30 virtual SkISize onISize() {
31 return SkISize::Make(kWidth, kHeight); 31 return SkISize::Make(kWidth, kHeight);
32 } 32 }
33 33
34 virtual void onDraw(SkCanvas* canvas) { 34 virtual void onDraw(SkCanvas* canvas) {
35 SkScalar angle = kAngle*SK_ScalarPI + SkScalarHalf(SK_ScalarPI); 35 SkScalar angle = kAngle*SK_ScalarPI + SkScalarHalf(SK_ScalarPI);
36 SkScalar size = SkMinScalar(kWidth, kHeight); 36 SkScalar size = SkIntToScalar(SkMin32(kWidth, kHeight));
37 SkPoint center = SkPoint::Make(SkScalarHalf(kWidth), SkScalarHalf(kHeigh t)); 37 SkPoint center = SkPoint::Make(SkScalarHalf(kWidth), SkScalarHalf(kHeigh t));
38 SkScalar length = 5; 38 SkScalar length = 5;
39 SkScalar step = angle; 39 SkScalar step = angle;
40 40
41 SkPath path; 41 SkPath path;
42 path.moveTo(center); 42 path.moveTo(center);
43 43
44 while (length < (SkScalarHalf(size) - 10.f)) 44 while (length < (SkScalarHalf(size) - 10.f))
45 { 45 {
46 SkPoint rp = SkPoint::Make(length*SkScalarCos(step) + center.fX, 46 SkPoint rp = SkPoint::Make(length*SkScalarCos(step) + center.fX,
(...skipping 10 matching lines...) Expand all
57 paint.setColor(0xFF007700); 57 paint.setColor(0xFF007700);
58 58
59 canvas->drawPath(path, paint); 59 canvas->drawPath(path, paint);
60 } 60 }
61 61
62 private: 62 private:
63 typedef GM INHERITED; 63 typedef GM INHERITED;
64 }; 64 };
65 65
66 DEF_GM( return new StringArtGM; ) 66 DEF_GM( return new StringArtGM; )
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