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

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: Fix OSX build. 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
« no previous file with comments | « no previous file | experimental/SkiaExamples/BaseExample.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: experimental/SkiaExamples/BaseExample.h
diff --git a/experimental/SkiaExamples/BaseExample.h b/experimental/SkiaExamples/BaseExample.h
new file mode 100644
index 0000000000000000000000000000000000000000..354f02bbd8c25e41729d5b10a93029c7ac4c16f1
--- /dev/null
+++ b/experimental/SkiaExamples/BaseExample.h
@@ -0,0 +1,58 @@
+/*
+ * 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;
+struct GrGLInterface;
+class GrRenderTarget;
+class SkCanvas;
+
+class BaseExample : public SkOSWindow {
+public:
+ enum DeviceType {
+ kRaster_DeviceType,
+ kGPU_DeviceType,
+ };
+ BaseExample(void* hWnd, int argc, char** argv);
+
+ // Changes the device type of the object.
+ bool setupBackend(DeviceType type);
+ void tearDownBackend();
+
+ 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;
+
+#ifdef SK_BUILD_FOR_WIN
+ virtual void onHandleInval(const SkIRect&) SK_OVERRIDE;
+#endif
+
+ SkCanvas* createCanvas() SK_OVERRIDE;
+
+private:
+ void setupRenderTarget();
+
+ DeviceType fType;
+
+ GrContext* fContext;
+ GrRenderTarget* fRenderTarget;
+ AttachmentInfo fAttachmentInfo;
+ const GrGLInterface* fInterface;
+ typedef SkOSWindow INHERITED;
+};
+#endif
+
« no previous file with comments | « no previous file | experimental/SkiaExamples/BaseExample.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698