Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(457)

Unified Diff: example/HelloWorld.cpp

Issue 886413004: move HelloWorld to be a peer of SampleApp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: exclude android as well Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « example/HelloWorld.h ('k') | example/mac/HelloWorld.xib » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
}
« no previous file with comments | « example/HelloWorld.h ('k') | example/mac/HelloWorld.xib » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698