epoger@google.com | 5aab340 | 2012-03-22 15:15:07 +0000 | [diff] [blame^] | 1 | |
| 2 | /* |
| 3 | * Copyright 2011 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
| 7 | */ |
| 8 | #include "SampleCode.h" |
| 9 | #include "SkCanvas.h" |
| 10 | #include "SkColor.h" |
| 11 | #include "SkEvent.h" |
| 12 | #include "SkView.h" |
| 13 | |
| 14 | class DrawBlue : public SkView { |
| 15 | |
| 16 | public: |
| 17 | DrawBlue() {} |
| 18 | protected: |
| 19 | virtual void onDraw(SkCanvas* canvas) { |
| 20 | canvas->drawColor(SK_ColorBLUE); |
| 21 | } |
| 22 | virtual bool onQuery(SkEvent* evt) { |
| 23 | if (SampleCode::TitleQ(*evt)) { |
| 24 | SampleCode::TitleR(evt, "DrawBlue"); |
| 25 | return true; |
| 26 | } |
| 27 | return this->INHERITED::onQuery(evt); |
| 28 | } |
| 29 | private: |
| 30 | typedef SkView INHERITED; |
| 31 | }; |
| 32 | |
| 33 | static SkView* MyFactory() { return new DrawBlue; } |
| 34 | static SkViewRegister reg(MyFactory); |