aboutsummaryrefslogtreecommitdiffhomepage
path: root/unix_test_app/DrawBlueSample.cpp
blob: 83e6fd5eaba5930fc5309415fb48c7095afff939 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

/*
 * Copyright 2011 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#include "SampleCode.h"
#include "SkCanvas.h"
#include "SkColor.h"
#include "SkEvent.h"
#include "SkView.h"

class DrawBlue : public SkView {

public:
     DrawBlue() {}
protected:
    virtual void onDraw(SkCanvas* canvas) {
        canvas->drawColor(SK_ColorBLUE);
    }
    virtual bool onQuery(SkEvent* evt) {
        if (SampleCode::TitleQ(*evt)) {
            SampleCode::TitleR(evt, "DrawBlue");
            return true;
        }
        return this->INHERITED::onQuery(evt);
    }
private:
    typedef SkView INHERITED;
};

static SkView* MyFactory() { return new DrawBlue; }
static SkViewRegister reg(MyFactory);