Changeset 87160 in webkit
- Timestamp:
- May 24, 2011 9:30:53 AM (13 years ago)
- Location:
- trunk/Source/WebKit2
- Files:
-
- 2 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit2/ChangeLog
r87154 r87160 1 2011-05-24 Andreas Kling <kling@webkit.org> 2 3 Reviewed by Simon Hausmann. 4 5 [WK2] Change TiledDrawingArea to use ShareableBitmap instead of UpdateChunk. 6 https://bugs.webkit.org/show_bug.cgi?id=61296 7 8 Pass UpdateInfo containing ShareableBitmaps instead of UpdateChunk for tile updates. 9 Only the bounds rect and bitmap handle in the UpdateInfo are used since none of the 10 other parameters are needed for TiledDrawingArea. 11 12 * Shared/ShareableBitmap.h: 13 * Shared/qt/ShareableBitmapQt.cpp: 14 (WebKit::ShareableBitmap::createQImage): 15 (WebKit::ShareableBitmap::createGraphicsContext): 16 (WebKit::ShareableBitmap::paint): 17 * Shared/qt/UpdateChunk.cpp: Removed. 18 * Shared/qt/UpdateChunk.h: Removed. 19 * UIProcess/TiledDrawingAreaProxy.cpp: 20 (WebKit::TiledDrawingAreaProxy::didReceiveMessage): 21 (WebKit::TiledDrawingAreaProxy::waitUntilUpdatesComplete): 22 * UIProcess/TiledDrawingAreaProxy.h: 23 * UIProcess/TiledDrawingAreaTile.h: 24 * UIProcess/qt/TiledDrawingAreaProxyQt.cpp: 25 (WebKit::TiledDrawingAreaProxy::snapshotTaken): 26 * UIProcess/qt/TiledDrawingAreaTileQt.cpp: 27 (WebKit::TiledDrawingAreaTile::incorporateUpdate): 28 * WebKit2.pro: 29 * WebProcess/WebPage/TiledDrawingArea.cpp: 30 (WebKit::TiledDrawingArea::updateTile): 31 (WebKit::TiledDrawingArea::didReceiveMessage): 32 * WebProcess/WebPage/TiledDrawingArea.h: 33 * WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp: 34 (WebKit::TiledDrawingArea::paintIntoBitmap): 35 1 36 2011-05-24 Brady Eidson <beidson@apple.com> 2 37 -
trunk/Source/WebKit2/Shared/ShareableBitmap.h
r86247 r87160 40 40 #if USE(CAIRO) 41 41 #include <WebCore/RefPtrCairo.h> 42 #endif 43 44 #if PLATFORM(QT) 45 #include <QImage> 42 46 #endif 43 47 … … 114 118 // This is only safe to use when we know that the contents of the shareable bitmap won't change. 115 119 PassRefPtr<cairo_surface_t> createCairoSurface(); 120 #elif PLATFORM(QT) 121 // This creates a QImage that directly references the shared bitmap data. 122 // This is only safe to use when we know that the contents of the shareable bitmap won't change. 123 QImage createQImage(); 116 124 #endif 117 125 -
trunk/Source/WebKit2/Shared/qt/ShareableBitmapQt.cpp
r86544 r87160 35 35 namespace WebKit { 36 36 37 static inline QImage createQImage(void* data, int width, int height)37 QImage ShareableBitmap::createQImage() 38 38 { 39 return QImage(reinterpret_cast<uchar*>(data ), width, height, width* 4, QImage::Format_RGB32);39 return QImage(reinterpret_cast<uchar*>(data()), m_size.width(), m_size.height(), m_size.width() * 4, QImage::Format_RGB32); 40 40 } 41 41 … … 43 43 { 44 44 // FIXME: Should this be OwnPtr<QImage>? 45 QImage* image = new QImage(createQImage( data(), m_size.width(), m_size.height()));45 QImage* image = new QImage(createQImage()); 46 46 OwnPtr<GraphicsContext> context = adoptPtr(new GraphicsContext(new QPainter(image))); 47 47 context->takeOwnershipOfPlatformContext(); … … 51 51 void ShareableBitmap::paint(GraphicsContext& context, const IntPoint& dstPoint, const IntRect& srcRect) 52 52 { 53 QImage image = createQImage( data(), m_size.width(), m_size.height());53 QImage image = createQImage(); 54 54 QPainter* painter = context.platformContext(); 55 55 painter->drawImage(dstPoint, image, QRect(srcRect)); -
trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.cpp
r86045 r87160 31 31 #include "DrawingAreaProxyMessageKinds.h" 32 32 #include "MessageID.h" 33 #include "Update Chunk.h"33 #include "UpdateInfo.h" 34 34 #include "WebCoreArgumentCoders.h" 35 35 #include "WebPageProxy.h" … … 127 127 case DrawingAreaProxyLegacyMessage::TileUpdated: { 128 128 int tileID; 129 Update Chunk updateChunk;129 UpdateInfo updateInfo; 130 130 float scale; 131 131 unsigned pendingUpdateCount; 132 if (!arguments->decode(CoreIPC::Out(tileID, update Chunk, scale, pendingUpdateCount)))132 if (!arguments->decode(CoreIPC::Out(tileID, updateInfo, scale, pendingUpdateCount))) 133 133 return; 134 134 … … 136 136 ASSERT(!tile || tile->ID() == tileID); 137 137 if (tile) 138 tile-> updateFromChunk(&updateChunk, scale);138 tile->incorporateUpdate(updateInfo, scale); 139 139 tileBufferUpdateComplete(); 140 140 break; … … 161 161 } 162 162 case DrawingAreaProxyLegacyMessage::SnapshotTaken: { 163 UpdateChunk chunk;164 if (!arguments->decode(CoreIPC::Out( chunk)))163 ShareableBitmap::Handle handle; 164 if (!arguments->decode(CoreIPC::Out(handle))) 165 165 return; 166 snapshotTaken(chunk); 166 RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(handle); 167 snapshotTaken(bitmap.get()); 167 168 break; 168 169 } … … 181 182 while (hasPendingUpdates()) { 182 183 int tileID; 183 Update Chunk updateChunk;184 UpdateInfo updateInfo; 184 185 float scale; 185 186 unsigned pendingUpdateCount; … … 188 189 if (!arguments) 189 190 break; 190 if (!arguments->decode(CoreIPC::Out(tileID, update Chunk, scale, pendingUpdateCount)))191 if (!arguments->decode(CoreIPC::Out(tileID, updateInfo, scale, pendingUpdateCount))) 191 192 break; 192 193 TiledDrawingAreaTile* tile = m_tilesByID.get(tileID); 193 194 ASSERT(!tile || tile->ID() == tileID); 194 195 if (tile) 195 tile-> updateFromChunk(&updateChunk, scale);196 tile->incorporateUpdate(updateInfo, scale); 196 197 } 197 198 tileBufferUpdateComplete(); -
trunk/Source/WebKit2/UIProcess/TiledDrawingAreaProxy.h
r79803 r87160 51 51 namespace WebKit { 52 52 53 class UpdateChunk;53 class ShareableBitmap; 54 54 class WebPageProxy; 55 55 … … 110 110 void updateWebView(const Vector<WebCore::IntRect>& paintedArea); 111 111 112 void snapshotTaken( UpdateChunk&);112 void snapshotTaken(ShareableBitmap*); 113 113 114 114 // DrawingAreaProxy -
trunk/Source/WebKit2/UIProcess/TiledDrawingAreaTile.h
r74324 r87160 42 42 43 43 class TiledDrawingAreaProxy; 44 class Update Chunk;44 class UpdateInfo; 45 45 46 46 class TiledDrawingAreaTile : public RefCounted<TiledDrawingAreaTile> { … … 64 64 void resize(const WebCore::IntSize&); 65 65 66 void updateFromChunk(UpdateChunk* updateChunk, float);66 void incorporateUpdate(const UpdateInfo&, float scale); 67 67 68 68 int ID() const { return m_ID; } -
trunk/Source/WebKit2/UIProcess/qt/TiledDrawingAreaProxyQt.cpp
r76916 r87160 31 31 #include "DrawingAreaMessageKinds.h" 32 32 #include "DrawingAreaProxyMessageKinds.h" 33 #include " UpdateChunk.h"33 #include "ShareableBitmap.h" 34 34 #include "WKAPICast.h" 35 35 #include "WebPageProxy.h" … … 63 63 } 64 64 65 void TiledDrawingAreaProxy::snapshotTaken( UpdateChunk& chunk)65 void TiledDrawingAreaProxy::snapshotTaken(ShareableBitmap* bitmap) 66 66 { 67 emit m_webView->snapshotTaken( chunk.createImage());67 emit m_webView->snapshotTaken(bitmap->createQImage()); 68 68 } 69 69 -
trunk/Source/WebKit2/UIProcess/qt/TiledDrawingAreaTileQt.cpp
r77317 r87160 30 30 31 31 #include "GraphicsContext.h" 32 #include "ShareableBitmap.h" 32 33 #include "TiledDrawingAreaProxy.h" 34 #include "UpdateInfo.h" 33 35 #include "WebPageProxy.h" 34 36 #include "WebProcessProxy.h" 35 #include "UpdateChunk.h"36 37 #include <QApplication> 37 38 #include <QObject> … … 118 119 } 119 120 120 void TiledDrawingAreaTile:: updateFromChunk(UpdateChunk* updateChunk, float)121 void TiledDrawingAreaTile::incorporateUpdate(const UpdateInfo& updateInfo, float) 121 122 { 122 QImage image(updateChunk->createImage()); 123 const IntRect& updateChunkRect = updateChunk->rect(); 123 RefPtr<ShareableBitmap> bitmap = ShareableBitmap::create(updateInfo.bitmapHandle); 124 QImage image(bitmap->createQImage()); 125 const IntRect& updateChunkRect = updateInfo.updateRectBounds; 124 126 125 127 #ifdef TILE_DEBUG_LOG -
trunk/Source/WebKit2/WebKit2.pro
r87065 r87160 172 172 Shared/Plugins/PluginQuirks.h \ 173 173 Shared/qt/PlatformCertificateInfo.h \ 174 Shared/qt/UpdateChunk.h \175 174 Shared/qt/WebEventFactoryQt.h \ 176 175 UIProcess/Authentication/AuthenticationChallengeProxy.h \ … … 378 377 Shared/qt/NativeWebMouseEventQt.cpp \ 379 378 Shared/qt/NativeWebWheelEventQt.cpp \ 380 Shared/qt/UpdateChunk.cpp \381 379 Shared/qt/WebCoreArgumentCodersQt.cpp \ 382 380 Shared/qt/WebEventFactoryQt.cpp \ -
trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.cpp
r79803 r87160 32 32 #include "DrawingAreaProxyMessageKinds.h" 33 33 #include "MessageID.h" 34 #include "Update Chunk.h"34 #include "UpdateInfo.h" 35 35 #include "WebCore/Frame.h" 36 36 #include "WebCore/FrameView.h" … … 139 139 m_webPage->layoutIfNeeded(); 140 140 141 UpdateChunk updateChunk(dirtyRect); 142 paintIntoUpdateChunk(&updateChunk, scale); 141 UpdateInfo updateInfo; 142 updateInfo.updateRectBounds = dirtyRect; 143 RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(dirtyRect.size(), ShareableBitmap::SupportsAlpha); 144 bitmap->createHandle(updateInfo.bitmapHandle); 145 paintIntoBitmap(bitmap.get(), dirtyRect, scale); 143 146 144 147 unsigned pendingUpdateCount = m_pendingUpdates.size(); 145 WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::TileUpdated, m_webPage->pageID(), CoreIPC::In(tileID, update Chunk, scale, pendingUpdateCount));148 WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::TileUpdated, m_webPage->pageID(), CoreIPC::In(tileID, updateInfo, scale, pendingUpdateCount)); 146 149 } 147 150 … … 220 223 float targetScale = float(targetSize.width()) / contentsRect.width(); 221 224 222 UpdateChunk updateChunk(IntRect(IntPoint(contentsRect.x() * targetScale, contentsRect.y() * targetScale), targetSize)); 223 paintIntoUpdateChunk(&updateChunk, targetScale); 224 225 WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::SnapshotTaken, m_webPage->pageID(), CoreIPC::In(updateChunk)); 225 IntRect tileRect(IntPoint(contentsRect.x() * targetScale, contentsRect.y() * targetScale), targetSize); 226 227 UpdateInfo updateInfo; 228 updateInfo.updateRectBounds = tileRect; 229 RefPtr<ShareableBitmap> bitmap = ShareableBitmap::createShareable(tileRect.size(), ShareableBitmap::SupportsAlpha); 230 bitmap->createHandle(updateInfo.bitmapHandle); 231 232 paintIntoBitmap(bitmap.get(), tileRect, targetScale); 233 234 WebProcess::shared().connection()->deprecatedSend(DrawingAreaProxyLegacyMessage::SnapshotTaken, m_webPage->pageID(), CoreIPC::In(updateInfo)); 226 235 break; 227 236 } -
trunk/Source/WebKit2/WebProcess/WebPage/TiledDrawingArea.h
r79803 r87160 36 36 namespace WebKit { 37 37 38 class UpdateChunk;38 class ShareableBitmap; 39 39 40 40 class TiledDrawingArea : public DrawingArea { … … 68 68 69 69 // Platform overrides 70 void paintInto UpdateChunk(UpdateChunk*, float scale);70 void paintIntoBitmap(ShareableBitmap*, const WebCore::IntRect& tileRect, float scale); 71 71 72 72 void tileUpdateTimerFired(); -
trunk/Source/WebKit2/WebProcess/WebPage/qt/TiledDrawingAreaQt.cpp
r76916 r87160 29 29 #if ENABLE(TILED_BACKING_STORE) 30 30 31 #include " UpdateChunk.h"31 #include "ShareableBitmap.h" 32 32 #include "WebPage.h" 33 33 #include <WebCore/GraphicsContext.h> … … 40 40 namespace WebKit { 41 41 42 void TiledDrawingArea::paintInto UpdateChunk(UpdateChunk* updateChunk, float scale)42 void TiledDrawingArea::paintIntoBitmap(ShareableBitmap* bitmap, const WebCore::IntRect& tileRect, float scale) 43 43 { 44 IntRect tileRect = updateChunk->rect(); 45 QImage image(updateChunk->createImage()); 46 QPainter painter(&image); 47 // Now paint into the backing store. 48 GraphicsContext graphicsContext(&painter); 49 graphicsContext.translate(-tileRect.x(), -tileRect.y()); 50 graphicsContext.scale(FloatSize(scale, scale)); 44 OwnPtr<GraphicsContext> graphicsContext(bitmap->createGraphicsContext()); 45 graphicsContext->translate(-tileRect.x(), -tileRect.y()); 46 graphicsContext->scale(FloatSize(scale, scale)); 51 47 IntRect contentRect = enclosingIntRect(FloatRect(tileRect.x() / scale, 52 48 tileRect.y() / scale, 53 49 tileRect.width() / scale, 54 50 tileRect.height() / scale)); 55 m_webPage->drawRect( graphicsContext, contentRect);51 m_webPage->drawRect(*graphicsContext.get(), contentRect); 56 52 } 57 53
Note: See TracChangeset
for help on using the changeset viewer.