Commit a981f0b5 authored by Khushal's avatar Khushal Committed by Commit Bot

blink/canvas: Use front buffer textures for swap chain snapshots.

Use front buffer textures directly for snapshots with swap chain
resources instead of a copy via skia.

R=sunnyps@chromium.org

Bug: 962630
Change-Id: I88f6e5b098b060325cff06cd3a140d85146f60b4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1949663
Auto-Submit: Khushal <khushalsagar@chromium.org>
Reviewed-by: default avatarSunny Sachanandani <sunnyps@chromium.org>
Commit-Queue: Khushal <khushalsagar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#721372}
parent e104cf24
......@@ -553,7 +553,12 @@ class CanvasResourceProviderSwapChain final : public CanvasResourceProvider {
scoped_refptr<StaticBitmapImage> Snapshot() override {
TRACE_EVENT0("blink", "CanvasResourceProviderSwapChain::Snapshot");
return SnapshotInternal();
// Use ProduceCanvasResource to ensure any queued commands are flushed and
// the resource is updated.
if (auto resource = ProduceCanvasResource())
return resource->Bitmap();
return nullptr;
}
sk_sp<SkSurface> CreateSkSurface() const override {
......@@ -1048,10 +1053,7 @@ scoped_refptr<StaticBitmapImage> CanvasResourceProvider::SnapshotInternal() {
return nullptr;
auto paint_image = MakeImageSnapshot();
if (paint_image.GetSkImage()->isTextureBacked() && ContextProviderWrapper()) {
return AcceleratedStaticBitmapImage::CreateFromSkImage(
paint_image.GetSkImage(), ContextProviderWrapper());
}
DCHECK(!paint_image.GetSkImage()->isTextureBacked());
return UnacceleratedStaticBitmapImage::Create(std::move(paint_image));
}
......
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