-
dongseong.hwang authored
Currently, when we draws GPU decoded Video on accelerated 2D Canvas, chromium reads back pixel from GPU and then uploads the pixel to GPU to make a SkBitmap. It's so inefficient for both speed and battery. On the other hand, only Android copies GPU-GPU in this case, but Android doesn't have cache mechanism which SkCanvasVideoRenderer provides. This CL makes all platforms copy gpu-gpu with cache mechanism. Cache mechanism is useful when 2d canvas draws a video frame many times. e.g. http://craftymind.com/factory/html5video/CanvasVideo.html In addition, fix white video background on Android when not loaded. Other platforms draw black background thanks to SkCanvasVideoRenderer::Paint(). In detail of the changes; 1. Implement gpu-gpu copy in SkCanvasVideoRenderer::Paint() like previous WebMediaPlayerAndroid::paint(). 2. Move duplicated GPU code on WebMediaPlayerImpl and WebMediaPlayerAndroid to SkCanvasVideoRenderer. Perf data on i5 IvyBridge blink_perf.all:Canvas_draw-video-to-hw-accelerated-canvas-2d 15.8x speed up: 116.27 runs/s -> 1847.23 runs/s NOTE: measure after disabling cache in SkCanvasVideoRenderer BUG=401058, 263667 Review URL: https://codereview.chromium.org/445013002 Cr-Commit-Position: refs/heads/master@{#310577}
0c4e9d87