Commit 80a003cc authored by Yi Xu's avatar Yi Xu Committed by Commit Bot

Canvas: always updated canvas content retainence |mode_|

In my previous cl, "Discard canvas content from frame if canvas is fully
repaint", I set the |mode_| to discard canvas content from previous
frame if there is some paint command in the current frame. These two are
not related. So I removed the dependence in this cl.

Bug: 1054666

Change-Id: Icc47a03aced6b0033cfe1b9bc5267aa514b8c456
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2088122
Commit-Queue: Yi Xu <yiyix@chromium.org>
Reviewed-by: default avatarKhushal <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747110}
parent b4f12f8d
......@@ -482,10 +482,8 @@ bool Canvas2DLayerBridge::WritePixels(const SkImageInfo& orig_info,
}
void Canvas2DLayerBridge::SkipQueuedDrawCommands() {
if (have_recorded_draw_commands_) {
ResourceProvider()->SkipQueuedDrawCommands();
have_recorded_draw_commands_ = false;
}
ResourceProvider()->SkipQueuedDrawCommands();
have_recorded_draw_commands_ = false;
if (rate_limiter_)
rate_limiter_->Reset();
......
......@@ -1278,9 +1278,12 @@ scoped_refptr<CanvasResource> CanvasResourceProvider::GetImportedResource()
}
void CanvasResourceProvider::SkipQueuedDrawCommands() {
if (!recorder_)
return;
// Note that this function only gets called when canvas needs a full repaint,
// so always update the |mode_| to discard the old copy of canvas content.
mode_ = SkSurface::kDiscard_ContentChangeMode;
if (!recorder_ || !recorder_->ListHasDrawOps())
return;
recorder_->finishRecordingAsPicture();
cc::PaintCanvas* canvas =
recorder_->beginRecording(Size().Width(), Size().Height());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment