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

Unified Diff: experimental/SkiaExamples/SkExample.h

Issue 890873003: update example (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix mac, remove space 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
Index: experimental/SkiaExamples/SkExample.h
diff --git a/experimental/SkiaExamples/SkExample.h b/experimental/SkiaExamples/SkExample.h
index ee9e36e0d0fb893a727cd965b914844db4f08f83..49c4a9e32bc34cbe62213f606100003d578234f2 100644
--- a/experimental/SkiaExamples/SkExample.h
+++ b/experimental/SkiaExamples/SkExample.h
@@ -10,6 +10,7 @@
#ifndef SkExample_DEFINED
#define SkExample_DEFINED
+#include "SkSurface.h"
#include "SkWindow.h"
#include "SkTRegistry.h"
@@ -44,31 +45,42 @@ public:
kGPU_DeviceType,
};
SkExampleWindow(void* hwnd);
+ virtual ~SkExampleWindow();
bsalomon 2015/01/30 19:19:12 ~SkExampleWindow() SK_OVERRIDE?
caryclark 2015/01/30 19:55:28 Done.
// Changes the device type of the object.
- bool setupBackend(DeviceType type);
- void tearDownBackend();
+ bool setUpBackend();
DeviceType getDeviceType() const { return fType; }
protected:
+ static void release_storage(void* pixels, void* context) {
bsalomon 2015/01/30 19:19:12 ReleaseStorage?
caryclark 2015/01/30 19:55:28 The whole function is unused so I deleted it.
+ SkASSERT(pixels == context);
+ sk_free(pixels);
+ }
+
+ SkSurface* createSurface() SK_OVERRIDE {
+ if (kGPU_DeviceType == fType) {
+ SkSurfaceProps props(INHERITED::getSurfaceProps());
+ return SkSurface::NewRenderTargetDirect(fRenderTarget, &props);
+ }
+ static const SkImageInfo info = SkImageInfo::MakeN32Premul(
+ SkScalarRoundToInt(this->width()), SkScalarRoundToInt(this->height()));
+ return fSurface = SkSurface::NewRaster(info);
+ }
+
void draw(SkCanvas* canvas) SK_OVERRIDE;
void onSizeChange() SK_OVERRIDE;
-#ifdef SK_BUILD_FOR_WIN
- void onHandleInval(const SkIRect&) SK_OVERRIDE;
-#endif
-
- SkCanvas* createCanvas() SK_OVERRIDE;
-
private:
bool findNextMatch(); // Set example to the first one that matches FLAGS_match.
- void setupRenderTarget();
+ void setTitle();
+ void setUpRenderTarget();
bool onHandleChar(SkUnichar unichar) SK_OVERRIDE;
+ void tearDownBackend();
DeviceType fType;
-
+ SkSurface* fSurface;
SkExample* fCurrExample;
const SkExample::Registry* fRegistry;
GrContext* fContext;

Powered by Google App Engine
This is Rietveld 408576698