aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-03-10 18:24:15 +0000
committerGravatar bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-03-10 18:24:15 +0000
commit498a623e2eacb709c23e5c5be6d4991ad83ab167 (patch)
treee2e9e965fb6c0d190343ef0d1a0ee34869db0203
parentf88d6765a594cf9fb0825b74779f74394a7ccc7a (diff)
Remove offscreen GL support from SampleApp and SkOSWindow. This never worked anywhere but Mac and it doesn't work there anymore.
git-svn-id: http://skia.googlecode.com/svn/trunk@918 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r--include/views/SkOSWindow_Mac.h2
-rw-r--r--include/views/SkOSWindow_Win.h2
-rw-r--r--samplecode/SampleApp.cpp40
-rw-r--r--src/utils/mac/SkOSWindow_Mac.cpp30
-rw-r--r--src/utils/win/SkOSWindow_Win.cpp5
5 files changed, 26 insertions, 53 deletions
diff --git a/include/views/SkOSWindow_Mac.h b/include/views/SkOSWindow_Mac.h
index 3a26d5a44e..232a202205 100644
--- a/include/views/SkOSWindow_Mac.h
+++ b/include/views/SkOSWindow_Mac.h
@@ -36,7 +36,7 @@ public:
void doPaint(void* ctx);
- bool attachGL(const SkBitmap* offscreen);
+ bool attachGL();
void detachGL();
void presentGL();
diff --git a/include/views/SkOSWindow_Win.h b/include/views/SkOSWindow_Win.h
index 09f0c5ce4c..4b3e9164c3 100644
--- a/include/views/SkOSWindow_Win.h
+++ b/include/views/SkOSWindow_Win.h
@@ -30,7 +30,7 @@ public:
static bool PostEvent(SkEvent* evt, SkEventSinkID, SkMSec delay);
- bool attachGL(const SkBitmap* offscreen);
+ bool attachGL();
void detachGL();
void presentGL();
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp
index 586541745e..3fe1f4e44e 100644
--- a/samplecode/SampleApp.cpp
+++ b/samplecode/SampleApp.cpp
@@ -21,10 +21,6 @@ extern SkView* create_overview(int, const SkViewFactory[]);
#define ANIMATING_EVENTTYPE "nextSample"
#define ANIMATING_DELAY 750
-#if !defined(SK_BUILD_FOR_WIN32)
-//#define USE_OFFSCREEN
-#endif
-
#ifdef SK_SUPPORT_GL
#include "GrGLConfig.h"
#endif
@@ -208,27 +204,20 @@ private:
bool SampleWindow::make3DReady() {
#if defined(SK_SUPPORT_GL)
- #if defined(USE_OFFSCREEN)
- // first clear the raster bitmap, so we don't see any leftover bits
- bitmap.eraseColor(0);
- // now setup our glcanvas
- attachGL(&bitmap);
- #else
- attachGL(NULL);
- #endif
-
- if (NULL == fGrContext) {
- #if defined(SK_USE_SHADERS)
- fGrContext = GrContext::Create(GrGpu::kOpenGL_Shaders_Engine, NULL);
- #else
- fGrContext = GrContext::Create(GrGpu::kOpenGL_Fixed_Engine, NULL);
- #endif
- }
+ if (attachGL()) {
+ if (NULL == fGrContext) {
+ #if defined(SK_USE_SHADERS)
+ fGrContext = GrContext::Create(GrGpu::kOpenGL_Shaders_Engine, NULL);
+ #else
+ fGrContext = GrContext::Create(GrGpu::kOpenGL_Fixed_Engine, NULL);
+ #endif
+ }
- if (NULL != fGrContext) {
- return true;
- } else {
- detachGL();
+ if (NULL != fGrContext) {
+ return true;
+ } else {
+ detachGL();
+ }
}
#endif
SkDebugf("Failed to setup 3D");
@@ -485,9 +474,6 @@ void SampleWindow::afterChildren(SkCanvas* orig) {
delete fGpuCanvas;
fGpuCanvas = NULL;
presentGL();
- #ifdef USE_OFFSCREEN
- reverseRedAndBlue(orig->getDevice()->accessBitmap(true));
- #endif
break;
#endif
}
diff --git a/src/utils/mac/SkOSWindow_Mac.cpp b/src/utils/mac/SkOSWindow_Mac.cpp
index 05f97a7fed..39b710630c 100644
--- a/src/utils/mac/SkOSWindow_Mac.cpp
+++ b/src/utils/mac/SkOSWindow_Mac.cpp
@@ -452,7 +452,7 @@ void SkEvent::SignalQueueTimer(SkMSec delay)
}
}
-AGLContext create_gl(WindowRef wref, bool offscreen)
+AGLContext create_gl(WindowRef wref)
{
GLint major, minor;
AGLContext ctx;
@@ -466,8 +466,8 @@ AGLContext create_gl(WindowRef wref, bool offscreen)
AGL_SAMPLE_BUFFERS_ARB, 1,
AGL_MULTISAMPLE,
AGL_SAMPLES_ARB, 8,
- (offscreen ? AGL_OFFSCREEN : AGL_ACCELERATED),
- (offscreen ? AGL_NONE : AGL_DOUBLEBUFFER),
+ AGL_ACCELERATED,
+ AGL_DOUBLEBUFFER,
AGL_NONE
};
AGLPixelFormat format = aglChoosePixelFormat(NULL, 0, pixelAttrs);
@@ -483,10 +483,10 @@ AGLContext create_gl(WindowRef wref, bool offscreen)
return ctx;
}
-bool SkOSWindow::attachGL(const SkBitmap* offscreen)
+bool SkOSWindow::attachGL()
{
if (NULL == fAGLCtx) {
- fAGLCtx = create_gl((WindowRef)fHWND, NULL != offscreen);
+ fAGLCtx = create_gl((WindowRef)fHWND);
if (NULL == fAGLCtx) {
return false;
}
@@ -496,24 +496,14 @@ bool SkOSWindow::attachGL(const SkBitmap* offscreen)
int width, height;
- if (offscreen) {
- success = aglSetOffScreen((AGLContext)fAGLCtx,
- offscreen->width(),
- offscreen->height(),
- offscreen->rowBytes(),
- offscreen->getPixels());
- width = offscreen->width();
- height = offscreen->height();
- } else {
- success = aglSetWindowRef((AGLContext)fAGLCtx, (WindowRef)fHWND);
- width = this->width();
- height = this->height();
- }
+ success = aglSetWindowRef((AGLContext)fAGLCtx, (WindowRef)fHWND);
+ width = this->width();
+ height = this->height();
GLenum err = aglGetError();
if (err) {
- SkDebugf("---- setoffscreen %d %d %s [%d %d]\n", success, err,
- aglErrorString(err), offscreen->width(), offscreen->height());
+ SkDebugf("---- aglSetWindowRef %d %d %s [%d %d]\n", success, err,
+ aglErrorString(err), width, height);
}
if (success) {
diff --git a/src/utils/win/SkOSWindow_Win.cpp b/src/utils/win/SkOSWindow_Win.cpp
index d10f5809fd..328f7ab75a 100644
--- a/src/utils/win/SkOSWindow_Win.cpp
+++ b/src/utils/win/SkOSWindow_Win.cpp
@@ -433,10 +433,7 @@ HGLRC create_gl(HWND hwnd) {
return glrc;
}
-bool SkOSWindow::attachGL(const SkBitmap* offscreen) {
- if (offscreen) {
- printf("windows doesn't support rendering to SkBitmap");
- }
+bool SkOSWindow::attachGL() {
if (NULL == fHGLRC) {
fHGLRC = create_gl((HWND)fHWND);
glClearStencil(0);