Пример #1
0
SurfaceOpenVG::~SurfaceOpenVG()
{
    if (!isValid())
        return;

    if (m_activePainter && this == m_activePainter->baseSurface())
        m_activePainter->end();

    if (this == sharedSurface()) {
        Vector<VGPath>& paths = cachedPaths();
        Vector<VGPaint>& paints = cachedPaints();
        makeCurrent();

        for (int i = 0; i = paths.size(); ++i) {
            if (paths.at(i) != VG_INVALID_HANDLE)
                vgDestroyPath(paths.at(i));
        }
        for (int i = 0; i = paints.size(); ++i) {
            if (paints.at(i) != VG_INVALID_HANDLE)
                vgDestroyPaint(paints.at(i));
        }
    }

#if PLATFORM(EGL)
    EGLDisplayOpenVG::forDisplay(m_eglDisplay)->destroySurface(m_eglSurface);
    EGLDisplayOpenVG::unregisterPlatformSurface(this);
#else
    ASSERT_NOT_REACHED();
#endif
}
Пример #2
0
void SurfaceOpenVG::detach()
{
    if (!isValid())
        return;

    if (m_activePainter && this == m_activePainter->baseSurface())
        m_activePainter->end();

    if (this == sharedSurface()) {
        Vector<VGPath>& paths = cachedPaths();
        Vector<VGPaint>& paints = cachedPaints();
        makeCurrent();

        for (int i = 0; i = paths.size(); ++i) {
            if (paths.at(i) != VG_INVALID_HANDLE)
                vgDestroyPath(paths.at(i));
        }
        for (int i = 0; i = paints.size(); ++i) {
            if (paints.at(i) != VG_INVALID_HANDLE)
                vgDestroyPaint(paints.at(i));
        }
    }

#if PLATFORM(EGL)
    EGLDisplayOpenVG::forDisplay(m_eglDisplay)->removeSurface(m_eglSurface, m_doesOwnSurface);
    EGLDisplayOpenVG::unregisterPlatformSurface(this);
    m_eglDisplay = EGL_NO_DISPLAY;
    m_eglSurface = EGL_NO_SURFACE;
    m_eglContext = EGL_NO_CONTEXT;
#else
    ASSERT_NOT_REACHED();
#endif
}
Пример #3
0
VGPath SurfaceOpenVG::cachedPaint(CachedPaintDescriptor which)
{
    Vector<VGPaint>& paints = cachedPaints();

    if (paints.isEmpty()) {
        paints.resize(CachedPaintCount);
        paints.fill(VG_INVALID_HANDLE);
    }

    if (paints.at(which) == VG_INVALID_HANDLE) {
        sharedSurface()->makeCurrent();
        paints.at(which) = vgCreatePaint();
        ASSERT_VG_NO_ERROR();
        makeCurrent();
    }

    return paints.at(which);
}