Пример #1
0
bool GraphicsContext3DInternal::lockFrontBuffer(T& image, SkRect& rect)
{
    LOGWEBGL("GraphicsContext3DInternal::lockFrontBuffer()");
    MutexLocker lock(m_fboMutex);
    FBO* fbo = m_frontFBO;

    if (!fbo || !fbo->image()) {
        LOGWEBGL("-GraphicsContext3DInternal::lockFrontBuffer(), fbo = %p", fbo);
        return false;
    }

    fbo->setLocked(true);
    image = (T)(fbo->image());

    RenderObject* renderer = m_canvas->renderer();
    if (renderer && renderer->isBox()) {
        RenderBox* box = (RenderBox*)renderer;
        rect.setXYWH(box->borderLeft() + box->paddingLeft(),
                     box->borderTop() + box->paddingTop(),
                     box->contentWidth(),
                     box->contentHeight());
    }

    return true;
}
Пример #2
0
void GraphicsContext3DInternal::releaseFrontBuffer()
{
    LOGWEBGL("GraphicsContext3DInternal::releaseFrontBuffer()");
    MutexLocker lock(m_fboMutex);
    FBO* fbo = m_frontFBO;

    if (fbo) {
        fbo->setLocked(false);
        if (fbo->sync() != EGL_NO_SYNC_KHR) {
            eglDestroySyncKHR(m_dpy, fbo->sync());
        }
        fbo->setSync();
    }
    updateFrontBuffer();
}