diff options
| author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
| commit | cfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch) | |
| tree | 24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp | |
| parent | 69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff) | |
| download | qtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz | |
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp')
| -rw-r--r-- | Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp b/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp index 27500635d..9a5418f1e 100644 --- a/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp +++ b/Source/WebKit2/WebProcess/WebPage/UpdateAtlas.cpp @@ -30,12 +30,28 @@ using namespace WebCore; namespace WebKit { -UpdateAtlas::UpdateAtlas(int dimension, ShareableBitmap::Flags flags) - : m_flags(flags) +UpdateAtlas::UpdateAtlas(UpdateAtlasClient* client, int dimension, ShareableBitmap::Flags flags) + : m_client(client) + , m_flags(flags) , m_inactivityInSeconds(0) + , m_isVaild(true) { + static int nextID = 0; + m_ID = ++nextID; IntSize size = nextPowerOfTwo(IntSize(dimension, dimension)); m_surface = ShareableSurface::create(size, flags, ShareableSurface::SupportsGraphicsSurface); + + if (!m_surface->createHandle(m_handle)) { + m_isVaild = false; + return; + } + m_client->createUpdateAtlas(m_ID, m_handle); +} + +UpdateAtlas::~UpdateAtlas() +{ + if (m_isVaild) + m_client->removeUpdateAtlas(m_ID); } void UpdateAtlas::buildLayoutIfNeeded() @@ -51,7 +67,7 @@ void UpdateAtlas::didSwapBuffers() m_areaAllocator.clear(); } -PassOwnPtr<GraphicsContext> UpdateAtlas::beginPaintingOnAvailableBuffer(ShareableSurface::Handle& handle, const WebCore::IntSize& size, IntPoint& offset) +PassOwnPtr<GraphicsContext> UpdateAtlas::beginPaintingOnAvailableBuffer(int& atlasID, const WebCore::IntSize& size, IntPoint& offset) { m_inactivityInSeconds = 0; buildLayoutIfNeeded(); @@ -61,8 +77,10 @@ PassOwnPtr<GraphicsContext> UpdateAtlas::beginPaintingOnAvailableBuffer(Shareabl if (rect.isEmpty()) return PassOwnPtr<GraphicsContext>(); - if (!m_surface->createHandle(handle)) - return PassOwnPtr<WebCore::GraphicsContext>(); + if (!m_isVaild) + return PassOwnPtr<GraphicsContext>(); + + atlasID = m_ID; // FIXME: Use tri-state buffers, to allow faster updates. offset = rect.location(); |
