From 760051854e03ab0d6fae3330363c2ecc96e25dc4 Mon Sep 17 00:00:00 2001 From: John Reck Date: Wed, 9 Jun 2021 22:43:05 -0400 Subject: Improve picture capture debug path * Fixes hardware bitmap capture * Fixes mutable bitmap capture (no flickering) * Adds basic single-frame LRU cache to avoid repeated readbacks of GPU resources * Does up-front readback of GPU resources * Moves serialization off RenderThread again thanks to up-front readback avoiding needing GPU access off-thread * Reduces RAM usage & improves performance by serializing directly to output stream instead of first copying to a byte[] Bug: 174223722 Test: PictureCaptureDemo mirrors the content Change-Id: If7ec208b61d5b917e82087cc312880fc5a38c943 --- libs/hwui/Readback.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'libs/hwui/Readback.cpp') diff --git a/libs/hwui/Readback.cpp b/libs/hwui/Readback.cpp index 8a8b4181bd94..d8735ce57b65 100644 --- a/libs/hwui/Readback.cpp +++ b/libs/hwui/Readback.cpp @@ -275,6 +275,14 @@ CopyResult Readback::copyLayerInto(DeferredLayerUpdater* deferredLayer, SkBitmap return copyResult; } +CopyResult Readback::copyImageInto(const sk_sp& image, SkBitmap* bitmap) { + Rect srcRect; + Matrix4 transform; + transform.loadScale(1, -1, 1); + transform.translate(0, -1); + return copyImageInto(image, transform, srcRect, bitmap); +} + CopyResult Readback::copyImageInto(const sk_sp& image, Matrix4& texTransform, const Rect& srcRect, SkBitmap* bitmap) { ATRACE_CALL(); -- cgit v1.2.3-59-g8ed1b