SurfaceOpenVG* EGLDisplayOpenVG::sharedPlatformSurface()
{
    if (!m_sharedPlatformSurface) {
        // The shared surface doesn't need to be drawn on, it just exists so
        // that we can always make the shared context current (which in turn is
        // the owner of long-living resources such as images, paths and fonts).
        // We'll just make the shared surface as small as possible: 1x1 pixel.
        EGLConfig config = defaultPbufferConfig();
        EGLSurface surface = createPbufferSurface(IntSize(1, 1), config);

        EGLContext context = eglCreateContext(m_display, config, EGL_NO_CONTEXT, 0);
        ASSERT_EGL_NO_ERROR();
        m_contexts.set(m_surfaceConfigIds.get(surface), context);

        m_sharedPlatformSurface = SurfaceOpenVG::adoptExistingSurface(
            m_display, surface, context, SurfaceOpenVG::TakeSurfaceOwnership, EGL_PBUFFER_BIT);
    }
    return m_sharedPlatformSurface;
}
Esempio n. 2
0
SurfaceOpenVG* EGLDisplayOpenVG::sharedPlatformSurface()
{
    if (!m_sharedPlatformSurface) {
        // The shared surface doesn't need to be drawn on, it just exists so
        // that we can always make the shared context current (which in turn is
        // the owner of long-living resources such as images, paths and fonts).
        // We'll just make the shared surface as small as possible: 1x1 pixel.
        EGLConfig config = defaultPbufferConfig();
        EGLSurface surface = createPbufferSurface(IntSize(1, 1), config);

        EGLContext context = eglCreateContext(m_display, config, EGL_NO_CONTEXT, 0);
        ASSERT_EGL_NO_ERROR();
        m_contexts.set(m_surfaceConfigIds.get(surface), context);

        m_sharedPlatformSurface = new SurfaceOpenVG;
        m_sharedPlatformSurface->m_eglDisplay = m_display;
        m_sharedPlatformSurface->m_eglSurface = surface;
        m_sharedPlatformSurface->m_eglContext = context;
        m_platformSurfaces.set(surface, m_sharedPlatformSurface); // a.k.a. registerPlatformSurface()
    }
    return m_sharedPlatformSurface;
}