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

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

Issue 2391373002: Refactor CRC2D::reset() to avoid non-additive SkCanvas state operations (Closed)
Patch Set: review Created 4 years, 2 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/RecordingImageBufferSurface.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp
index 5eb8280c4d9a60216c2247965b497d19f33d500d..27d115b6f7ae213503d48f3faa92727c7bd0a47e 100644
--- a/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp
+++ b/third_party/WebKit/Source/platform/graphics/RecordingImageBufferSurface.cpp
@@ -39,10 +39,14 @@ RecordingImageBufferSurface::~RecordingImageBufferSurface() {}
void RecordingImageBufferSurface::initializeCurrentFrame() {
static SkRTreeFactory rTreeFactory;
m_currentFrame = wrapUnique(new SkPictureRecorder);
- m_currentFrame->beginRecording(size().width(), size().height(),
- &rTreeFactory);
+ SkCanvas* canvas = m_currentFrame->beginRecording(
+ size().width(), size().height(), &rTreeFactory);
+ // Always save an initial frame, to support resetting the top level matrix
+ // and clip.
+ canvas->save();
+
if (m_imageBuffer) {
- m_imageBuffer->resetCanvas(m_currentFrame->getRecordingCanvas());
+ m_imageBuffer->resetCanvas(canvas);
}
m_didRecordDrawCommandsInCurrentFrame = false;
m_currentFrameHasExpensiveOp = false;
@@ -296,8 +300,10 @@ bool RecordingImageBufferSurface::finalizeFrameInternal(
}
if (m_fallbackFactory &&
- m_currentFrame->getRecordingCanvas()->getSaveCount() >
+ m_currentFrame->getRecordingCanvas()->getSaveCount() - 1 >
ExpensiveCanvasHeuristicParameters::ExpensiveRecordingStackDepth) {
+ // (getSaveCount() decremented to account for the intial recording canvas
+ // save frame.)
*fallbackReason = FallbackReasonRunawayStateStack;
return false;
}

Powered by Google App Engine
This is Rietveld 408576698