Пример #1
0
void LayerTreeRenderer::syncCanvas(WebLayerID id, const WebCore::IntSize& canvasSize, const GraphicsSurfaceToken& token, uint32_t frontBuffer)
{
    if (canvasSize.isEmpty() || !m_textureMapper)
        return;

    ensureLayer(id);
    GraphicsLayer* layer = layerByID(id);

    RefPtr<TextureMapperSurfaceBackingStore> canvasBackingStore;
    SurfaceBackingStoreMap::iterator it = m_surfaceBackingStores.find(id);
    if (it == m_surfaceBackingStores.end()) {
        canvasBackingStore = TextureMapperSurfaceBackingStore::create();
        m_surfaceBackingStores.set(id, canvasBackingStore);
    } else
        canvasBackingStore = it->value;

    canvasBackingStore->setGraphicsSurface(token, canvasSize, frontBuffer);
    layer->setContentsToMedia(canvasBackingStore.get());
}
Пример #2
0
void LayerTreeRenderer::syncCanvas(WebLayerID id, const WebCore::IntSize& canvasSize, uint32_t graphicsSurfaceToken)
{
    if (canvasSize.isEmpty() || !m_textureMapper)
        return;

#if USE(GRAPHICS_SURFACE)
    ensureLayer(id);
    GraphicsLayer* layer = layerByID(id);

    RefPtr<TextureMapperSurfaceBackingStore> canvasBackingStore;
    SurfaceBackingStoreMap::iterator it = m_surfaceBackingStores.find(id);
    if (it == m_surfaceBackingStores.end()) {
        canvasBackingStore = TextureMapperSurfaceBackingStore::create();
        m_surfaceBackingStores.set(id, canvasBackingStore);
    } else
        canvasBackingStore = it->second;

    canvasBackingStore->setGraphicsSurface(graphicsSurfaceToken, canvasSize);
    layer->setContentsToMedia(canvasBackingStore.get());
#endif
}