diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-18 18:24:24 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-18 18:24:24 +0000 |
commit | 6389458704504692b4fdf2e5869ff4dbf1b66b5c (patch) | |
tree | 25b696fd0597fe55ad7fa2a1c1554007071761c9 /cc/test/pixel_test_output_surface.cc | |
parent | cfa8f9d79c87ea20f0162af76acedc2a7e6cb5ab (diff) | |
download | chromium_src-6389458704504692b4fdf2e5869ff4dbf1b66b5c.zip chromium_src-6389458704504692b4fdf2e5869ff4dbf1b66b5c.tar.gz chromium_src-6389458704504692b4fdf2e5869ff4dbf1b66b5c.tar.bz2 |
cc: Add ability to request copy of compositor output as a texture.
This adds the ability to request the compositor's output as a texture
instead of requiring a readback to a SkBitmap on the cpu. This will
allow the embedder to make a request for a texture and then scale or
sample it without reading back the entire full-sized texture to the
cpu.
To readback successive frames will require constant commits at this time,
but the mechanism could be extended to allow one main thread request to
result in multiple copy result callbacks.
This is tested by the LayerTreeHostPixelTestReadback tests. I've added a
viewport offset, and surface expansion size, to all of the LayerTreeTest
based pixel tests. This exposed a bug in the math for background filters
when a viewport offset/surface expansion size is present, so this is
fixed as well to make the tests pass (one line in
GLRenderer::ApplyBackgroundFilters).
Instead of having the CopyOutputRequest return a SkBitmap directly, or
return a TextureMailbox directly (sometimes backed by a software bitmap),
I've added a CopyOutputResult class to return with a reply from the
compositor. This reply may be a texture (via a TextureMailbox) or a
bitmap (via an SkBitmap). The embedder should be able to handle either
one when it makes a request, unless its request forces a software-bitmap
reply.
The tests verify GLRenderer+general request, GLRenderer+forced software
request, and SoftwareRenderer+general request. Adding the offset/expansion
to the viewport/surface causes the offaxis background blur pixel test to
become off-by-one in 5 pixels, requiring a rebaseline.
R=enne, jamesr, piman
BUG=242571
Review URL: https://chromiumcodereview.appspot.com/17018002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207037 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/pixel_test_output_surface.cc')
-rw-r--r-- | cc/test/pixel_test_output_surface.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/cc/test/pixel_test_output_surface.cc b/cc/test/pixel_test_output_surface.cc new file mode 100644 index 0000000..9a4d66a --- /dev/null +++ b/cc/test/pixel_test_output_surface.cc @@ -0,0 +1,21 @@ +// Copyright 2013 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "cc/test/pixel_test_output_surface.h" + +#include "cc/output/output_surface_client.h" +#include "ui/gfx/transform.h" + +namespace cc { + +void PixelTestOutputSurface::Reshape(gfx::Size size, float scale_factor) { + gfx::Size expanded_size(size.width() + surface_expansion_size_.width(), + size.height() + surface_expansion_size_.height()); + OutputSurface::Reshape(expanded_size, scale_factor); + + gfx::Rect offset_viewport = gfx::Rect(size) + viewport_offset_; + SetExternalDrawConstraints(gfx::Transform(), offset_viewport); +} + +} // namespace cc |