Exemple #1
0
void CoordinatedGraphicsLayer::setContentsToPlatformLayer(PlatformLayer* platformLayer, ContentsLayerPurpose)
{
#if USE(GRAPHICS_SURFACE)
    if (m_platformLayer) {
        ASSERT(m_platformLayerToken.isValid());
        if (!platformLayer) {
            m_pendingPlatformLayerOperation |= DestroyPlatformLayer;
            m_pendingPlatformLayerOperation &= ~CreatePlatformLayer;
        }  else if ((m_platformLayerSize != platformLayer->platformLayerSize()) || (m_platformLayerToken != platformLayer->graphicsSurfaceToken())) {
            // m_platformLayerToken can be different to platformLayer->graphicsSurfaceToken(), even if m_platformLayer equals platformLayer.
            m_pendingPlatformLayerOperation |= RecreatePlatformLayer;
        }
    } else {
        if (platformLayer)
            m_pendingPlatformLayerOperation |= CreateAndSyncPlatformLayer;
    }

    m_platformLayer = platformLayer;
    // m_platformLayerToken is updated only here. 
    // In detail, when GraphicsContext3D is changed or reshaped, m_platformLayerToken is changed and setContentsToPlatformLayer() is always called.
    m_platformLayerSize = m_platformLayer ? m_platformLayer->platformLayerSize() : IntSize();
    m_platformLayerToken = m_platformLayer ? m_platformLayer->graphicsSurfaceToken() : GraphicsSurfaceToken();
    ASSERT(!(!m_platformLayerToken.isValid() && m_platformLayer));

    notifyFlushRequired();
#elif USE(COORDINATED_GRAPHICS_THREADED)
    if (m_platformLayer != platformLayer)
        m_shouldSyncPlatformLayer = true;

    m_platformLayer = platformLayer;
    notifyFlushRequired();
#else
    UNUSED_PARAM(platformLayer);
#endif
}
void CoordinatedGraphicsLayer::setContentsToCanvas(PlatformLayer* platformLayer)
{
#if USE(GRAPHICS_SURFACE)
    if (m_canvasPlatformLayer) {
        ASSERT(m_canvasToken.isValid());
        if (!platformLayer) {
            m_pendingCanvasOperation |= DestroyCanvas;
            m_pendingCanvasOperation &= ~CreateCanvas;
        }  else if ((m_canvasSize != platformLayer->platformLayerSize()) || (m_canvasToken != platformLayer->graphicsSurfaceToken())) {
            // m_canvasToken can be different to platformLayer->graphicsSurfaceToken(), even if m_canvasPlatformLayer equals platformLayer.
            m_pendingCanvasOperation |= RecreateCanvas;
        }
    } else {
        if (platformLayer)
            m_pendingCanvasOperation |= CreateAndSyncCanvas;
    }

    m_canvasPlatformLayer = platformLayer;
    // m_canvasToken is updated only here. In detail, when GraphicsContext3D is changed or reshaped, m_canvasToken is changed and setContentsToCanvas() is always called.
    m_canvasSize = m_canvasPlatformLayer ? m_canvasPlatformLayer->platformLayerSize() : IntSize();
    m_canvasToken = m_canvasPlatformLayer ? m_canvasPlatformLayer->graphicsSurfaceToken() : GraphicsSurfaceToken();
    ASSERT(!(!m_canvasToken.isValid() && m_canvasPlatformLayer));

    notifyFlushRequired();
#else
    UNUSED_PARAM(platformLayer);
#endif
}
Exemple #3
0
std::unique_ptr<GraphicsLayer> CompositingCoordinator::createGraphicsLayer(GraphicsLayerClient* client)
{
    CoordinatedGraphicsLayer* layer = new CoordinatedGraphicsLayer(client);
    layer->setCoordinator(this);
    m_registeredLayers.add(layer->id(), layer);
    m_state.layersToCreate.append(layer->id());
    layer->setNeedsVisibleRectAdjustment();
    notifyFlushRequired(layer);
    return std::unique_ptr<GraphicsLayer>(layer);
}
void CoordinatedGraphicsLayer::setContentsNeedsDisplay()
{
#if USE(GRAPHICS_SURFACE)
    if (m_canvasPlatformLayer)
        m_pendingCanvasOperation |= SyncCanvas;
#endif

    notifyFlushRequired();
    addRepaintRect(contentsRect());
}
Exemple #5
0
void CoordinatedGraphicsLayer::setContentsNeedsDisplay()
{
#if USE(GRAPHICS_SURFACE)
    if (m_platformLayer)
        m_pendingPlatformLayerOperation |= SyncPlatformLayer;
#elif USE(COORDINATED_GRAPHICS_THREADED)
    if (m_platformLayer)
        m_shouldUpdatePlatformLayer = true;
#endif

    notifyFlushRequired();
    addRepaintRect(contentsRect());
}
Exemple #6
0
void CompositingCoordinator::detachLayer(CoordinatedGraphicsLayer* layer)
{
    if (m_isPurging)
        return;

    m_registeredLayers.remove(layer->id());

    size_t index = m_state.layersToCreate.find(layer->id());
    if (index != notFound) {
        m_state.layersToCreate.remove(index);
        return;
    }

    m_state.layersToRemove.append(layer->id());
    notifyFlushRequired(layer);
}
void CoordinatedGraphicsLayer::flushCompositingState(const FloatRect& rect)
{
    if (notifyFlushRequired())
        return;

    if (CoordinatedGraphicsLayer* mask = toCoordinatedGraphicsLayer(maskLayer()))
        mask->flushCompositingStateForThisLayerOnly();

    if (CoordinatedGraphicsLayer* replica = toCoordinatedGraphicsLayer(replicaLayer()))
        replica->flushCompositingStateForThisLayerOnly();

    flushCompositingStateForThisLayerOnly();

    for (size_t i = 0; i < children().size(); ++i)
        children()[i]->flushCompositingState(rect);
}
void CoordinatedGraphicsLayer::flushCompositingState(const FloatRect& rect, bool viewportIsStable)
{
    if (notifyFlushRequired())
        return;

    if (CoordinatedGraphicsLayer* mask = toCoordinatedGraphicsLayer(maskLayer()))
        mask->flushCompositingStateForThisLayerOnly(viewportIsStable);

    if (CoordinatedGraphicsLayer* replica = toCoordinatedGraphicsLayer(replicaLayer()))
        replica->flushCompositingStateForThisLayerOnly(viewportIsStable);

    flushCompositingStateForThisLayerOnly(viewportIsStable);

    for (auto& child : children())
        child->flushCompositingState(rect, viewportIsStable);
}
Exemple #9
0
void CompositingCoordinator::sizeDidChange(const IntSize& newSize)
{
    m_rootLayer->setSize(newSize);
    notifyFlushRequired(m_rootLayer.get());
}
void CoordinatedGraphicsLayer::tiledBackingStoreHasPendingTileCreation()
{
    setNeedsVisibleRectAdjustment();
    notifyFlushRequired();
}
void CoordinatedGraphicsLayer::didChangeImageBacking()
{
    m_shouldSyncImageBacking = true;
    notifyFlushRequired();
}
void CoordinatedGraphicsLayer::didChangeFilters()
{
    m_shouldSyncFilters = true;
    notifyFlushRequired();
}
void CoordinatedGraphicsLayer::didChangeChildren()
{
    m_shouldSyncChildren = true;
    notifyFlushRequired();
}
void CoordinatedGraphicsLayer::didChangeAnimations()
{
    m_shouldSyncAnimations = true;
    notifyFlushRequired();
}
void CoordinatedGraphicsLayer::didChangeLayerState()
{
    m_shouldSyncLayerState = true;
    notifyFlushRequired();
}