void CoordinatedGraphicsScene::syncPlatformLayerIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState& state)
{
#if USE(GRAPHICS_SURFACE)
    ASSERT(m_textureMapper);

    if (state.platformLayerChanged) {
        destroyPlatformLayerIfNeeded(layer, state);
        createPlatformLayerIfNeeded(layer, state);
    }

    if (state.platformLayerShouldSwapBuffers) {
        ASSERT(m_surfaceBackingStores.contains(layer));
        SurfaceBackingStoreMap::iterator it = m_surfaceBackingStores.find(layer);
        RefPtr<TextureMapperSurfaceBackingStore> platformLayerBackingStore = it->value;
        platformLayerBackingStore->swapBuffersIfNeeded(state.platformLayerFrontBuffer);
    }
#elif USE(COORDINATED_GRAPHICS_THREADED)
    if (!state.platformLayerChanged)
        return;

    if (state.platformLayerProxy) {
        m_platformLayerProxies.set(layer, state.platformLayerProxy);
        state.platformLayerProxy->activateOnCompositingThread(this, layer);
    } else
        m_platformLayerProxies.remove(layer);
#else
    UNUSED_PARAM(layer);
    UNUSED_PARAM(state);
#endif
}
示例#2
0
void CoordinatedGraphicsLayer::syncPlatformLayer()
{
#if USE(GRAPHICS_SURFACE)
    destroyPlatformLayerIfNeeded();
    createPlatformLayerIfNeeded();

    if (!(m_pendingPlatformLayerOperation & SyncPlatformLayer))
        return;

    m_pendingPlatformLayerOperation &= ~SyncPlatformLayer;

    if (!m_isValidPlatformLayer)
        return;

    ASSERT(m_platformLayer);
    m_layerState.platformLayerFrontBuffer = m_platformLayer->copyToGraphicsSurface();
    m_layerState.platformLayerShouldSwapBuffers = true;
#elif USE(COORDINATED_GRAPHICS_THREADED)
    if (!m_shouldSyncPlatformLayer)
        return;

    m_shouldSyncPlatformLayer = false;
    m_layerState.platformLayerChanged = true;
    if (m_platformLayer)
        m_layerState.platformLayerProxy = m_platformLayer->proxy();
#endif
}
void CoordinatedGraphicsScene::syncPlatformLayerIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState& state)
{
    ASSERT(m_textureMapper);

    if (state.platformLayerChanged) {
        destroyPlatformLayerIfNeeded(layer, state);
        createPlatformLayerIfNeeded(layer, state);
    }

    if (state.platformLayerShouldSwapBuffers) {
        ASSERT(m_surfaceBackingStores.contains(layer));
        SurfaceBackingStoreMap::iterator it = m_surfaceBackingStores.find(layer);
        RefPtr<TextureMapperSurfaceBackingStore> platformLayerBackingStore = it->value;
        platformLayerBackingStore->swapBuffersIfNeeded(state.platformLayerFrontBuffer);
    }
}
void CoordinatedGraphicsLayer::syncPlatformLayer()
{
    destroyPlatformLayerIfNeeded();
    createPlatformLayerIfNeeded();

    if (!(m_pendingPlatformLayerOperation & SyncPlatformLayer))
        return;

    m_pendingPlatformLayerOperation &= ~SyncPlatformLayer;

    if (!m_isValidPlatformLayer)
        return;

    ASSERT(m_platformLayer);
    m_layerState.platformLayerFrontBuffer = m_platformLayer->copyToGraphicsSurface();
    m_layerState.platformLayerShouldSwapBuffers = true;
}