move utils/SkEGLContext to gpu/SkGLContext, some gpu.gyp cleanup, set eol style LF on all gpu files

Review URL: http://codereview.appspot.com/5242056/



git-svn-id: http://skia.googlecode.com/svn/trunk@2474 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bsalomon@google.com 2011-10-13 13:33:08 +00:00
parent 1ba7137fc0
commit e295313f01
12 changed files with 182 additions and 194 deletions

View File

@ -15,7 +15,7 @@
#include "SkBenchmark.h"
#include "SkCanvas.h"
#include "SkColorPriv.h"
#include "SkEGLContext.h"
#include "SkGLContext.h"
#include "SkGpuDevice.h"
#include "SkGraphics.h"
#include "SkImageEncoder.h"
@ -416,8 +416,8 @@ int main (int argc, char * const argv[]) {
GrRenderTarget* rt = NULL;
//Don't do GL when fixed.
#if !defined(SK_SCALAR_IS_FIXED)
SkEGLContext eglContext;
if (eglContext.init(1024, 1024)) {
SkGLContext glContext;
if (glContext.init(1024, 1024)) {
context = GrContext::CreateGLShaderContext();
if (NULL != context) {
GrPlatformSurfaceDesc desc;
@ -426,7 +426,7 @@ int main (int argc, char * const argv[]) {
desc.fWidth = 1024;
desc.fHeight = 1024;
desc.fStencilBits = 8;
desc.fPlatformRenderTarget = eglContext.getFBOID();
desc.fPlatformRenderTarget = glContext.getFBOID();
desc.fSurfaceType = kRenderTarget_GrPlatformSurfaceType;
rt = static_cast<GrRenderTarget*>(context->createPlatformSurface(desc));
if (NULL == rt) {

View File

@ -12,7 +12,7 @@
#include "SkColorPriv.h"
#include "SkData.h"
#include "SkDevice.h"
#include "SkEGLContext.h"
#include "SkGLContext.h"
#include "SkGpuCanvas.h"
#include "SkGpuDevice.h"
#include "SkGraphics.h"
@ -606,9 +606,9 @@ int main(int argc, char * const argv[]) {
maxH = SkMax32(size.height(), maxH);
}
// setup a GL context for drawing offscreen
SkEGLContext eglContext;
SkGLContext glContext;
GrRenderTarget* rt = NULL;
if (eglContext.init(maxW, maxH)) {
if (glContext.init(maxW, maxH)) {
gGrContext = GrContext::CreateGLShaderContext();
if (NULL != gGrContext) {
GrPlatformSurfaceDesc desc;
@ -617,7 +617,7 @@ int main(int argc, char * const argv[]) {
desc.fWidth = maxW;
desc.fHeight = maxH;
desc.fStencilBits = 8;
desc.fPlatformRenderTarget = eglContext.getFBOID();
desc.fPlatformRenderTarget = glContext.getFBOID();
desc.fSurfaceType = kRenderTarget_GrPlatformSurfaceType;
rt = static_cast<GrRenderTarget*>(gGrContext->createPlatformSurface(desc));
if (NULL == rt) {

View File

@ -2,6 +2,89 @@
'includes': [
'common.gypi',
],
'target_defaults': {
'conditions': [
['skia_os != "win"', {
'sources/': [ ['exclude', '_win.(h|cpp)$'],
],
}],
['skia_os != "mac"', {
'sources/': [ ['exclude', '_mac.(h|cpp)$'],
],
}],
['skia_os != "linux"', {
'sources/': [ ['exclude', '_unix.(h|cpp)$'],
],
}],
['skia_os != "ios"', {
'sources/': [ ['exclude', '_iOS.(h|cpp)$'],
],
}],
['skia_os != "android"', {
'sources/': [ ['exclude', '_android.(h|cpp)$'],
],
}],
[ 'skia_os == "android"', {
'defines': [
'GR_ANDROID_BUILD=1',
],
}],
[ 'skia_os == "mac"', {
'defines': [
'GR_MAC_BUILD=1',
],
}],
[ 'skia_os == "linux"', {
'defines': [
'GR_LINUX_BUILD=1',
],
}],
[ 'skia_os == "ios"', {
'defines': [
'GR_IOS_BUILD=1',
],
}],
[ 'skia_os == "win"', {
'defines': [
'GR_WIN32_BUILD=1',
'GR_GL_FUNCTION_TYPE=__stdcall',
],
}],
],
'direct_dependent_settings': {
'conditions': [
[ 'skia_os == "android"', {
'defines': [
'GR_ANDROID_BUILD=1',
],
}],
[ 'skia_os == "mac"', {
'defines': [
'GR_MAC_BUILD=1',
],
}],
[ 'skia_os == "linux"', {
'defines': [
'GR_LINUX_BUILD=1',
],
}],
[ 'skia_os == "ios"', {
'defines': [
'GR_IOS_BUILD=1',
],
}],
[ 'skia_os == "win"', {
'defines': [
'GR_WIN32_BUILD=1',
'GR_GL_FUNCTION_TYPE=__stdcall',
],
}],
],
'include_dirs': [
'../include/gpu',
],
},
},
'targets': [
{
'target_name': 'skgr',
@ -24,46 +107,19 @@
'../src/gpu/SkGr.cpp',
'../src/gpu/SkGrFontScaler.cpp',
'../src/gpu/SkGrTexturePixelRef.cpp',
'../src/gpu/mac/SkGLContext_mac.cpp',
'../src/gpu/win/SkGLContext_win.cpp',
'../src/gpu/unix/SkGLContext_unix.cpp',
'../src/gpu/mesa/SkGLContext_mesa.cpp',
],
'conditions': [
[ 'skia_os == "linux"', {
'defines': [
'GR_LINUX_BUILD=1',
],
}],
[ 'skia_os == "mac"', {
'defines': [
'GR_MAC_BUILD=1',
],
}],
[ 'skia_os == "win"', {
'defines': [
'GR_WIN32_BUILD=1',
],
}],
# Removed for now
'sources!': [
'../src/gpu/mesa/SkGLContext_mesa.cpp',
],
'direct_dependent_settings': {
'conditions': [
[ 'skia_os == "linux"', {
'defines': [
'GR_LINUX_BUILD=1',
],
}],
[ 'skia_os == "mac"', {
'defines': [
'GR_MAC_BUILD=1',
],
}],
[ 'skia_os == "win"', {
'defines': [
'GR_WIN32_BUILD=1',
],
}],
],
'include_dirs': [
'../include/gpu',
],
},
},
{
'target_name': 'gr',
@ -201,6 +257,7 @@
'../src/gpu/mesa/GrGLDefaultInterface_mesa.cpp',
],
# Removed for now
'sources!': [
'../src/gpu/mesa/GrGLDefaultInterface_mesa.cpp',
],
@ -209,9 +266,6 @@
],
'conditions': [
[ 'skia_os == "linux"', {
'defines': [
'GR_LINUX_BUILD=1',
],
'sources!': [
'../src/gpu/GrGLDefaultInterface_none.cpp',
],
@ -223,9 +277,6 @@
},
}],
[ 'skia_os == "mac"', {
'defines': [
'GR_MAC_BUILD=1',
],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/OpenGL.framework',
@ -236,53 +287,11 @@
],
}],
[ 'skia_os == "win"', {
'defines': [
'GR_WIN32_BUILD=1',
'GR_GL_FUNCTION_TYPE=__stdcall',
],
'sources!': [
'../src/gpu/GrGLDefaultInterface_none.cpp',
],
}],
[ 'skia_os != "win"', {
'sources!': [
'../src/gpu/win/GrGLDefaultInterface_win.cpp',
],
}],
[ 'skia_os != "mac"', {
'sources!': [
'../src/gpu/mac/GrGLDefaultInterface_mac.cpp',
],
}],
[ 'skia_os != "linux"', {
'sources!': [
'../src/gpu/unix/GrGLDefaultInterface_unix.cpp',
],
}],
],
'direct_dependent_settings': {
'conditions': [
[ 'skia_os == "linux"', {
'defines': [
'GR_LINUX_BUILD=1',
],
}],
[ 'skia_os == "mac"', {
'defines': [
'GR_MAC_BUILD=1',
],
}],
[ 'skia_os == "win"', {
'defines': [
'GR_WIN32_BUILD=1',
'GR_GL_FUNCTION_TYPE=__stdcall',
],
}],
],
'include_dirs': [
'../include/gpu',
],
},
},
],
}

View File

@ -23,7 +23,6 @@
'../include/utils/SkCubicInterval.h',
'../include/utils/SkCullPoints.h',
'../include/utils/SkDumpCanvas.h',
'../include/utils/SkEGLContext.h',
'../include/utils/SkGLCanvas.h',
'../include/utils/SkInterpolator.h',
'../include/utils/SkLayer.h',
@ -45,7 +44,6 @@
'../src/utils/SkCubicInterval.cpp',
'../src/utils/SkCullPoints.cpp',
'../src/utils/SkDumpCanvas.cpp',
'../src/utils/SkEGLContext_none.cpp',
'../src/utils/SkInterpolator.cpp',
'../src/utils/SkLayer.cpp',
'../src/utils/SkMatrix44.cpp',
@ -63,17 +61,12 @@
#mac
'../include/utils/mac/SkCGUtils.h',
'../src/utils/mac/SkCreateCGImageRef.cpp',
'../src/utils/mac/SkEGLContext_mac.cpp',
#mesa
'../src/utils/mesa/SkEGLContext_Mesa.cpp',
#sdl
'../src/utils/SDL/SkOSWindow_SDL.cpp',
#*nix
'../src/utils/unix/keysym2ucs.c',
'../src/utils/unix/SkEGLContext_Unix.cpp',
'../src/utils/unix/SkOSWindow_Unix.cpp',
#windows
@ -83,20 +76,15 @@
'../include/utils/win/SkTScopedComPtr.h',
'../src/utils/win/SkAutoCoInitialize.cpp',
'../src/utils/win/skia_win.cpp',
'../src/utils/win/SkEGLContext_Win.cpp',
'../src/utils/win/SkHRESULT.cpp',
'../src/utils/win/SkIStream.cpp',
'../src/utils/win/SkOSWindow_Win.cpp',
],
'sources!': [
'../src/utils/mesa/SkEGLContext_Mesa.cpp',
'../src/utils/SDL/SkOSWindow_SDL.cpp',
],
'conditions': [
[ 'skia_os == "mac"', {
'sources!': [
'../src/utils/SkEGLContext_none.cpp',
],
'link_settings': {
'libraries': [
'$(SDKROOT)/System/Library/Frameworks/AGL.framework',
@ -114,15 +102,11 @@
'sources!': [
'../include/utils/mac/SkCGUtils.h',
'../src/utils/mac/SkCreateCGImageRef.cpp',
'../src/utils/mac/SkEGLContext_mac.cpp',
'../src/utils/mac/skia_mac.mm',
'../src/utils/mac/SkOSWindow_Mac.mm',
],
}],
[ 'skia_os in ["linux", "freebsd", "openbsd", "solaris"]', {
'sources!': [
'../src/utils/SkEGLContext_none.cpp',
],
'link_settings': {
'libraries': [
'-lGL',
@ -135,14 +119,10 @@
],
'sources!': [
'../src/utils/unix/keysym2ucs.c',
'../src/utils/unix/SkEGLContext_Unix.cpp',
'../src/utils/unix/SkOSWindow_Unix.cpp',
],
}],
[ 'skia_os == "win"', {
'sources!': [
'../src/utils/SkEGLContext_none.cpp',
],
'direct_dependent_settings': {
'include_dirs': [
'../include/utils/win',
@ -159,7 +139,6 @@
'../include/utils/win/SkTScopedComPtr.h',
'../src/utils/win/SkAutoCoInitialize.cpp',
'../src/utils/win/skia_win.cpp',
'../src/utils/win/SkEGLContext_Win.cpp',
'../src/utils/win/SkHRESULT.cpp',
'../src/utils/win/SkIStream.cpp',
'../src/utils/win/SkOSWindow_Win.cpp',

View File

@ -5,8 +5,8 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkEGLContext_DEFINED
#define SkEGLContext_DEFINED
#ifndef SkGLContext_DEFINED
#define SkGLContext_DEFINED
#if defined(SK_MESA)
#include "GL/osmesa.h"
@ -25,10 +25,10 @@
/**
* Create an offscreen opengl context with an RGBA8 / 8bit stencil FBO.
*/
class SkEGLContext {
class SkGLContext {
public:
SkEGLContext();
~SkEGLContext();
SkGLContext();
~SkGLContext();
bool init(const int width, const int height);

View File

@ -5,15 +5,15 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkEGLContext.h"
#include "SkGLContext.h"
SkEGLContext::SkEGLContext()
SkGLContext::SkGLContext()
: fFBO(0) {
}
SkEGLContext::~SkEGLContext() {
SkGLContext::~SkGLContext() {
}
bool SkEGLContext::init(int width, int height) {
bool SkGLContext::init(int width, int height) {
return false;
}

View File

@ -5,22 +5,22 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkEGLContext.h"
#include "SkGLContext.h"
//#include "SkTypes.h"
#include <AGL/agl.h>
SkEGLContext::SkEGLContext()
SkGLContext::SkGLContext()
: fFBO(0)
, context(NULL) {
}
SkEGLContext::~SkEGLContext() {
SkGLContext::~SkGLContext() {
if (this->context) {
aglDestroyContext(this->context);
}
}
bool SkEGLContext::init(int width, int height) {
bool SkGLContext::init(int width, int height) {
GLint major, minor;
AGLContext ctx;

View File

@ -5,7 +5,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkEGLContext.h"
#include "SkGLContext.h"
#include "SkTypes.h"
#include "GL/osmesa.h"
@ -15,13 +15,13 @@
#define SK_GL_GET_PROC(T, F) F ## _func = (T)OSMesaGetProcAddress(#F);
#define SK_GL_GET_EXT_PROC(T, F) F ## _func = (T)OSMesaGetProcAddress(#F "EXT");
SkEGLContext::SkEGLContext()
SkGLContext::SkGLContext()
: fFBO(0)
, context(NULL)
, image(NULL) {
}
SkEGLContext::~SkEGLContext() {
SkGLContext::~SkGLContext() {
if (this->image)
free(this->image);
@ -46,7 +46,7 @@ SkEGLContext::~SkEGLContext() {
#define SK_OSMESA_COLOR_ORDER OSMESA_RGBA
#endif
bool SkEGLContext::init(const int width, const int height) {
bool SkGLContext::init(const int width, const int height) {
/* Create an RGBA-mode context */
#if OSMESA_MAJOR_VERSION * 100 + OSMESA_MINOR_VERSION >= 305
/* specify Z, stencil, accum sizes */

View File

@ -5,7 +5,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include "SkEGLContext.h"
#include "SkGLContext.h"
#include "SkTypes.h"
#include <GL/gl.h>
@ -23,7 +23,7 @@ static int ctxErrorHandler(Display *dpy, XErrorEvent *ev) {
return 0;
}
SkEGLContext::SkEGLContext()
SkGLContext::SkGLContext()
: fFBO(0)
, context(NULL)
, display(NULL)
@ -31,7 +31,7 @@ SkEGLContext::SkEGLContext()
, glxPixmap(0) {
}
SkEGLContext::~SkEGLContext() {
SkGLContext::~SkGLContext() {
if (this->display) {
glXMakeCurrent(this->display, 0, 0);
@ -48,7 +48,7 @@ SkEGLContext::~SkEGLContext() {
}
}
bool SkEGLContext::init(const int width, const int height) {
bool SkGLContext::init(const int width, const int height) {
Display *display = XOpenDisplay(0);
this->display = display;

View File

@ -9,39 +9,39 @@
#include <Windows.h>
#include <GL/GL.h>
#include "SkEGLContext.h"
#include "SkGLContext.h"
#include "SkTypes.h"
#define SK_EGL_DECLARE_PROC(F) SkEGL ## F ## Proc SkEGL ## F = NULL;
#define SK_EGL_GET_PROC(F) SkEGL ## F = (SkEGL ## F ## Proc) \
#define SK_GL_DECLARE_PROC(F) SkGL ## F ## Proc SkGL ## F = NULL;
#define SK_GL_GET_PROC(F) SkGL ## F = (SkGL ## F ## Proc) \
wglGetProcAddress("gl" #F);
#define SK_EGL_GET_PROC_SUFFIX(F, S) SkEGL ## F = (SkEGL ## F ## Proc) \
#define SK_GL_GET_PROC_SUFFIX(F, S) SkGL ## F = (SkGL ## F ## Proc) \
wglGetProcAddress("gl" #F #S);
#define SK_EGL_FRAMEBUFFER 0x8D40
#define SK_EGL_RENDERBUFFER 0x8D41
#define SK_EGL_COLOR_ATTACHMENT0 0x8CE0
#define SK_EGL_DEPTH_STENCIL 0x84F9
#define SK_EGL_DEPTH_STENCIL_ATTACHMENT 0x821A
#define SK_EGL_FRAMEBUFFER_COMPLETE 0x8CD5
#define SK_GL_FRAMEBUFFER 0x8D40
#define SK_GL_RENDERBUFFER 0x8D41
#define SK_GL_COLOR_ATTACHMENT0 0x8CE0
#define SK_GL_DEPTH_STENCIL 0x84F9
#define SK_GL_DEPTH_STENCIL_ATTACHMENT 0x821A
#define SK_GL_FRAMEBUFFER_COMPLETE 0x8CD5
#define SK_EGL_FUNCTION_TYPE __stdcall
typedef void (SK_EGL_FUNCTION_TYPE *SkEGLGenFramebuffersProc) (GLsizei n, GLuint *framebuffers);
typedef void (SK_EGL_FUNCTION_TYPE *SkEGLBindFramebufferProc) (GLenum target, GLuint framebuffer);
typedef void (SK_EGL_FUNCTION_TYPE *SkEGLGenRenderbuffersProc) (GLsizei n, GLuint *renderbuffers);
typedef void (SK_EGL_FUNCTION_TYPE *SkEGLBindRenderbufferProc) (GLenum target, GLuint renderbuffer);
typedef void (SK_EGL_FUNCTION_TYPE *SkEGLRenderbufferStorageProc) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (SK_EGL_FUNCTION_TYPE *SkEGLFramebufferRenderbufferProc) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
typedef GLenum (SK_EGL_FUNCTION_TYPE *SkEGLCheckFramebufferStatusProc) (GLenum target);
#define SK_GL_FUNCTION_TYPE __stdcall
typedef void (SK_GL_FUNCTION_TYPE *SkGLGenFramebuffersProc) (GLsizei n, GLuint *framebuffers);
typedef void (SK_GL_FUNCTION_TYPE *SkGLBindFramebufferProc) (GLenum target, GLuint framebuffer);
typedef void (SK_GL_FUNCTION_TYPE *SkGLGenRenderbuffersProc) (GLsizei n, GLuint *renderbuffers);
typedef void (SK_GL_FUNCTION_TYPE *SkGLBindRenderbufferProc) (GLenum target, GLuint renderbuffer);
typedef void (SK_GL_FUNCTION_TYPE *SkGLRenderbufferStorageProc) (GLenum target, GLenum internalformat, GLsizei width, GLsizei height);
typedef void (SK_GL_FUNCTION_TYPE *SkGLFramebufferRenderbufferProc) (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer);
typedef GLenum (SK_GL_FUNCTION_TYPE *SkGLCheckFramebufferStatusProc) (GLenum target);
SkEGLContext::SkEGLContext()
SkGLContext::SkGLContext()
: fFBO(0)
, fWindow(NULL)
, fDeviceContext(NULL)
, fGlRenderContext(0) {
}
SkEGLContext::~SkEGLContext() {
SkGLContext::~SkGLContext() {
if (this->fGlRenderContext) {
wglDeleteContext(this->fGlRenderContext);
}
@ -53,7 +53,7 @@ SkEGLContext::~SkEGLContext() {
}
}
bool skEGLCheckExtension(const char* ext,
bool skGLCheckExtension(const char* ext,
const char* extensionString) {
int extLength = strlen(ext);
@ -71,7 +71,7 @@ bool skEGLCheckExtension(const char* ext,
return false;
}
bool SkEGLContext::init(const int width, const int height) {
bool SkGLContext::init(const int width, const int height) {
HINSTANCE hInstance = (HINSTANCE)GetModuleHandle(NULL);
WNDCLASS wc;
@ -152,51 +152,51 @@ bool SkEGLContext::init(const int width, const int height) {
//Setup the framebuffers
const char* glExts =
reinterpret_cast<const char *>(glGetString(GL_EXTENSIONS));
if (!skEGLCheckExtension(
if (!skGLCheckExtension(
"GL_EXT_framebuffer_object"
, glExts))
{
SkDebugf("GL_EXT_framebuffer_object not found.\n");
return false;
}
SK_EGL_DECLARE_PROC(GenFramebuffers)
SK_EGL_DECLARE_PROC(BindFramebuffer)
SK_EGL_DECLARE_PROC(GenRenderbuffers)
SK_EGL_DECLARE_PROC(BindRenderbuffer)
SK_EGL_DECLARE_PROC(RenderbufferStorage)
SK_EGL_DECLARE_PROC(FramebufferRenderbuffer)
SK_EGL_DECLARE_PROC(CheckFramebufferStatus)
SK_GL_DECLARE_PROC(GenFramebuffers)
SK_GL_DECLARE_PROC(BindFramebuffer)
SK_GL_DECLARE_PROC(GenRenderbuffers)
SK_GL_DECLARE_PROC(BindRenderbuffer)
SK_GL_DECLARE_PROC(RenderbufferStorage)
SK_GL_DECLARE_PROC(FramebufferRenderbuffer)
SK_GL_DECLARE_PROC(CheckFramebufferStatus)
SK_EGL_GET_PROC_SUFFIX(GenFramebuffers, EXT)
SK_EGL_GET_PROC_SUFFIX(BindFramebuffer, EXT)
SK_EGL_GET_PROC_SUFFIX(GenRenderbuffers, EXT)
SK_EGL_GET_PROC_SUFFIX(BindRenderbuffer, EXT)
SK_EGL_GET_PROC_SUFFIX(RenderbufferStorage, EXT)
SK_EGL_GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT)
SK_EGL_GET_PROC_SUFFIX(CheckFramebufferStatus, EXT)
SK_GL_GET_PROC_SUFFIX(GenFramebuffers, EXT)
SK_GL_GET_PROC_SUFFIX(BindFramebuffer, EXT)
SK_GL_GET_PROC_SUFFIX(GenRenderbuffers, EXT)
SK_GL_GET_PROC_SUFFIX(BindRenderbuffer, EXT)
SK_GL_GET_PROC_SUFFIX(RenderbufferStorage, EXT)
SK_GL_GET_PROC_SUFFIX(FramebufferRenderbuffer, EXT)
SK_GL_GET_PROC_SUFFIX(CheckFramebufferStatus, EXT)
GLuint cbID;
GLuint dsID;
SkEGLGenFramebuffers(1, &fFBO);
SkEGLBindFramebuffer(SK_EGL_FRAMEBUFFER, fFBO);
SkEGLGenRenderbuffers(1, &cbID);
SkEGLBindRenderbuffer(SK_EGL_RENDERBUFFER, cbID);
SkEGLRenderbufferStorage(SK_EGL_RENDERBUFFER, GL_RGBA, width, height);
SkEGLFramebufferRenderbuffer(SK_EGL_FRAMEBUFFER
, SK_EGL_COLOR_ATTACHMENT0
, SK_EGL_RENDERBUFFER, cbID);
SkEGLGenRenderbuffers(1, &dsID);
SkEGLBindRenderbuffer(SK_EGL_RENDERBUFFER, dsID);
SkEGLRenderbufferStorage(SK_EGL_RENDERBUFFER, SK_EGL_DEPTH_STENCIL
SkGLGenFramebuffers(1, &fFBO);
SkGLBindFramebuffer(SK_GL_FRAMEBUFFER, fFBO);
SkGLGenRenderbuffers(1, &cbID);
SkGLBindRenderbuffer(SK_GL_RENDERBUFFER, cbID);
SkGLRenderbufferStorage(SK_GL_RENDERBUFFER, GL_RGBA, width, height);
SkGLFramebufferRenderbuffer(SK_GL_FRAMEBUFFER
, SK_GL_COLOR_ATTACHMENT0
, SK_GL_RENDERBUFFER, cbID);
SkGLGenRenderbuffers(1, &dsID);
SkGLBindRenderbuffer(SK_GL_RENDERBUFFER, dsID);
SkGLRenderbufferStorage(SK_GL_RENDERBUFFER, SK_GL_DEPTH_STENCIL
, width, height);
SkEGLFramebufferRenderbuffer(SK_EGL_FRAMEBUFFER
, SK_EGL_DEPTH_STENCIL_ATTACHMENT
, SK_EGL_RENDERBUFFER
SkGLFramebufferRenderbuffer(SK_GL_FRAMEBUFFER
, SK_GL_DEPTH_STENCIL_ATTACHMENT
, SK_GL_RENDERBUFFER
, dsID);
glViewport(0, 0, width, height);
glClearStencil(0);
glClear(GL_STENCIL_BUFFER_BIT);
GLenum status = SkEGLCheckFramebufferStatus(SK_EGL_FRAMEBUFFER);
return SK_EGL_FRAMEBUFFER_COMPLETE == status;
GLenum status = SkGLCheckFramebufferStatus(SK_GL_FRAMEBUFFER);
return SK_GL_FRAMEBUFFER_COMPLETE == status;
}

View File

@ -8,7 +8,7 @@
#include "Test.h"
#include "GrContext.h"
#include "SkEGLContext.h"
#include "SkGLContext.h"
#include "SkTLazy.h"
using namespace skiatest;
@ -79,12 +79,12 @@ bool Test::run() {
GrContext* GpuTest::GetContext() {
// preserve this order, we want gGrContext destroyed after gEGLContext
static SkTLazy<SkEGLContext> gEGLContext;
static SkTLazy<SkGLContext> gGLContext;
static SkAutoTUnref<GrContext> gGrContext;
if (NULL == gGrContext.get()) {
gEGLContext.init();
if (gEGLContext.get()->init(800, 600)) {
gGLContext.init();
if (gGLContext.get()->init(800, 600)) {
gGrContext.reset(GrContext::Create(kOpenGL_Shaders_GrEngine, NULL));
}
}

View File

@ -13,7 +13,7 @@
#include "SkTRegistry.h"
class GrContext;
class SkEGLContext;
class SkGLContext;
namespace skiatest {