diff options
author | leandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-15 21:45:52 +0000 |
---|---|---|
committer | leandrogracia@chromium.org <leandrogracia@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-12-15 21:45:52 +0000 |
commit | f35e232a94af088f5a1a231f2489a5b06460bffe (patch) | |
tree | 124388157fbe8e64db6181a9b5467a3ca3fc8be0 /cc/test/render_pass_test_utils.cc | |
parent | 3ff3a45baf225760a1ceab36868e333010f555ee (diff) | |
download | chromium_src-f35e232a94af088f5a1a231f2489a5b06460bffe.zip chromium_src-f35e232a94af088f5a1a231f2489a5b06460bffe.tar.gz chromium_src-f35e232a94af088f5a1a231f2489a5b06460bffe.tar.bz2 |
[Android WebView] Tie together Chrome's browser compositor with the Android View system.
This patch introduces a new feature to the compositor:
- A setting to enable cleaning the framebuffer, disabled by default. This prevents destroying data below us when rendering non-rectangular views (e.g. during a rotation).
A second required feature will be added by a later patch:
- A device scissor rect that intersects any scissor calculation. Used to ensure we never render outside where the Android View System tells us.
There are also some issues with the Android View side regarding the restoration of the GL state. This patch introduces a temporary workaround by reading and manually restoring the state changed by the compositor. This will go out as soon as the problem is fixed in the Android side.
BUG=161409,154180
Review URL: https://chromiumcodereview.appspot.com/11316310
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173324 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/render_pass_test_utils.cc')
-rw-r--r-- | cc/test/render_pass_test_utils.cc | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/cc/test/render_pass_test_utils.cc b/cc/test/render_pass_test_utils.cc new file mode 100644 index 0000000..579bc1e --- /dev/null +++ b/cc/test/render_pass_test_utils.cc @@ -0,0 +1,61 @@ +// Copyright 2012 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/render_pass_test_utils.h" + +#include "cc/append_quads_data.h" +#include "cc/quad_sink.h" +#include "cc/render_pass_draw_quad.h" +#include "cc/shared_quad_state.h" +#include "cc/solid_color_draw_quad.h" +#include "cc/test/mock_quad_culler.h" +#include "cc/test/render_pass_test_common.h" +#include "ui/gfx/rect.h" + +using WebKitTests::TestRenderPass; + +namespace cc { + +TestRenderPass* addRenderPass(ScopedPtrVector<RenderPass>& passList, + RenderPass::Id id, + const gfx::Rect& outputRect, + const gfx::Transform& rootTransform) { + scoped_ptr<TestRenderPass> pass(TestRenderPass::Create()); + pass->SetNew(id, outputRect, outputRect, rootTransform); + TestRenderPass* saved = pass.get(); + passList.append(pass.PassAs<RenderPass>()); + return saved; +} + +SolidColorDrawQuad* addQuad(TestRenderPass* pass, + const gfx::Rect& rect, + SkColor color) { + MockQuadCuller quadSink(pass->quad_list, pass->shared_quad_state_list); + AppendQuadsData data(pass->id); + SharedQuadState* sharedState = + quadSink.useSharedQuadState(SharedQuadState::Create()); + sharedState->SetAll(gfx::Transform(), rect, rect, rect, false, 1); + scoped_ptr<SolidColorDrawQuad> quad = SolidColorDrawQuad::Create(); + quad->SetNew(sharedState, rect, color); + SolidColorDrawQuad* quadPtr = quad.get(); + quadSink.append(quad.PassAs<DrawQuad>(), data); + return quadPtr; +} + +void addRenderPassQuad(TestRenderPass* toPass, + TestRenderPass* contributingPass) { + MockQuadCuller quadSink(toPass->quad_list, toPass->shared_quad_state_list); + AppendQuadsData data(toPass->id); + gfx::Rect outputRect = contributingPass->output_rect; + SharedQuadState* sharedState = + quadSink.useSharedQuadState(SharedQuadState::Create()); + sharedState->SetAll(gfx::Transform(), outputRect, outputRect, outputRect, + false, 1); + scoped_ptr<RenderPassDrawQuad> quad = RenderPassDrawQuad::Create(); + quad->SetNew(sharedState, outputRect, contributingPass->id, false, 0, + outputRect, gfx::RectF()); + quadSink.append(quad.PassAs<DrawQuad>(), data); +} + +} // namespace cc |