epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +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 | */ |
scroggo | b66365f | 2011-03-18 21:43:03 +0000 | [diff] [blame] | 8 | #include "SampleCode.h" |
scroggo | b7e9aee | 2011-03-15 15:15:15 +0000 | [diff] [blame] | 9 | #include "SkCanvas.h" |
| 10 | #include "SkColor.h" |
scroggo | b66365f | 2011-03-18 21:43:03 +0000 | [diff] [blame] | 11 | #include "SkEvent.h" |
scroggo | b7e9aee | 2011-03-15 15:15:15 +0000 | [diff] [blame] | 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 | } |
scroggo | b66365f | 2011-03-18 21:43:03 +0000 | [diff] [blame] | 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; |
scroggo | b7e9aee | 2011-03-15 15:15:15 +0000 | [diff] [blame] | 31 | }; |
| 32 | |
| 33 | static SkView* MyFactory() { return new DrawBlue; } |
| 34 | static SkViewRegister reg(MyFactory); |