Index: Source/web/WebViewImpl.cpp |
diff --git a/Source/web/WebViewImpl.cpp b/Source/web/WebViewImpl.cpp |
index 90bff6f0536702e25d0670449c62686e45dc75f6..305c8abd2db597945ae42fe33508778f602ca839 100644 |
--- a/Source/web/WebViewImpl.cpp |
+++ b/Source/web/WebViewImpl.cpp |
@@ -1746,63 +1746,18 @@ void WebViewImpl::enterForceCompositingMode(bool enter) |
} |
} |
-void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect) |
+void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect) |
{ |
- ASSERT(m_layerTreeView); |
- |
- SkBitmap target; |
- target.setConfig(SkImageInfo::MakeN32Premul(rect.width(), rect.height()), rect.width() * 4); |
- if (!target.allocPixels()) |
- return; |
- m_layerTreeView->compositeAndReadback(target.getPixels(), rect); |
-#if (!SK_R32_SHIFT && SK_B32_SHIFT == 16) |
- // The compositor readback always gives back pixels in BGRA order, but for |
- // example Android's Skia uses RGBA ordering so the red and blue channels |
- // need to be swapped. |
- uint8_t* pixels = reinterpret_cast<uint8_t*>(target.getPixels()); |
- for (size_t i = 0; i < target.getSize(); i += 4) |
- std::swap(pixels[i], pixels[i + 2]); |
-#endif |
- canvas->writePixels(target, rect.x(), rect.y()); |
-} |
- |
-void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect, PaintOptions option) |
-{ |
-#if !OS(ANDROID) |
- // ReadbackFromCompositorIfAvailable is the only option available on non-Android. |
- // Ideally, Android would always use ReadbackFromCompositorIfAvailable as well. |
- ASSERT(option == ReadbackFromCompositorIfAvailable); |
-#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); |
- } |
- |
- 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); |
+ // 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()); |
- if (isAcceleratedCompositingActive()) { |
- ASSERT(option == ForceSoftwareRenderingAndIgnoreGPUResidentContent); |
- view->setPaintBehavior(oldPaintBehavior); |
- } |
- } |
+ 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); |
} |
#if OS(ANDROID) |