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

Unified Diff: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp

Issue 2171513003: Re-enable canvas optimization for getImageData with new codepath (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix tests Created 4 years, 5 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
Index: third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
index 89fb58fe9d6a34206159b85bcc41bddd35160804..e698232f55096f5d20ba90ca0f4b084e7694f62d 100644
--- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
+++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
@@ -461,37 +461,10 @@ void Canvas2DLayerBridge::reportSurfaceCreationFailure()
}
}
-void Canvas2DLayerBridge::disableAcceleration()
-{
- DCHECK(isAccelerated());
- bool surfaceIsAccelerated;
- RefPtr<SkSurface> newSurface = createSkSurface(nullptr, m_size, m_msaaSampleCount, m_opacityMode, &surfaceIsAccelerated);
- if (newSurface) {
- DCHECK(!surfaceIsAccelerated);
- flush();
- SkPaint copyPaint;
- copyPaint.setXfermodeMode(SkXfermode::kSrc_Mode);
- m_surface->draw(newSurface->getCanvas(), 0, 0, &copyPaint); // GPU readback here
- m_accelerationMode = DisableAcceleration; // Acceleration gets permanently disabled
- GraphicsLayer::unregisterContentsLayer(m_layer->layer());
- m_layer->clearTexture();
- m_layer->layer()->removeFromParent();
- m_surface = newSurface;
- if (m_imageBuffer)
- m_imageBuffer->didDisableAcceleration();
- }
-}
-
SkSurface* Canvas2DLayerBridge::getOrCreateSurface(AccelerationHint hint)
{
- if (m_surface) {
- // Note: in layout tests, canvas2dFixedRenderingMode is set to true to inhibit
- // mode switching so that we continue to get test coverage for GPU acceleration
- // despite the use of getImageData in tests
- if (hint == ForceNoAcceleration && isAccelerated() && !RuntimeEnabledFeatures::canvas2dFixedRenderingModeEnabled())
- disableAcceleration();
+ if (m_surface)
return m_surface.get();
- }
if (m_layer && !isHibernating() && hint == PreferAcceleration && m_accelerationMode != DisableAcceleration) {
return nullptr; // re-creation will happen through restore()

Powered by Google App Engine
This is Rietveld 408576698