bool CompositingCoordinator::paintToSurface(const IntSize& size, CoordinatedSurface::Flags flags, uint32_t& atlasID, IntPoint& offset, CoordinatedSurface::Client* client) { for (unsigned i = 0; i < m_updateAtlases.size(); ++i) { UpdateAtlas* atlas = m_updateAtlases[i].get(); if (atlas->supportsAlpha() == (flags & CoordinatedSurface::SupportsAlpha)) { // This will be false if there is no available buffer space. if (atlas->paintOnAvailableBuffer(size, atlasID, offset, client)) return true; } } static const int ScratchBufferDimension = 1024; // Should be a power of two. m_updateAtlases.append(std::make_unique<UpdateAtlas>(this, ScratchBufferDimension, flags)); scheduleReleaseInactiveAtlases(); return m_updateAtlases.last()->paintOnAvailableBuffer(size, atlasID, offset, client); }
PassOwnPtr<WebCore::GraphicsContext> LayerTreeCoordinator::beginContentUpdate(const WebCore::IntSize& size, ShareableBitmap::Flags flags, ShareableSurface::Handle& handle, WebCore::IntPoint& offset) { OwnPtr<WebCore::GraphicsContext> graphicsContext; for (unsigned i = 0; i < m_updateAtlases.size(); ++i) { UpdateAtlas* atlas = m_updateAtlases[i].get(); if (atlas->flags() == flags) { // This will return null if there is no available buffer space. graphicsContext = atlas->beginPaintingOnAvailableBuffer(handle, size, offset); if (graphicsContext) return graphicsContext.release(); } } static const int ScratchBufferDimension = 1024; // Should be a power of two. m_updateAtlases.append(adoptPtr(new UpdateAtlas(ScratchBufferDimension, flags))); scheduleReleaseInactiveAtlases(); return m_updateAtlases.last()->beginPaintingOnAvailableBuffer(handle, size, offset); }
PassOwnPtr<GraphicsContext> CoordinatedLayerTreeHost::beginContentUpdate(const IntSize& size, CoordinatedSurface::Flags flags, uint32_t& atlasID, IntPoint& offset) { OwnPtr<GraphicsContext> graphicsContext; for (unsigned i = 0; i < m_updateAtlases.size(); ++i) { UpdateAtlas* atlas = m_updateAtlases[i].get(); if (atlas->supportsAlpha() == (flags & CoordinatedSurface::SupportsAlpha)) { // This will return null if there is no available buffer space. graphicsContext = atlas->beginPaintingOnAvailableBuffer(atlasID, size, offset); if (graphicsContext) return graphicsContext.release(); } } static const int ScratchBufferDimension = 1024; // Should be a power of two. m_updateAtlases.append(adoptPtr(new UpdateAtlas(this, ScratchBufferDimension, flags))); scheduleReleaseInactiveAtlases(); return m_updateAtlases.last()->beginPaintingOnAvailableBuffer(atlasID, size, offset); }