GLRendererCopier: Replace use of GLHelper with GLScaler/GLI420Converter.

Switches-over GLRendererCopier to use the new GLScaler and
GLI420Converter when scaling and/or format-converting images for
CopyOutputRequests. This change also addresses:

1. Simpler handling of cached GL resources (used across copy requests
having the same requester). Rather than separate methods for each of the
possible cached resources (with some duplicated logic), there is now one
"ReusableThings" struct to hold them all (and is passed around on the

2. Simplified the I420 code around handling of "packed textures" and
"aligned rects".

3. Simplified the detection/execution of whether to byte-swizzle on the
CPU (after readback) or GPU (before readback). Simplified the RGBA
bitmap copy-from-pixel-buffer code (w.r.t. upside-down row-by-row copy
and byte-swizzling).

Testing: Confirmed existing unit and pixel tests are thoroughly-testing
all possible code paths in GLRendererCopier. Manually confirmed tab and
desktop capture (incl. CrOS), and screenshots work.

Performance improvement: A local run of performance_browser_tests, on a
machine with a high-end nVidia GPU, has shown a ~20% improvement in
capture latency (i.e., the interval of time from when copy request was
issued until an SkBitmap result is ready in system memory). will reveal how other platform
configurations are affected.

Bug: 870036,810131,781986,758057
Binary-Size: Increase is temporary (linking in new impl, future CLs will switch-over other clients to stop using old impl).
Change-Id: Ibcb16c1382ea0cffb00bc7605e0594b1fe28356a
Commit-Queue: Yuri Wiitala <>
Reviewed-by: Ken Buchanan <>
Reviewed-by: Ria Jiang <>
Cr-Commit-Position: refs/heads/master@{#611027}
12 files changed