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

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

Issue 2362363002: Cancel GPU acceleration for 2D canvas when drawing very large images (Closed)
Patch Set: fix sqrt Created 4 years, 3 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 | « third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
index 12bf550b0b8955d9c52f67d9bd775e0a8b2ee46f..031e0e5165b1767de0a9352c1026ec5a435387aa 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
@@ -438,16 +438,18 @@ void ImageBuffer::disableAcceleration()
if (!isAccelerated())
return;
- // Get current frame.
- SkImage* image = m_surface->newImageSnapshot(PreferNoAcceleration, SnapshotReasonPaint).get();
+ sk_sp<SkImage> image = m_surface->newImageSnapshot(PreferNoAcceleration, SnapshotReasonPaint);
+ // Using a GPU-backed image with RecordingImageBufferSurface
+ // will fail at playback time.
+ image = image->makeNonTextureImage();
// Create and configure a recording (unaccelerated) surface.
std::unique_ptr<RecordingImageBufferFallbackSurfaceFactory> surfaceFactory = wrapUnique(new UnacceleratedSurfaceFactory());
std::unique_ptr<ImageBufferSurface> surface = wrapUnique(new RecordingImageBufferSurface(m_surface->size(), std::move(surfaceFactory), m_surface->getOpacityMode(), m_surface->colorSpace()));
- surface->canvas()->drawImage(image, 0, 0);
+ surface->canvas()->drawImage(image.get(), 0, 0);
surface->setImageBuffer(this);
-
- // Replace the current surface with the new surface.
+ if (m_client)
+ m_client->restoreCanvasMatrixClipStack(surface->canvas());
m_surface = std::move(surface);
didDisableAcceleration();
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/ExpensiveCanvasHeuristicParameters.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698