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

Unified Diff: experimental/SkiaExamples/BaseExample.h

Issue 16337012: Smallest possible desktop application that uses Skia to render stuff. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Refactored into BaseExample class and a HelloSkia subclass Created 7 years, 6 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/BaseExample.h
diff --git a/experimental/SkiaExamples/BaseExample.h b/experimental/SkiaExamples/BaseExample.h
new file mode 100644
index 0000000000000000000000000000000000000000..f0a6c3d060c3a4c0d82891f118e562bdfe45b15d
--- /dev/null
+++ b/experimental/SkiaExamples/BaseExample.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ */
+
+#ifndef BaseExample_DEFINED
+#define BaseExample_DEFINED
+
+#include "SkWindow.h"
+
+class GrContext;
+class GrGLInterface;
+class GrRenderTarget;
+class SkCanvas;
+
+class BaseExample : public SkOSWindow {
+public:
+ enum DeviceType {
+ kRaster_DeviceType,
+ kGPU_DeviceType,
+ };
+ BaseExample(void* hWnd, int argc, char** argv);
+ ~BaseExample();
+
+ // Changes the device type of the object.
+ void setupBackend(DeviceType type);
+
+ DeviceType getDeviceType() const { return fType; }
+
+protected:
+ // Your class should override this method to do its thing.
+ virtual void draw(SkCanvas* canvas) SK_OVERRIDE;
+
+ SkCanvas* createCanvas() SK_OVERRIDE;
+
+private:
+ DeviceType fType;
+
+
+ GrContext* fContext;
+ GrRenderTarget* fRenderTarget;
+ GrGLInterface* fInterface;
+ typedef SkOSWindow INHERITED;
+};
+#endif
+
« no previous file with comments | « no previous file | experimental/SkiaExamples/BaseExample.cpp » ('j') | experimental/SkiaExamples/HelloSkiaExample.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698