aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gr_hello_world.cpp
blob: e9e8f8dfd0567f4ee46b9f45bb1911828bbab649 (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
35
36
37

/*
 * 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 "gl/SkGLCanvas.h"
#include "SkBitmap.h"
#include "SkPaint.h"
#include "gl/SkGpuGLShaders.h"

extern "C" {
    void gr_hello_world();
}

void gr_hello_world() {
    static GrGpu* gGpu;
    if (NULL == gGpu) {
        gGpu = SkNEW(SkGpuGLShaders);
    }

    SkGLCanvas canvas(gGpu);
    SkBitmap bm;

    bm.setConfig(SkBitmap::kARGB_8888_Config, WIDTH, HEIGHT);
    canvas.setBitmapDevice(bm);

    canvas.drawColor(SK_ColorWHITE);

    SkPaint paint;
    paint.setAntiAlias(true);
    paint.setTextSize(30);
    canvas.drawText("Hello Kno", 9, 40, 40, paint);
}