first cut at event-based test app
git-svn-id: http://skia.googlecode.com/svn/trunk@37 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 5ff8362..365f558 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -9,8 +9,12 @@
#include "SampleCode.h"
+//#define SK_SUPPORT_GL
+
+#ifdef SK_SUPPORT_GL
#include <AGL/agl.h>
#include <OpenGL/gl.h>
+#endif
#define ANIMATING_EVENTTYPE "nextSample"
#define ANIMATING_DELAY 750
@@ -29,6 +33,7 @@
gHead = this;
}
+#ifdef SK_SUPPORT_GL
static AGLContext gAGLContext;
static void init_gl(WindowRef wref) {
@@ -85,6 +90,7 @@
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
}
+#endif
//////////////////////////////////////////////////////////////////////////////
@@ -187,8 +193,10 @@
}
SampleWindow::SampleWindow(void* hwnd) : INHERITED(hwnd) {
+#ifdef SK_SUPPORT_GL
init_gl((WindowRef)hwnd);
-
+#endif
+
fPicture = NULL;
fGLCanvas = NULL;
@@ -237,9 +245,11 @@
}
SkCanvas* SampleWindow::beforeChildren(SkCanvas* canvas) {
+#ifdef SK_SUPPORT_GL
#ifndef USE_OFFSCREEN
aglSetWindowRef(gAGLContext, NULL);
#endif
+#endif
switch (fCanvasType) {
case kRaster_CanvasType:
canvas = this->INHERITED::beforeChildren(canvas);
@@ -248,6 +258,7 @@
fPicture = new SkPicture;
canvas = fPicture->beginRecording(9999, 9999);
break;
+#ifdef SK_SUPPORT_GL
case kOpenGL_CanvasType: {
//SkGLCanvas::DeleteAllTextures(); // just for testing
SkDevice* device = canvas->getDevice();
@@ -261,6 +272,7 @@
canvas = fGLCanvas;
break;
}
+#endif
}
if (fUseClip) {
@@ -305,6 +317,7 @@
}
fPicture = NULL;
break;
+#ifdef SK_SUPPORT_GL
case kOpenGL_CanvasType:
glFlush();
delete fGLCanvas;
@@ -313,6 +326,7 @@
reverseRedAndBlue(orig->getDevice()->accessBitmap(true));
#endif
break;
+#endif
}
// if ((fScrollTestX | fScrollTestY) != 0)