| 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 7b137e74b09249b174512d4deba11b9ea0ccef8b..e2fb6df93a917264297cce6c1b1204cf811f47b3 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/Canvas2DLayerBridge.cpp
|
| @@ -464,50 +464,22 @@
|
| }
|
| }
|
|
|
| -void Canvas2DLayerBridge::disableAcceleration()
|
| -{
|
| - DCHECK(m_layer);
|
| - 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, ©Paint); // GPU readback here
|
| - m_accelerationMode = DisableAcceleration; // Acceleration gets permanently disabled
|
| - GraphicsLayer::unregisterContentsLayer(m_layer->layer());
|
| - m_layer->clearTexture();
|
| - m_layer->layer()->removeFromParent();
|
| - m_layer.reset();
|
| - 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 && m_layer && !RuntimeEnabledFeatures::canvas2dFixedRenderingModeEnabled())
|
| - disableAcceleration();
|
| + if (m_surface)
|
| return m_surface.get();
|
| - }
|
|
|
| if (m_layer && !isHibernating() && hint == PreferAcceleration) {
|
| return nullptr; // re-creation will happen through restore()
|
| }
|
|
|
| bool wantAcceleration = shouldAccelerate(hint);
|
| + bool surfaceIsAccelerated;
|
| if (CANVAS2D_BACKGROUND_RENDER_SWITCH_TO_CPU && isHidden() && wantAcceleration) {
|
| wantAcceleration = false;
|
| m_softwareRenderingWhileHidden = true;
|
| }
|
|
|
| - bool surfaceIsAccelerated;
|
| m_surface = createSkSurface(wantAcceleration ? m_contextProvider->grContext() : nullptr, m_size, m_msaaSampleCount, m_opacityMode, &surfaceIsAccelerated);
|
|
|
| if (!m_surface)
|
|
|