Index: Source/web/WebViewImpl.cpp |
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp |
index c7bd60281f12277fc42607777511075a526ae111..5c3795682cc68a9f64fae56ea60158453c45a04e 100644 |
--- a/Source/web/WebViewImpl.cpp |
+++ b/Source/web/WebViewImpl.cpp |
@@ -1767,43 +1767,38 @@ void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect |
canvas->writePixels(target, rect.x(), rect.y()); |
} |
-void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect, PaintOptions option) |
+void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) |
enne (OOO)
2014/05/02 23:16:23
I do think this needs to be split into two functio
|
{ |
+ // Note: This method can be called on a composited WebView on OS(ANDROID) |
+ // but this will hopefully be changed once the link disambiguation feature |
+ // renders using the compositor. |
#if !OS(ANDROID) |
- // ReadbackFromCompositorIfAvailable is the only option available on non-Android. |
- // Ideally, Android would always use ReadbackFromCompositorIfAvailable as well. |
- ASSERT(option == ReadbackFromCompositorIfAvailable); |
+ // This should only be used when compositing is not being used for this |
+ // WebView, and it is painting into the recording of its parent. |
+ ASSERT(!isAcceleratedCompositingActive()); |
#endif |
- if (option == ReadbackFromCompositorIfAvailable && isAcceleratedCompositingActive()) { |
- // If a canvas was passed in, we use it to grab a copy of the |
- // freshly-rendered pixels. |
- if (canvas) { |
- // Clip rect to the confines of the rootLayerTexture. |
- IntRect resizeRect(rect); |
- resizeRect.intersect(IntRect(IntPoint(0, 0), m_layerTreeView->deviceViewportSize())); |
- doPixelReadbackToCanvas(canvas, resizeRect); |
- } |
- } else { |
- FrameView* view = page()->mainFrame()->view(); |
- PaintBehavior oldPaintBehavior = view->paintBehavior(); |
- if (isAcceleratedCompositingActive()) { |
- ASSERT(option == ForceSoftwareRenderingAndIgnoreGPUResidentContent); |
- view->setPaintBehavior(oldPaintBehavior | PaintBehaviorFlattenCompositingLayers); |
- } |
+ FrameView* view = page()->mainFrame()->view(); |
+ PaintBehavior oldPaintBehavior = view->paintBehavior(); |
- double paintStart = currentTime(); |
- PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect, isTransparent() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque); |
- double paintEnd = currentTime(); |
- double pixelsPerSec = (rect.width * rect.height) / (paintEnd - paintStart); |
- blink::Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30); |
- blink::Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30); |
+ double paintStart = currentTime(); |
- if (isAcceleratedCompositingActive()) { |
- ASSERT(option == ForceSoftwareRenderingAndIgnoreGPUResidentContent); |
- view->setPaintBehavior(oldPaintBehavior); |
- } |
- } |
+#if OS(ANDROID) |
danakj
2014/05/02 23:12:53
This OS(ANDROID) stuff is a disaster.
abarth: WDY
|
+ if (isAcceleratedCompositingActive()) |
+ view->setPaintBehavior(oldPaintBehavior | PaintBehaviorFlattenCompositingLayers); |
+#endif |
+ |
+ PageWidgetDelegate::paint(m_page.get(), pageOverlays(), canvas, rect, isTransparent() ? PageWidgetDelegate::Translucent : PageWidgetDelegate::Opaque); |
+ |
+#if OS(ANDROID) |
+ if (isAcceleratedCompositingActive()) |
+ view->setPaintBehavior(oldPaintBehavior); |
+#endif |
+ |
+ double paintEnd = currentTime(); |
+ double pixelsPerSec = (rect.width * rect.height) / (paintEnd - paintStart); |
+ blink::Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintDurationMS", (paintEnd - paintStart) * 1000, 0, 120, 30); |
+ blink::Platform::current()->histogramCustomCounts("Renderer4.SoftwarePaintMegapixPerSecond", pixelsPerSec / 1000000, 10, 210, 30); |
} |
bool WebViewImpl::compositeAndReadbackAsync(WebCompositeAndReadbackAsyncCallback* callback) |