diff options
Diffstat (limited to 'src/gpu/gr_hello_world.cpp')
-rw-r--r-- | src/gpu/gr_hello_world.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/gpu/gr_hello_world.cpp b/src/gpu/gr_hello_world.cpp new file mode 100644 index 0000000..b475fb8 --- /dev/null +++ b/src/gpu/gr_hello_world.cpp @@ -0,0 +1,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 "SkGLCanvas.h" +#include "SkBitmap.h" +#include "SkPaint.h" +#include "SkGpuGLShaders.h" + +extern "C" { + void gr_hello_world(); +} + +void gr_hello_world() { + static GrGpu* gGpu; + if (NULL == gGpu) { + gGpu = new 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); +} + + |