blob: 83e6fd5eaba5930fc5309415fb48c7095afff939 [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
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 */
scroggob66365f2011-03-18 21:43:03 +00008#include "SampleCode.h"
scroggob7e9aee2011-03-15 15:15:15 +00009#include "SkCanvas.h"
10#include "SkColor.h"
scroggob66365f2011-03-18 21:43:03 +000011#include "SkEvent.h"
scroggob7e9aee2011-03-15 15:15:15 +000012#include "SkView.h"
13
14class DrawBlue : public SkView {
15
16public:
17 DrawBlue() {}
18protected:
19 virtual void onDraw(SkCanvas* canvas) {
20 canvas->drawColor(SK_ColorBLUE);
21 }
scroggob66365f2011-03-18 21:43:03 +000022 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 }
29private:
30 typedef SkView INHERITED;
scroggob7e9aee2011-03-15 15:15:15 +000031};
32
33static SkView* MyFactory() { return new DrawBlue; }
34static SkViewRegister reg(MyFactory);