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

Side by Side Diff: samplecode/SampleDegenerateTwoPtRadials.cpp

Issue 27044002: Clean up SkTypes.h. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: For patch -p1. Created 7 years, 2 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 | « include/core/SkTypes.h ('k') | samplecode/SampleEmptyPath.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 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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
11 #include "Sk64.h" 11 #include "Sk64.h"
12 #include "SkGradientShader.h" 12 #include "SkGradientShader.h"
13 #include "SkString.h"
13 14
14 static void draw_gradient2(SkCanvas* canvas, const SkRect& rect, SkScalar delta) { 15 static void draw_gradient2(SkCanvas* canvas, const SkRect& rect, SkScalar delta) {
15 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorMAGEN TA }; 16 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorMAGEN TA };
16 SkScalar pos[] = { 0, SkFloatToScalar(0.25f), SkFloatToScalar(0.75f), SK_Sca lar1 }; 17 SkScalar pos[] = { 0, SkFloatToScalar(0.25f), SkFloatToScalar(0.75f), SK_Sca lar1 };
17 18
18 SkScalar l = rect.fLeft; 19 SkScalar l = rect.fLeft;
19 SkScalar t = rect.fTop; 20 SkScalar t = rect.fTop;
20 SkScalar w = rect.width(); 21 SkScalar w = rect.width();
21 SkScalar h = rect.height(); 22 SkScalar h = rect.height();
22 23
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 65 }
65 delta -= SK_ScalarHalf; 66 delta -= SK_ScalarHalf;
66 static const int DELTA_SCALE = 500; 67 static const int DELTA_SCALE = 500;
67 delta /= DELTA_SCALE; 68 delta /= DELTA_SCALE;
68 69
69 SkScalar w = SK_Scalar1 * 500; 70 SkScalar w = SK_Scalar1 * 500;
70 SkScalar h = SK_Scalar1 * 500; 71 SkScalar h = SK_Scalar1 * 500;
71 SkScalar l = SK_Scalar1 * 100; 72 SkScalar l = SK_Scalar1 * 100;
72 SkScalar t = SK_Scalar1 * 100; 73 SkScalar t = SK_Scalar1 * 100;
73 draw_gradient2(canvas, SkRect::MakeXYWH(l, t, w, h), delta); 74 draw_gradient2(canvas, SkRect::MakeXYWH(l, t, w, h), delta);
74 char txt[512]; 75 SkString txt;
75 sprintf(txt, "gap at \"tangent\" pt = %f", SkScalarToFloat(delta)); 76 txt.appendf("gap at \"tangent\" pt = %f", SkScalarToFloat(delta));
76 SkPaint paint; 77 SkPaint paint;
77 paint.setAntiAlias(true); 78 paint.setAntiAlias(true);
78 paint.setColor(SK_ColorBLACK); 79 paint.setColor(SK_ColorBLACK);
79 canvas->drawText(txt, strlen(txt), l + w/2 + w*DELTA_SCALE*delta, t + h + SK_Scalar1 * 10, paint); 80 canvas->drawText(txt.c_str(), txt.size(), l + w/2 + w*DELTA_SCALE*delta, t + h + SK_Scalar1 * 10, paint);
80 this->inval(NULL); 81 this->inval(NULL);
81 } 82 }
82 83
83 private: 84 private:
84 SkScalar fTime; 85 SkScalar fTime;
85 typedef SampleView INHERITED; 86 typedef SampleView INHERITED;
86 }; 87 };
87 88
88 ////////////////////////////////////////////////////////////////////////////// 89 //////////////////////////////////////////////////////////////////////////////
89 90
90 static SkView* MyFactory() { return new DegenerateTwoPtRadialsView; } 91 static SkView* MyFactory() { return new DegenerateTwoPtRadialsView; }
91 static SkViewRegister reg(MyFactory); 92 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/core/SkTypes.h ('k') | samplecode/SampleEmptyPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698