OLD | NEW |
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" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 } | 42 } |
43 | 43 |
44 class RepeatTileView : public SampleView { | 44 class RepeatTileView : public SampleView { |
45 public: | 45 public: |
46 RepeatTileView() { | 46 RepeatTileView() { |
47 this->setBGColor(SK_ColorGRAY); | 47 this->setBGColor(SK_ColorGRAY); |
48 } | 48 } |
49 | 49 |
50 protected: | 50 protected: |
51 // overrides from SkEventSink | 51 // overrides from SkEventSink |
52 virtual bool onQuery(SkEvent* evt) SK_OVERRIDE { | 52 bool onQuery(SkEvent* evt) SK_OVERRIDE { |
53 if (SampleCode::TitleQ(*evt)) { | 53 if (SampleCode::TitleQ(*evt)) { |
54 SampleCode::TitleR(evt, "RepeatTile"); | 54 SampleCode::TitleR(evt, "RepeatTile"); |
55 return true; | 55 return true; |
56 } | 56 } |
57 return this->INHERITED::onQuery(evt); | 57 return this->INHERITED::onQuery(evt); |
58 } | 58 } |
59 | 59 |
60 virtual void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { | 60 void onDrawContent(SkCanvas* canvas) SK_OVERRIDE { |
61 SkPaint paint; | 61 SkPaint paint; |
62 make_paint(&paint, SkShader::kRepeat_TileMode); | 62 make_paint(&paint, SkShader::kRepeat_TileMode); |
63 | 63 |
64 // canvas->scale(SK_Scalar1*2, SK_Scalar1); | 64 // canvas->scale(SK_Scalar1*2, SK_Scalar1); |
65 canvas->translate(SkIntToScalar(100), SkIntToScalar(100)); | 65 canvas->translate(SkIntToScalar(100), SkIntToScalar(100)); |
66 canvas->drawPaint(paint); | 66 canvas->drawPaint(paint); |
67 } | 67 } |
68 | 68 |
69 virtual SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned m
odi) SK_OVERRIDE { | 69 SkView::Click* onFindClickHandler(SkScalar x, SkScalar y, unsigned modi) SK_
OVERRIDE { |
70 this->inval(NULL); | 70 this->inval(NULL); |
71 | 71 |
72 return this->INHERITED::onFindClickHandler(x, y, modi); | 72 return this->INHERITED::onFindClickHandler(x, y, modi); |
73 } | 73 } |
74 | 74 |
75 virtual bool onClick(Click* click) SK_OVERRIDE { | 75 bool onClick(Click* click) SK_OVERRIDE { |
76 return this->INHERITED::onClick(click); | 76 return this->INHERITED::onClick(click); |
77 } | 77 } |
78 | 78 |
79 virtual bool handleKey(SkKey) { | 79 virtual bool handleKey(SkKey) { |
80 this->inval(NULL); | 80 this->inval(NULL); |
81 return true; | 81 return true; |
82 } | 82 } |
83 | 83 |
84 private: | 84 private: |
85 typedef SampleView INHERITED; | 85 typedef SampleView INHERITED; |
86 }; | 86 }; |
87 | 87 |
88 ////////////////////////////////////////////////////////////////////////////// | 88 ////////////////////////////////////////////////////////////////////////////// |
89 | 89 |
90 static SkView* MyFactory() { return new RepeatTileView; } | 90 static SkView* MyFactory() { return new RepeatTileView; } |
91 static SkViewRegister reg(MyFactory); | 91 static SkViewRegister reg(MyFactory); |
OLD | NEW |