Bug 155747

Summary: Use Region instead of IntRect in PageClient and WebPageProxy setViewNeedsDisplay method
Product: WebKit Reporter: Carlos Garcia Campos <cgarcia>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, bugs-noreply, darin
Priority: P2 Keywords: Gtk
Version: WebKit Local Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
darin: review+
Patch for landing none

Carlos Garcia Campos
Reported 2016-03-22 06:38:59 PDT
This way instead of calling setViewNeedsDisplay() for every rectangle in the damage area, we can build a region and call setViewNeedsDisplay() once. GTK+ has API to queue a redraw for a given region, so we also avoid scheduling multiple redraws in GTK+ port.
Attachments
Patch (11.21 KB, patch)
2016-03-22 06:42 PDT, Carlos Garcia Campos
darin: review+
Patch for landing (13.57 KB, patch)
2016-03-23 01:23 PDT, Carlos Garcia Campos
no flags
Carlos Garcia Campos
Comment 1 2016-03-22 06:42:51 PDT
Darin Adler
Comment 2 2016-03-22 09:34:56 PDT
Comment on attachment 274648 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=274648&action=review > Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp:73 > + RefPtr<cairo_region_t> damageRegion = adoptRef(cairo_region_create()); > + auto rects = region.rects(); > + for (const auto& rect : rects) { > + cairo_rectangle_int_t damageRect = rect; > + cairo_region_union_rectangle(damageRegion.get(), &damageRect); > + } This is “make a cairo_region_t out of a WebCore::Region” and it should do that as efficiently as possible. I think that belongs as a separate function, not nested inside PageClientImpl::setViewNeedsDisplay. > Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp:237 > + damageRegion.unite(IntRect(IntPoint(), m_webPageProxy.viewSize())); Should use the constructor here instead of unite. > Source/WebKit2/UIProcess/efl/WebView.cpp:416 > + auto rects = region.rects(); > + for (const auto& rect : rects) > + m_client.viewNeedsDisplay(this, rect); No reason for the local variable. for (auto& rect : region.rects())
Carlos Garcia Campos
Comment 3 2016-03-23 01:23:10 PDT
Created attachment 274740 [details] Patch for landing
Carlos Garcia Campos
Comment 4 2016-03-23 01:52:12 PDT
Darin Adler
Comment 5 2016-03-23 08:21:54 PDT
Comment on attachment 274740 [details] Patch for landing View in context: https://bugs.webkit.org/attachment.cgi?id=274740&action=review > Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp:70 > + RefPtr<cairo_region_t> damageRegion = toCairoRegion(region); > + gtk_widget_queue_draw_region(m_viewWidget, damageRegion.get()); If you ever care to return here you could make this a 1-liner: gtk_widget_queue_draw_region(m_viewWidget, toCairoRegion(region).get()); That’s part of the magic of smart pointers!
Carlos Garcia Campos
Comment 6 2016-03-29 00:27:35 PDT
(In reply to comment #5) > Comment on attachment 274740 [details] > Patch for landing > > View in context: > https://bugs.webkit.org/attachment.cgi?id=274740&action=review > > > Source/WebKit2/UIProcess/API/gtk/PageClientImpl.cpp:70 > > + RefPtr<cairo_region_t> damageRegion = toCairoRegion(region); > > + gtk_widget_queue_draw_region(m_viewWidget, damageRegion.get()); > > If you ever care to return here you could make this a 1-liner: > > gtk_widget_queue_draw_region(m_viewWidget, toCairoRegion(region).get()); > > That’s part of the magic of smart pointers! Sure, done in r198775
Note You need to log in before you can comment on or make changes to this bug.