Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(234)

Side by Side Diff: samplecode/SampleOverflow.cpp

Issue 96099: Whitespace fix: remove whitespace from the end of lines.
Patch Set: Created 16 years, 11 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « samplecode/SampleNinePatch.cpp ('k') | samplecode/SamplePageFlip.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 #include "SampleCode.h" 1 #include "SampleCode.h"
2 #include "SkView.h" 2 #include "SkView.h"
3 #include "SkCanvas.h" 3 #include "SkCanvas.h"
4 #include "SkDevice.h" 4 #include "SkDevice.h"
5 #include "SkPaint.h" 5 #include "SkPaint.h"
6 6
7 static void DrawRoundRect() { 7 static void DrawRoundRect() {
8 #ifdef SK_SCALAR_IS_FIXED 8 #ifdef SK_SCALAR_IS_FIXED
9 bool ret = false; 9 bool ret = false;
10 SkPaint paint; 10 SkPaint paint;
11 SkBitmap bitmap; 11 SkBitmap bitmap;
12 SkCanvas canvas; 12 SkCanvas canvas;
13 SkMatrix matrix; 13 SkMatrix matrix;
14 matrix.reset(); 14 matrix.reset();
15 15
16 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 1370, 812); 16 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 1370, 812);
17 bitmap.allocPixels(); 17 bitmap.allocPixels();
18 canvas.setBitmapDevice(bitmap); 18 canvas.setBitmapDevice(bitmap);
19 19
20 // set up clipper 20 // set up clipper
21 SkRect skclip; 21 SkRect skclip;
22 skclip.set(SkIntToFixed(284), SkIntToFixed(40), SkIntToFixed(1370), SkIntToF ixed(708)); 22 skclip.set(SkIntToFixed(284), SkIntToFixed(40), SkIntToFixed(1370), SkIntToF ixed(708));
23 23
24 ret = canvas.clipRect(skclip); 24 ret = canvas.clipRect(skclip);
25 SkASSERT(ret); 25 SkASSERT(ret);
26 26
27 matrix.set(SkMatrix::kMTransX, SkFloatToFixed(-1153.28)); 27 matrix.set(SkMatrix::kMTransX, SkFloatToFixed(-1153.28));
28 matrix.set(SkMatrix::kMTransY, SkFloatToFixed(1180.50)); 28 matrix.set(SkMatrix::kMTransY, SkFloatToFixed(1180.50));
29 29
30 matrix.set(SkMatrix::kMScaleX, SkFloatToFixed(0.177171)); 30 matrix.set(SkMatrix::kMScaleX, SkFloatToFixed(0.177171));
31 matrix.set(SkMatrix::kMScaleY, SkFloatToFixed(0.177043)); 31 matrix.set(SkMatrix::kMScaleY, SkFloatToFixed(0.177043));
32 32
33 matrix.set(SkMatrix::kMSkewX, SkFloatToFixed(0.126968)); 33 matrix.set(SkMatrix::kMSkewX, SkFloatToFixed(0.126968));
34 matrix.set(SkMatrix::kMSkewY, SkFloatToFixed(-0.126876)); 34 matrix.set(SkMatrix::kMSkewY, SkFloatToFixed(-0.126876));
35 35
36 matrix.set(SkMatrix::kMPersp0, SkFloatToFixed(0.0)); 36 matrix.set(SkMatrix::kMPersp0, SkFloatToFixed(0.0));
37 matrix.set(SkMatrix::kMPersp1, SkFloatToFixed(0.0)); 37 matrix.set(SkMatrix::kMPersp1, SkFloatToFixed(0.0));
38 38
39 ret = canvas.concat(matrix); 39 ret = canvas.concat(matrix);
40 40
41 paint.setAntiAlias(true); 41 paint.setAntiAlias(true);
42 paint.setColor(0xb2202020); 42 paint.setColor(0xb2202020);
43 paint.setStyle(SkPaint::kStroke_Style); 43 paint.setStyle(SkPaint::kStroke_Style);
44 paint.setStrokeWidth(SkFloatToFixed(68.13)); 44 paint.setStrokeWidth(SkFloatToFixed(68.13));
45 45
46 SkRect r; 46 SkRect r;
47 r.set(SkFloatToFixed(-313.714417), SkFloatToFixed(-4.826389), SkFloatToFixed (18014.447266), SkFloatToFixed(1858.154541)); 47 r.set(SkFloatToFixed(-313.714417), SkFloatToFixed(-4.826389), SkFloatToFixed (18014.447266), SkFloatToFixed(1858.154541));
48 canvas.drawRoundRect(r, SkFloatToFixed(91.756363), SkFloatToFixed(91.756363) , paint); 48 canvas.drawRoundRect(r, SkFloatToFixed(91.756363), SkFloatToFixed(91.756363) , paint);
49 #endif 49 #endif
50 } 50 }
51 51
52 static bool HitTestPath(const SkPath& path, SkScalar x, SkScalar y) { 52 static bool HitTestPath(const SkPath& path, SkScalar x, SkScalar y) {
53 SkRegion rgn, clip; 53 SkRegion rgn, clip;
54 54
55 int ix = SkScalarFloor(x); 55 int ix = SkScalarFloor(x);
56 int iy = SkScalarFloor(y); 56 int iy = SkScalarFloor(y);
57 57
58 clip.setRect(ix, iy, ix + 1, iy + 1); 58 clip.setRect(ix, iy, ix + 1, iy + 1);
59 59
60 bool contains = rgn.setPath(path, clip); 60 bool contains = rgn.setPath(path, clip);
61 return contains; 61 return contains;
62 } 62 }
63 63
64 static void TestOverflowHitTest() { 64 static void TestOverflowHitTest() {
65 SkPath path; 65 SkPath path;
66 66
67 #ifdef SK_SCALAR_IS_FLOATx 67 #ifdef SK_SCALAR_IS_FLOATx
68 path.addCircle(0, 0, 70000, SkPath::kCCW_Direction); 68 path.addCircle(0, 0, 70000, SkPath::kCCW_Direction);
69 SkASSERT(HitTestPath(path, 40000, 40000)); 69 SkASSERT(HitTestPath(path, 40000, 40000));
70 #endif 70 #endif
71 } 71 }
72 72
73 class OverflowView : public SkView { 73 class OverflowView : public SkView {
74 public: 74 public:
75 OverflowView() {} 75 OverflowView() {}
76 76
77 protected: 77 protected:
78 // overrides from SkEventSink 78 // overrides from SkEventSink
79 virtual bool onQuery(SkEvent* evt) { 79 virtual bool onQuery(SkEvent* evt) {
80 if (SampleCode::TitleQ(*evt)) { 80 if (SampleCode::TitleQ(*evt)) {
81 SampleCode::TitleR(evt, "Circles"); 81 SampleCode::TitleR(evt, "Circles");
82 return true; 82 return true;
83 } 83 }
84 return this->INHERITED::onQuery(evt); 84 return this->INHERITED::onQuery(evt);
85 } 85 }
86 86
87 void drawBG(SkCanvas* canvas) { 87 void drawBG(SkCanvas* canvas) {
88 canvas->drawColor(SK_ColorWHITE); 88 canvas->drawColor(SK_ColorWHITE);
89 } 89 }
90 90
91 virtual void onDraw(SkCanvas* canvas) { 91 virtual void onDraw(SkCanvas* canvas) {
92 this->drawBG(canvas); 92 this->drawBG(canvas);
93 93
94 DrawRoundRect(); 94 DrawRoundRect();
95 TestOverflowHitTest(); 95 TestOverflowHitTest();
96 } 96 }
97 97
98 private: 98 private:
99 typedef SkView INHERITED; 99 typedef SkView INHERITED;
100 }; 100 };
101 101
102 ////////////////////////////////////////////////////////////////////////////// 102 //////////////////////////////////////////////////////////////////////////////
103 103
104 static SkView* MyFactory() { return new OverflowView; } 104 static SkView* MyFactory() { return new OverflowView; }
105 static SkViewRegister reg(MyFactory); 105 static SkViewRegister reg(MyFactory);
106 106
OLDNEW
« no previous file with comments | « samplecode/SampleNinePatch.cpp ('k') | samplecode/SamplePageFlip.cpp » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b