Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(561)

Unified Diff: Source/web/WebViewImpl.cpp

Issue 264713014: Remove the composited path from WebViewImpl::paint(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: paint-compositor: rebase Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)
« no previous file with comments | « Source/web/WebViewImpl.h ('k') | Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698