aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2008-12-19 18:24:35 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2008-12-19 18:24:35 +0000
commit6efdc47afc8bb24603fc0d15146ada609b728f2f (patch)
tree30fb21750ba6ab3de207c29a90b522d653af2b32 /samplecode
parent647254a7fd78090f64027383ff98e7ff2cc2667b (diff)
first cut at event-based test app
git-svn-id: http://skia.googlecode.com/svn/trunk@37 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'samplecode')
-rw-r--r--samplecode/SampleApp.cpp16
-rw-r--r--samplecode/SamplePatch.cpp1
-rw-r--r--samplecode/SamplePath.cpp1
-rw-r--r--samplecode/SamplePathEffects.cpp1
4 files changed, 15 insertions, 4 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 5ff8362b0e..365f558345 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 @@ SkViewRegister::SkViewRegister(SkViewFactory fact) : fFact(fact) {
gHead = this;
}
+#ifdef SK_SUPPORT_GL
static AGLContext gAGLContext;
static void init_gl(WindowRef wref) {
@@ -85,6 +90,7 @@ static void setup_offscreen_gl(const SkBitmap& offscreen, WindowRef wref) {
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT);
}
+#endif
//////////////////////////////////////////////////////////////////////////////
@@ -187,8 +193,10 @@ SampleWindow::CanvasType SampleWindow::cycle_canvastype(CanvasType ct) {
}
SampleWindow::SampleWindow(void* hwnd) : INHERITED(hwnd) {
+#ifdef SK_SUPPORT_GL
init_gl((WindowRef)hwnd);
-
+#endif
+
fPicture = NULL;
fGLCanvas = NULL;
@@ -237,9 +245,11 @@ static void reverseRedAndBlue(const SkBitmap& bm) {
}
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 @@ SkCanvas* SampleWindow::beforeChildren(SkCanvas* canvas) {
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 @@ SkCanvas* SampleWindow::beforeChildren(SkCanvas* canvas) {
canvas = fGLCanvas;
break;
}
+#endif
}
if (fUseClip) {
@@ -305,6 +317,7 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
}
fPicture = NULL;
break;
+#ifdef SK_SUPPORT_GL
case kOpenGL_CanvasType:
glFlush();
delete fGLCanvas;
@@ -313,6 +326,7 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
reverseRedAndBlue(orig->getDevice()->accessBitmap(true));
#endif
break;
+#endif
}
// if ((fScrollTestX | fScrollTestY) != 0)
diff --git a/samplecode/SamplePatch.cpp b/samplecode/SamplePatch.cpp
index 2e55db2ed0..77bd3324b6 100644
--- a/samplecode/SamplePatch.cpp
+++ b/samplecode/SamplePatch.cpp
@@ -11,7 +11,6 @@
#include "SkShader.h"
#include "SkUtils.h"
#include "SkXfermode.h"
-#include "SkShaderExtras.h"
#include "SkColorPriv.h"
#include "SkColorFilter.h"
#include "SkTime.h"
diff --git a/samplecode/SamplePath.cpp b/samplecode/SamplePath.cpp
index 04d006aa50..98f1a5b7f9 100644
--- a/samplecode/SamplePath.cpp
+++ b/samplecode/SamplePath.cpp
@@ -10,7 +10,6 @@
#include "SkShader.h"
#include "SkUtils.h"
#include "SkXfermode.h"
-#include "SkShaderExtras.h"
#include "SkColorPriv.h"
#include "SkColorFilter.h"
#include "SkTime.h"
diff --git a/samplecode/SamplePathEffects.cpp b/samplecode/SamplePathEffects.cpp
index 40822884bd..4e964d776f 100644
--- a/samplecode/SamplePathEffects.cpp
+++ b/samplecode/SamplePathEffects.cpp
@@ -6,7 +6,6 @@
#include "SkRegion.h"
#include "SkShader.h"
#include "SkUtils.h"
-#include "SkShaderExtras.h"
#include "Sk1DPathEffect.h"
#include "SkCornerPathEffect.h"
#include "SkPathMeasure.h"