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

Unified Diff: experimental/SkiaExamples/SkExample.h

Issue 18574002: SkiaExamples improvements. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Support for multiple SkExamples Created 7 years, 5 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/BaseExample.h b/experimental/SkiaExamples/SkExample.h
similarity index 56%
rename from experimental/SkiaExamples/BaseExample.h
rename to experimental/SkiaExamples/SkExample.h
index b9cc25930117d58c1619e2aee4994ffb8864d7b4..05b2ccd5921ef78941af038b468fdd0ae4eebe03 100644
--- a/experimental/SkiaExamples/BaseExample.h
+++ b/experimental/SkiaExamples/SkExample.h
@@ -7,23 +7,41 @@
*
*/
-#ifndef BaseExample_DEFINED
-#define BaseExample_DEFINED
+#ifndef SkExample_DEFINED
+#define SkExample_DEFINED
#include "SkWindow.h"
+#include "SkTRegistry.h"
class GrContext;
struct GrGLInterface;
class GrRenderTarget;
class SkCanvas;
+class SkExampleWindow;
-class BaseExample : public SkOSWindow {
+class SkExample : public SkNoncopyable {
+public:
+ SkExample(SkExampleWindow* window) : fWindow(window) {}
+
+ // Your class should override this method to do its thing.
+ virtual void draw(SkCanvas* canvas) = 0;
+
+ SkString getName() { return fName; };
+ // Use this public registry to tell the world about your sample.
+ typedef SkTRegistry<SkExample*, SkExampleWindow*> Registry;
+
+protected:
+ SkExampleWindow* fWindow;
+ SkString fName;
+};
+
+class SkExampleWindow : public SkOSWindow {
public:
enum DeviceType {
kRaster_DeviceType,
kGPU_DeviceType,
};
- BaseExample(void* hWnd, int argc, char** argv);
+ SkExampleWindow(void* hwnd);
// Changes the device type of the object.
bool setupBackend(DeviceType type);
@@ -32,7 +50,6 @@ public:
DeviceType getDeviceType() const { return fType; }
protected:
- // Your class should override this method to do its thing.
virtual void draw(SkCanvas* canvas) SK_OVERRIDE;
virtual void onSizeChange() SK_OVERRIDE;
@@ -44,14 +61,22 @@ protected:
SkCanvas* createCanvas() SK_OVERRIDE;
private:
+ bool findNextMatch(); // Set example to the first one that matches FLAGS_match.
void setupRenderTarget();
+ bool onHandleChar(SkUnichar unichar) SK_OVERRIDE;
DeviceType fType;
+ SkExample* fCurrExample;
+ const SkExample::Registry* fRegistry;
+ SkTDArray<const char*> fMatchStrs;
GrContext* fContext;
GrRenderTarget* fRenderTarget;
AttachmentInfo fAttachmentInfo;
const GrGLInterface* fInterface;
+
typedef SkOSWindow INHERITED;
};
+
#endif
+
« 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