aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-09-18 11:29:01 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-18 11:29:01 -0700
commit0397e9f3415b4646797f1b17e9a38b5deb864ff0 (patch)
tree4196fc5ddf00a1f267c4be1415d897e6160931d6 /samplecode
parent9b222a5ddd3b39ca191d8443bade6052cdcb713d (diff)
use surface in SkView/SampleApp
BUG=skia: R=bsalomon@google.com, robertphillips@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/580073003
Diffstat (limited to 'samplecode')
-rw-r--r--samplecode/SampleApp.cpp13
-rw-r--r--samplecode/SampleApp.h16
-rw-r--r--samplecode/SampleBitmapRect.cpp6
3 files changed, 13 insertions, 22 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 9d7e727ce5..08e7240f98 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -271,17 +271,14 @@ public:
fBackend = kNone_BackEndType;
}
- virtual SkCanvas* createCanvas(SampleWindow::DeviceType dType,
- SampleWindow* win) {
+ virtual SkSurface* createSurface(SampleWindow::DeviceType dType,
+ SampleWindow* win) SK_OVERRIDE {
#if SK_SUPPORT_GPU
if (IsGpuDeviceType(dType) && fCurContext) {
- SkAutoTUnref<SkBaseDevice> device(SkGpuDevice::Create(fCurRenderTarget));
- return new SkCanvas(device);
- } else
-#endif
- {
- return NULL;
+ return SkSurface::NewRenderTargetDirect(fCurRenderTarget);
}
+#endif
+ return NULL;
}
virtual void publishCanvas(SampleWindow::DeviceType dType,
diff --git a/samplecode/SampleApp.h b/samplecode/SampleApp.h
index e08ff8a8f4..abb1f24002 100644
--- a/samplecode/SampleApp.h
+++ b/samplecode/SampleApp.h
@@ -76,7 +76,7 @@ public:
// called before drawing. should install correct device
// type on the canvas. Will skip drawing if returns false.
- virtual SkCanvas* createCanvas(DeviceType dType, SampleWindow* win) = 0;
+ virtual SkSurface* createSurface(DeviceType dType, SampleWindow* win) = 0;
// called after drawing, should get the results onto the
// screen.
@@ -100,18 +100,18 @@ public:
SampleWindow(void* hwnd, int argc, char** argv, DeviceManager*);
virtual ~SampleWindow();
- virtual SkCanvas* createCanvas() SK_OVERRIDE {
- SkCanvas* canvas = NULL;
+ virtual SkSurface* createSurface() SK_OVERRIDE {
+ SkSurface* surface = NULL;
if (fDevManager) {
- canvas = fDevManager->createCanvas(fDeviceType, this);
+ surface = fDevManager->createSurface(fDeviceType, this);
}
- if (NULL == canvas) {
- canvas = this->INHERITED::createCanvas();
+ if (NULL == surface) {
+ surface = this->INHERITED::createSurface();
}
- return canvas;
+ return surface;
}
- virtual void draw(SkCanvas* canvas);
+ virtual void draw(SkCanvas*) SK_OVERRIDE;
void setDeviceType(DeviceType type);
void toggleRendering();
diff --git a/samplecode/SampleBitmapRect.cpp b/samplecode/SampleBitmapRect.cpp
index cf1196c62d..006b919554 100644
--- a/samplecode/SampleBitmapRect.cpp
+++ b/samplecode/SampleBitmapRect.cpp
@@ -24,12 +24,6 @@
#include "SkOSFile.h"
#include "SkStream.h"
-#if SK_SUPPORT_GPU
-#include "SkGpuDevice.h"
-#else
-class GrContext;
-#endif
-
#define INT_SIZE 64
#define SCALAR_SIZE SkIntToScalar(INT_SIZE)