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

Unified Diff: experimental/SkiaExamples/SkExample.h

Issue 890873003: update example (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove multiple example cruft 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 | « experimental/SkiaExamples/HelloSkiaExample.cpp ('k') | experimental/SkiaExamples/SkExample.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/SkiaExamples/SkExample.h
diff --git a/experimental/SkiaExamples/SkExample.h b/experimental/SkiaExamples/SkExample.h
index ee9e36e0d0fb893a727cd965b914844db4f08f83..4f4b10be5507dfdca4166c996bddafe5fa099854 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,33 +45,42 @@ public:
kGPU_DeviceType,
};
SkExampleWindow(void* hwnd);
+ virtual ~SkExampleWindow() SK_OVERRIDE;
// Changes the device type of the object.
- bool setupBackend(DeviceType type);
- void tearDownBackend();
+ bool setUpBackend();
DeviceType getDeviceType() const { return fType; }
protected:
+ 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 drawContents(SkCanvas* canvas);
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;
+ // draw contents
+ SkScalar fRotationAngle;
- SkExample* fCurrExample;
- const SkExample::Registry* fRegistry;
+ // support framework
+ DeviceType fType;
+ SkSurface* fSurface;
GrContext* fContext;
GrRenderTarget* fRenderTarget;
AttachmentInfo fAttachmentInfo;
« no previous file with comments | « experimental/SkiaExamples/HelloSkiaExample.cpp ('k') | experimental/SkiaExamples/SkExample.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698