Index: example/HelloWorld.cpp |
diff --git a/experimental/SkiaExamples/SkExample.cpp b/example/HelloWorld.cpp |
similarity index 86% |
copy from experimental/SkiaExamples/SkExample.cpp |
copy to example/HelloWorld.cpp |
index 849c14b3ec2ba962e3b448c4c9c34af1e99af725..495d2af5985b525b792af1ad42c4a5f74a14f5e8 100644 |
--- a/experimental/SkiaExamples/SkExample.cpp |
+++ b/example/HelloWorld.cpp |
@@ -1,5 +1,5 @@ |
/* |
- * Copyright 2013 Google Inc. |
+ * Copyright 2015 Google Inc. |
* |
* |
* Use of this source code is governed by a BSD-style license that can be |
@@ -7,7 +7,7 @@ |
* |
*/ |
-#include "SkExample.h" |
+#include "HelloWorld.h" |
#include "gl/GrGLInterface.h" |
#include "SkApplication.h" |
@@ -26,20 +26,20 @@ void application_term() { |
SkGraphics::Term(); |
} |
-SkExampleWindow::SkExampleWindow(void* hwnd) |
+HelloWorldWindow::HelloWorldWindow(void* hwnd) |
: INHERITED(hwnd) { |
- fType = SkExampleWindow::kGPU_DeviceType; |
+ fType = kGPU_DeviceType; |
fRenderTarget = NULL; |
fRotationAngle = 0; |
this->setTitle(); |
this->setUpBackend(); |
} |
-SkExampleWindow::~SkExampleWindow() { |
+HelloWorldWindow::~HelloWorldWindow() { |
tearDownBackend(); |
} |
-void SkExampleWindow::tearDownBackend() { |
+void HelloWorldWindow::tearDownBackend() { |
SkSafeUnref(fContext); |
fContext = NULL; |
@@ -52,13 +52,13 @@ void SkExampleWindow::tearDownBackend() { |
INHERITED::detach(); |
} |
-void SkExampleWindow::setTitle() { |
- SkString title("SkiaExample "); |
+void HelloWorldWindow::setTitle() { |
+ SkString title("Hello World "); |
title.appendf(fType == kRaster_DeviceType ? "raster" : "opengl"); |
INHERITED::setTitle(title.c_str()); |
} |
-bool SkExampleWindow::setUpBackend() { |
+bool HelloWorldWindow::setUpBackend() { |
this->setColorType(kRGBA_8888_SkColorType); |
this->setVisibleP(true); |
this->setClipToBounds(false); |
@@ -81,12 +81,12 @@ bool SkExampleWindow::setUpBackend() { |
return true; |
} |
-void SkExampleWindow::setUpRenderTarget() { |
+void HelloWorldWindow::setUpRenderTarget() { |
SkSafeUnref(fRenderTarget); |
fRenderTarget = this->renderTarget(fAttachmentInfo, fInterface, fContext); |
} |
-void SkExampleWindow::drawContents(SkCanvas* canvas) { |
+void HelloWorldWindow::drawContents(SkCanvas* canvas) { |
// Clear background |
canvas->drawColor(SK_ColorWHITE); |
@@ -132,7 +132,7 @@ void SkExampleWindow::drawContents(SkCanvas* canvas) { |
canvas->save(); |
- static const char message[] = "Hello Skia!!!"; |
+ static const char message[] = "Hello World"; |
// Translate and rotate |
canvas->translate(300, 300); |
@@ -148,7 +148,7 @@ void SkExampleWindow::drawContents(SkCanvas* canvas) { |
canvas->restore(); |
} |
-void SkExampleWindow::draw(SkCanvas* canvas) { |
+void HelloWorldWindow::draw(SkCanvas* canvas) { |
drawContents(canvas); |
// in case we have queued drawing calls |
fContext->flush(); |
@@ -173,11 +173,11 @@ void SkExampleWindow::draw(SkCanvas* canvas) { |
INHERITED::present(); |
} |
-void SkExampleWindow::onSizeChange() { |
+void HelloWorldWindow::onSizeChange() { |
setUpRenderTarget(); |
} |
-bool SkExampleWindow::onHandleChar(SkUnichar unichar) { |
+bool HelloWorldWindow::onHandleChar(SkUnichar unichar) { |
if (' ' == unichar) { |
fType = fType == kRaster_DeviceType ? kGPU_DeviceType: kRaster_DeviceType; |
tearDownBackend(); |
@@ -189,5 +189,5 @@ bool SkExampleWindow::onHandleChar(SkUnichar unichar) { |
} |
SkOSWindow* create_sk_window(void* hwnd, int , char** ) { |
- return new SkExampleWindow(hwnd); |
+ return new HelloWorldWindow(hwnd); |
} |