Changeset 122507 in webkit
- Timestamp:
- Jul 12, 2012 2:37:30 PM (12 years ago)
- Location:
- trunk/Source/WebKit/qt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/qt/Api/qwebframe.cpp
r121710 r122507 357 357 #endif 358 358 359 // This code is copied from ChromeClientGtk.cpp. 360 static void coalesceRectsIfPossible(const QRect& clipRect, QVector<QRect>& rects) 361 { 362 const unsigned int rectThreshold = 10; 363 const float wastedSpaceThreshold = 0.75f; 364 bool useUnionedRect = (rects.size() <= 1) || (rects.size() > rectThreshold); 365 if (!useUnionedRect) { 366 // Attempt to guess whether or not we should use the unioned rect or the individual rects. 367 // We do this by computing the percentage of "wasted space" in the union. If that wasted space 368 // is too large, then we will do individual rect painting instead. 369 float unionPixels = (clipRect.width() * clipRect.height()); 370 float singlePixels = 0; 371 for (size_t i = 0; i < rects.size(); ++i) 372 singlePixels += rects[i].width() * rects[i].height(); 373 float wastedSpace = 1 - (singlePixels / unionPixels); 374 if (wastedSpace <= wastedSpaceThreshold) 375 useUnionedRect = true; 376 } 377 378 if (!useUnionedRect) 379 return; 380 381 rects.clear(); 382 rects.append(clipRect); 383 } 384 359 385 void QWebFramePrivate::renderRelativeCoords(GraphicsContext* context, QFlags<QWebFrame::RenderLayer> layers, const QRegion& clip) 360 386 { … … 372 398 373 399 if (layers & QWebFrame::ContentsLayer) { 400 QRect clipBoundingRect = clip.boundingRect(); 401 coalesceRectsIfPossible(clipBoundingRect, vector); 374 402 for (int i = 0; i < vector.size(); ++i) { 375 403 const QRect& clipRect = vector.at(i); … … 397 425 } 398 426 #if USE(ACCELERATED_COMPOSITING) 399 renderCompositedLayers(context, IntRect(clip .boundingRect()));427 renderCompositedLayers(context, IntRect(clipBoundingRect)); 400 428 #endif 401 429 } -
trunk/Source/WebKit/qt/ChangeLog
r122333 r122507 1 2012-07-12 Huang Dongsung <luxtella@company100.net> 2 3 [Qt] Increase the drawing performance by merging dirty rects. 4 https://bugs.webkit.org/show_bug.cgi?id=91075 5 6 Reviewed by Noam Rosenthal. 7 8 QWebFramePrivate calls FrameView::paintContents as many as the number of dirty 9 rects, so it causes too many redundant render tree traversals. 10 I changed it to merge dirty rects and call FrameView::paintContents only once. 11 The algorithm to merge rects is copied from GTK. 12 13 When parallel image decoders are in use, each image is independently repainted 14 when decoding is finished. This creates a lot by repaint requests. So by merging 15 these repaint requests, I could improve rendering performance. 16 17 For example, I tested parallel image decoders on the locally mirrored Pinterest site. 18 QWebFramePrivate called FrameView::paintContents 165 times after parallel image 19 decoders decoded all the images. It took about 120ms on my six-core Intel Xeon machine. 20 This patch decreases painting time from 120ms to 30ms. 21 22 * Api/qwebframe.cpp: 23 (coalesceRectsIfPossible): 24 (QWebFramePrivate::renderRelativeCoords): 25 1 26 2012-07-11 Steffen Imhof <steffen.imhof@basyskom.com> 2 27
Note: See TracChangeset
for help on using the changeset viewer.