18 PFNEGLGETPLATFORMDISPLAYEXTPROC eglGetPlatformDisplayEXT =
19 (PFNEGLGETPLATFORMDISPLAYEXTPROC)eglGetProcAddress(
"eglGetPlatformDisplayEXT");
22 if (!eglGetPlatformDisplayEXT) {
27 if (EGL_NO_DISPLAY == fDisplay) {
33 if (!eglInitialize(fDisplay, &majorVersion, &minorVersion)) {
34 SkDebugf(
"Could not initialize display!\n");
41 const EGLint configAttribs[] = {EGL_RENDERABLE_TYPE,
58 EGLConfig surfaceConfig;
59 if (!eglChooseConfig(fDisplay, configAttribs, &surfaceConfig, 1, &numConfigs)) {
60 SkDebugf(
"Could not create choose config!\n");
64 const EGLint contextAttribs[] = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE};
65 fEGLContext = eglCreateContext(fDisplay, surfaceConfig,
nullptr, contextAttribs);
66 if (EGL_NO_CONTEXT == fEGLContext) {
67 SkDebugf(
"Could not create context!\n");
71 eglCreateWindowSurface(fDisplay, surfaceConfig, this->
onGetNativeWindow(),
nullptr);
72 if (EGL_NO_SURFACE == fEGLSurface) {
73 SkDebugf(
"Could not create surface!\n");
76 if (!eglMakeCurrent(fDisplay, fEGLSurface, fEGLSurface, fEGLContext)) {
77 SkDebugf(
"Could not make context current!\n");
85 interface->fFunctions.fClearStencil(0);
86 interface->fFunctions.fClearColor(0, 0, 0, 0);
87 interface->fFunctions.fStencilMask(0xffffffff);
101 eglMakeCurrent(fDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
102 if (EGL_NO_CONTEXT != fEGLContext) {
103 eglDestroyContext(fDisplay, fEGLContext);
105 if (EGL_NO_SURFACE != fEGLSurface) {
106 eglDestroySurface(fDisplay, fEGLSurface);
108 if (EGL_NO_DISPLAY != fDisplay) {
109 eglTerminate(fDisplay);