Diff
Modified: trunk/Source/WebKit2/ChangeLog (87159 => 87160)
--- trunk/Source/WebKit2/ChangeLog 2011-05-24 16:25:11 UTC (rev 87159)
+++ trunk/Source/WebKit2/ChangeLog 2011-05-24 16:30:53 UTC (rev 87160)
@@ -1,3 +1,38 @@
+2011-05-24 Andreas Kling <[email protected]>
+
+ Reviewed by Simon Hausmann.
+
+ [WK2] Change TiledDrawingArea to use ShareableBitmap instead of UpdateChunk.
+ https://bugs.webkit.org/show_bug.cgi?id=61296
+
+ Pass UpdateInfo containing ShareableBitmaps instead of UpdateChunk for tile updates.
+ Only the bounds rect and bitmap handle in the UpdateInfo are used since none of the
+ other parameters are needed for TiledDrawingArea.
+
+ * Shared/ShareableBitmap.h:
+ * Shared/qt/ShareableBitmapQt.cpp:
+ (WebKit::ShareableBitmap::createQImage):
+ (WebKit::ShareableBitmap::createGraphicsContext):
+ (WebKit::ShareableBitmap::paint):
+ * Shared/qt/UpdateChunk.cpp: Removed.
+ * Shared/qt/UpdateChunk.h: Removed.
+ * UIProcess/TiledDrawingAreaProxy.cpp:
+ (WebKit::TiledDrawingAreaProxy::didReceiveMessage):
+ (WebKit::TiledDrawingAreaProxy::waitUntilUpdatesComplete):
+ * UIProcess/TiledDrawingAreaProxy.h:
+ * UIProcess/TiledDrawingAreaTile.h:
+ * UIProcess/qt/TiledDrawingAreaProxyQt.cpp:
+ (WebKit::TiledDrawingAreaProxy::snapshotTaken):
+ * UIProcess/qt/TiledDrawingAreaTileQt.cpp:
+ (WebKit::TiledDrawingAreaTile::incorporateUpdate):
+ * WebKit2.pro:
+ * WebProcess/WebPage/TiledDrawingArea.cpp:
+ (WebKit::TiledDrawingArea::updateTile):
+ (WebKit::TiledDrawingArea::didReceiveMessage):
+ * WebProcess/WebPage/TiledDrawingArea.h:
+ * WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp:
+ (WebKit::TiledDrawingArea::paintIntoBitmap):
+
2011-05-24 Brady Eidson <[email protected]>
Build fix after r87153
Modified: trunk/Source/WebKit2/Shared/ShareableBitmap.h (87159 => 87160)
--- trunk/Source/WebKit2/Shared/ShareableBitmap.h 2011-05-24 16:25:11 UTC (rev 87159)
+++ trunk/Source/WebKit2/Shared/ShareableBitmap.h 2011-05-24 16:30:53 UTC (rev 87160)
@@ -41,6 +41,10 @@
#include <WebCore/RefPtrCairo.h>
#endif
+#if PLATFORM(QT)
+#include <QImage>
+#endif
+
namespace WebCore {
class GraphicsContext;
}
@@ -113,6 +117,10 @@
// This creates a BitmapImage that directly references the shared bitmap data.
// This is only safe to use when we know that the contents of the shareable bitmap won't change.
PassRefPtr<cairo_surface_t> createCairoSurface();
+#elif PLATFORM(QT)
+ // This creates a QImage that directly references the shared bitmap data.
+ // This is only safe to use when we know that the contents of the shareable bitmap won't change.
+ QImage createQImage();
#endif
private:
Modified: trunk/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp (87159 => 87160)
--- trunk/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp 2011-05-24 16:25:11 UTC (rev 87159)
+++ trunk/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp 2011-05-24 16:30:53 UTC (rev 87160)
@@ -34,15 +34,15 @@
namespace WebKit {
-static inline QImage createQImage(void* data, int width, int height)
+QImage ShareableBitmap::createQImage()
{
- return QImage(reinterpret_cast<uchar*>(data), width, height, width * 4, QImage::Format_RGB32);
+ return QImage(reinterpret_cast<uchar*>(data()), m_size.width(), m_size.height(), m_size.width() * 4, QImage::Format_RGB32);
}
PassOwnPtr<GraphicsContext> ShareableBitmap::createGraphicsContext()
{
// FIXME: Should this be OwnPtr<QImage>?
- QImage* image = new QImage(createQImage(data(), m_size.width(), m_size.height()));
+ QImage* image = new QImage(createQImage());
OwnPtr<GraphicsContext> context = adoptPtr(new GraphicsContext(new QPainter(image)));
context->takeOwnershipOfPlatformContext();
return context.release();
@@ -50,7 +50,7 @@
void ShareableBitmap::paint(GraphicsContext& context, const IntPoint& dstPoint, const IntRect& srcRect)
{
- QImage image = createQImage(data(), m_size.width(), m_size.height());
+ QImage image = createQImage();
QPainter* painter = context.platformContext();
painter->drawImage(dstPoint, image, QRect(srcRect));
}
Deleted: trunk/Source/WebKit2/Shared/qt/UpdateChunk.cpp (87159 => 87160)
--- trunk/Source/WebKit2/Shared/qt/UpdateChunk.cpp 2011-05-24 16:25:11 UTC (rev 87159)
+++ trunk/Source/WebKit2/Shared/qt/UpdateChunk.cpp 2011-05-24 16:30:53 UTC (rev 87160)
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2010 University of Szeged
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "UpdateChunk.h"
-
-#include "ArgumentDecoder.h"
-#include "ArgumentEncoder.h"
-#include "WebCoreArgumentCoders.h"
-#include <QIODevice>
-#include <QImage>
-#include <QPixmap>
-#include <WebCore/FloatRect.h>
-#include <wtf/text/WTFString.h>
-
-using namespace WebCore;
-using namespace std;
-
-namespace WebKit {
-
-UpdateChunk::UpdateChunk()
-{
-}
-
-UpdateChunk::UpdateChunk(const IntRect& rect)
- : m_rect(rect)
- , m_sharedMemory(SharedMemory::create(size()))
-{
-}
-
-UpdateChunk::~UpdateChunk()
-{
-}
-
-void UpdateChunk::encode(CoreIPC::ArgumentEncoder* encoder) const
-{
- encoder->encode(m_rect);
- if (!m_sharedMemory) {
- encoder->encode(false);
- return;
- }
-
- SharedMemory::Handle handle;
- if (m_sharedMemory->createHandle(handle, SharedMemory::ReadOnly)) {
- encoder->encode(true);
- encoder->encode(handle);
- } else
- encoder->encode(false);
-
- m_sharedMemory = 0;
-}
-
-bool UpdateChunk::decode(CoreIPC::ArgumentDecoder* decoder, UpdateChunk& chunk)
-{
- ASSERT_ARG(chunk, chunk.isEmpty());
-
- IntRect rect;
- if (!decoder->decode(rect))
- return false;
-
- chunk.m_rect = rect;
-
- bool hasSharedMemory;
- if (!decoder->decode(hasSharedMemory))
- return false;
-
- if (!hasSharedMemory) {
- chunk.m_sharedMemory = 0;
- return true;
- }
-
- SharedMemory::Handle handle;
- if (!decoder->decode(handle))
- return false;
-
- chunk.m_sharedMemory = SharedMemory::create(handle, SharedMemory::ReadOnly);
- return true;
-}
-
-size_t UpdateChunk::size() const
-{
- int bpp;
- if (QPixmap::defaultDepth() == 16)
- bpp = 2;
- else
- bpp = 4;
-
- return ((m_rect.width() * bpp + 3) & ~0x3)
- * m_rect.height();
-}
-
-QImage UpdateChunk::createImage() const
-{
- ASSERT(m_sharedMemory);
- if (!m_sharedMemory)
- return QImage();
-
- QImage::Format format;
- int bpp;
- if (QPixmap::defaultDepth() == 16) {
- format = QImage::Format_RGB16;
- bpp = 2;
- } else {
- format = QImage::Format_RGB32;
- bpp = 4;
- }
-
- return QImage(reinterpret_cast<unsigned char*>(m_sharedMemory->data()), m_rect.width(), m_rect.height(), (m_rect.width() * bpp + 3) & ~0x3, format);
-}
-
-} // namespace WebKit
Deleted: trunk/Source/WebKit2/Shared/qt/UpdateChunk.h (87159 => 87160)
--- trunk/Source/WebKit2/Shared/qt/UpdateChunk.h 2011-05-24 16:25:11 UTC (rev 87159)
+++ trunk/Source/WebKit2/Shared/qt/UpdateChunk.h 2011-05-24 16:30:53 UTC (rev 87160)
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef UpdateChunk_h
-#define UpdateChunk_h
-
-#include <QImage>
-#include <WebCore/IntRect.h>
-#include "SharedMemory.h"
-
-namespace CoreIPC {
-class ArgumentEncoder;
-class ArgumentDecoder;
-}
-
-namespace WebKit {
-
-class UpdateChunk {
-public:
- UpdateChunk();
- UpdateChunk(const WebCore::IntRect&);
- ~UpdateChunk();
-
- const WebCore::IntRect& rect() const { return m_rect; }
- bool isEmpty() const { return m_rect.isEmpty(); }
-
- void encode(CoreIPC::ArgumentEncoder*) const;
- static bool decode(CoreIPC::ArgumentDecoder*, UpdateChunk&);
-
- QImage createImage() const;
-
-private:
- size_t size() const;
-
- WebCore::IntRect m_rect;
-
- mutable RefPtr<SharedMemory> m_sharedMemory;
-};
-
-} // namespace WebKit
-
-#endif // UpdateChunk_h
Modified: trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp (87159 => 87160)
--- trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp 2011-05-24 16:25:11 UTC (rev 87159)
+++ trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp 2011-05-24 16:30:53 UTC (rev 87160)
@@ -30,7 +30,7 @@
#include "DrawingAreaMessageKinds.h"
#include "DrawingAreaProxyMessageKinds.h"
#include "MessageID.h"
-#include "UpdateChunk.h"
+#include "UpdateInfo.h"
#include "WebCoreArgumentCoders.h"
#include "WebPageProxy.h"
#include "WebProcessProxy.h"
@@ -126,16 +126,16 @@
switch (messageID.get<DrawingAreaProxyLegacyMessage::Kind>()) {
case DrawingAreaProxyLegacyMessage::TileUpdated: {
int tileID;
- UpdateChunk updateChunk;
+ UpdateInfo updateInfo;
float scale;
unsigned pendingUpdateCount;
- if (!arguments->decode(CoreIPC::Out(tileID, updateChunk, scale, pendingUpdateCount)))
+ if (!arguments->decode(CoreIPC::Out(tileID, updateInfo, scale, pendingUpdateCount)))
return;
TiledDrawingAreaTile* tile = m_tilesByID.get(tileID);
ASSERT(!tile || tile->ID() == tileID);
if (tile)
- tile->updateFromChunk(&updateChunk, scale);
+ tile->incorporateUpdate(updateInfo, scale);
tileBufferUpdateComplete();
break;
}
@@ -160,10 +160,11 @@
break;
}
case DrawingAreaProxyLegacyMessage::SnapshotTaken: {
- UpdateChunk chunk;
- if (!arguments->decode(CoreIPC::Out(chunk)))
+ ShareableBitmap::Handle handle;
+ if (!arguments->decode(CoreIPC::Out(handle)))
return;
- snapshotTaken(chunk);
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(handle);
+ snapshotTaken(bitmap.get());
break;
}
default:
@@ -180,19 +181,19 @@
{
while (hasPendingUpdates()) {
int tileID;
- UpdateChunk updateChunk;
+ UpdateInfo updateInfo;
float scale;
unsigned pendingUpdateCount;
static const double tileUpdateTimeout = 10.0;
OwnPtr<CoreIPC::ArgumentDecoder> arguments = page()->process()->connection()->deprecatedWaitFor(DrawingAreaProxyLegacyMessage::TileUpdated, page()->pageID(), tileUpdateTimeout);
if (!arguments)
break;
- if (!arguments->decode(CoreIPC::Out(tileID, updateChunk, scale, pendingUpdateCount)))
+ if (!arguments->decode(CoreIPC::Out(tileID, updateInfo, scale, pendingUpdateCount)))
break;
TiledDrawingAreaTile* tile = m_tilesByID.get(tileID);
ASSERT(!tile || tile->ID() == tileID);
if (tile)
- tile->updateFromChunk(&updateChunk, scale);
+ tile->incorporateUpdate(updateInfo, scale);
}
tileBufferUpdateComplete();
}
Modified: trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h (87159 => 87160)
--- trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h 2011-05-24 16:25:11 UTC (rev 87159)
+++ trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h 2011-05-24 16:30:53 UTC (rev 87160)
@@ -50,7 +50,7 @@
namespace WebKit {
-class UpdateChunk;
+class ShareableBitmap;
class WebPageProxy;
#if PLATFORM(MAC)
@@ -109,7 +109,7 @@
WebCore::IntRect webViewVisibleRect();
void updateWebView(const Vector<WebCore::IntRect>& paintedArea);
- void snapshotTaken(UpdateChunk&);
+ void snapshotTaken(ShareableBitmap*);
// DrawingAreaProxy
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
Modified: trunk/Source/WebKit2/UIProcess/TiledDrawingAreaTile.h (87159 => 87160)
--- trunk/Source/WebKit2/UIProcess/TiledDrawingAreaTile.h 2011-05-24 16:25:11 UTC (rev 87159)
+++ trunk/Source/WebKit2/UIProcess/TiledDrawingAreaTile.h 2011-05-24 16:30:53 UTC (rev 87160)
@@ -41,7 +41,7 @@
namespace WebKit {
class TiledDrawingAreaProxy;
-class UpdateChunk;
+class UpdateInfo;
class TiledDrawingAreaTile : public RefCounted<TiledDrawingAreaTile> {
public:
@@ -63,7 +63,7 @@
const WebCore::IntRect& rect() const { return m_rect; }
void resize(const WebCore::IntSize&);
- void updateFromChunk(UpdateChunk* updateChunk, float);
+ void incorporateUpdate(const UpdateInfo&, float scale);
int ID() const { return m_ID; }
Modified: trunk/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp (87159 => 87160)
--- trunk/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp 2011-05-24 16:25:11 UTC (rev 87159)
+++ trunk/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp 2011-05-24 16:30:53 UTC (rev 87160)
@@ -30,7 +30,7 @@
#include "DrawingAreaMessageKinds.h"
#include "DrawingAreaProxyMessageKinds.h"
-#include "UpdateChunk.h"
+#include "ShareableBitmap.h"
#include "WKAPICast.h"
#include "WebPageProxy.h"
@@ -62,9 +62,9 @@
return toImpl(m_webView->page()->pageRef());
}
-void TiledDrawingAreaProxy::snapshotTaken(UpdateChunk& chunk)
+void TiledDrawingAreaProxy::snapshotTaken(ShareableBitmap* bitmap)
{
- emit m_webView->snapshotTaken(chunk.createImage());
+ emit m_webView->snapshotTaken(bitmap->createQImage());
}
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp (87159 => 87160)
--- trunk/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp 2011-05-24 16:25:11 UTC (rev 87159)
+++ trunk/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp 2011-05-24 16:30:53 UTC (rev 87160)
@@ -29,10 +29,11 @@
#if ENABLE(TILED_BACKING_STORE)
#include "GraphicsContext.h"
+#include "ShareableBitmap.h"
#include "TiledDrawingAreaProxy.h"
+#include "UpdateInfo.h"
#include "WebPageProxy.h"
#include "WebProcessProxy.h"
-#include "UpdateChunk.h"
#include <QApplication>
#include <QObject>
#include <QPainter>
@@ -117,10 +118,11 @@
context->platformContext()->drawPixmap(target, m_buffer, source);
}
-void TiledDrawingAreaTile::updateFromChunk(UpdateChunk* updateChunk, float)
+void TiledDrawingAreaTile::incorporateUpdate(const UpdateInfo& updateInfo, float)
{
- QImage image(updateChunk->createImage());
- const IntRect& updateChunkRect = updateChunk->rect();
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(updateInfo.bitmapHandle);
+ QImage image(bitmap->createQImage());
+ const IntRect& updateChunkRect = updateInfo.updateRectBounds;
#ifdef TILE_DEBUG_LOG
qDebug() << "tile updated id=" << ID() << " rect=" << QRect(updateChunkRect);
Modified: trunk/Source/WebKit2/WebKit2.pro (87159 => 87160)
--- trunk/Source/WebKit2/WebKit2.pro 2011-05-24 16:25:11 UTC (rev 87159)
+++ trunk/Source/WebKit2/WebKit2.pro 2011-05-24 16:30:53 UTC (rev 87160)
@@ -171,7 +171,6 @@
Shared/Plugins/PluginProcessCreationParameters.h \
Shared/Plugins/PluginQuirks.h \
Shared/qt/PlatformCertificateInfo.h \
- Shared/qt/UpdateChunk.h \
Shared/qt/WebEventFactoryQt.h \
UIProcess/Authentication/AuthenticationChallengeProxy.h \
UIProcess/Authentication/AuthenticationDecisionListener.h \
@@ -377,7 +376,6 @@
Shared/qt/NativeWebKeyboardEventQt.cpp \
Shared/qt/NativeWebMouseEventQt.cpp \
Shared/qt/NativeWebWheelEventQt.cpp \
- Shared/qt/UpdateChunk.cpp \
Shared/qt/WebCoreArgumentCodersQt.cpp \
Shared/qt/WebEventFactoryQt.cpp \
Shared/qt/WebURLRequestQt.cpp \
Modified: trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp (87159 => 87160)
--- trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp 2011-05-24 16:25:11 UTC (rev 87159)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp 2011-05-24 16:30:53 UTC (rev 87160)
@@ -31,7 +31,7 @@
#include "DrawingAreaMessageKinds.h"
#include "DrawingAreaProxyMessageKinds.h"
#include "MessageID.h"
-#include "UpdateChunk.h"
+#include "UpdateInfo.h"
#include "WebCore/Frame.h"
#include "WebCore/FrameView.h"
#include "WebCoreArgumentCoders.h"
@@ -138,11 +138,14 @@
{
m_webPage->layoutIfNeeded();
- UpdateChunk updateChunk(dirtyRect);
- paintIntoUpdateChunk(&updateChunk, scale);
+ UpdateInfo updateInfo;
+ updateInfo.updateRectBounds = dirtyRect;
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(dirtyRect.size(), ShareableBitmap::SupportsAlpha);
+ bitmap->createHandle(updateInfo.bitmapHandle);
+ paintIntoBitmap(bitmap.get(), dirtyRect, scale);
unsigned pendingUpdateCount = m_pendingUpdates.size();
- WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::TileUpdated, m_webPage->pageID(), CoreIPC::In(tileID, updateChunk, scale, pendingUpdateCount));
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::TileUpdated, m_webPage->pageID(), CoreIPC::In(tileID, updateInfo, scale, pendingUpdateCount));
}
void TiledDrawingArea::tileUpdateTimerFired()
@@ -219,10 +222,16 @@
float targetScale = float(targetSize.width()) / contentsRect.width();
- UpdateChunk updateChunk(IntRect(IntPoint(contentsRect.x() * targetScale, contentsRect.y() * targetScale), targetSize));
- paintIntoUpdateChunk(&updateChunk, targetScale);
+ IntRect tileRect(IntPoint(contentsRect.x() * targetScale, contentsRect.y() * targetScale), targetSize);
- WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::SnapshotTaken, m_webPage->pageID(), CoreIPC::In(updateChunk));
+ UpdateInfo updateInfo;
+ updateInfo.updateRectBounds = tileRect;
+ RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(tileRect.size(), ShareableBitmap::SupportsAlpha);
+ bitmap->createHandle(updateInfo.bitmapHandle);
+
+ paintIntoBitmap(bitmap.get(), tileRect, targetScale);
+
+ WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::SnapshotTaken, m_webPage->pageID(), CoreIPC::In(updateInfo));
break;
}
default:
Modified: trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h (87159 => 87160)
--- trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h 2011-05-24 16:25:11 UTC (rev 87159)
+++ trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h 2011-05-24 16:30:53 UTC (rev 87160)
@@ -35,7 +35,7 @@
namespace WebKit {
-class UpdateChunk;
+class ShareableBitmap;
class TiledDrawingArea : public DrawingArea {
public:
@@ -67,7 +67,7 @@
void updateTile(int tileID, const WebCore::IntRect& dirtyRect, float scale);
// Platform overrides
- void paintIntoUpdateChunk(UpdateChunk*, float scale);
+ void paintIntoBitmap(ShareableBitmap*, const WebCore::IntRect& tileRect, float scale);
void tileUpdateTimerFired();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp (87159 => 87160)
--- trunk/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp 2011-05-24 16:25:11 UTC (rev 87159)
+++ trunk/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp 2011-05-24 16:30:53 UTC (rev 87160)
@@ -28,7 +28,7 @@
#if ENABLE(TILED_BACKING_STORE)
-#include "UpdateChunk.h"
+#include "ShareableBitmap.h"
#include "WebPage.h"
#include <WebCore/GraphicsContext.h>
@@ -39,20 +39,16 @@
namespace WebKit {
-void TiledDrawingArea::paintIntoUpdateChunk(UpdateChunk* updateChunk, float scale)
+void TiledDrawingArea::paintIntoBitmap(ShareableBitmap* bitmap, const WebCore::IntRect& tileRect, float scale)
{
- IntRect tileRect = updateChunk->rect();
- QImage image(updateChunk->createImage());
- QPainter painter(&image);
- // Now paint into the backing store.
- GraphicsContext graphicsContext(&painter);
- graphicsContext.translate(-tileRect.x(), -tileRect.y());
- graphicsContext.scale(FloatSize(scale, scale));
+ OwnPtr<GraphicsContext> graphicsContext(bitmap->createGraphicsContext());
+ graphicsContext->translate(-tileRect.x(), -tileRect.y());
+ graphicsContext->scale(FloatSize(scale, scale));
IntRect contentRect = enclosingIntRect(FloatRect(tileRect.x() / scale,
tileRect.y() / scale,
tileRect.width() / scale,
tileRect.height() / scale));
- m_webPage->drawRect(graphicsContext, contentRect);
+ m_webPage->drawRect(*graphicsContext.get(), contentRect);
}
} // namespace WebKit