diff options
author | aelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-05 00:43:28 +0000 |
---|---|---|
committer | aelias@chromium.org <aelias@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-05 00:43:28 +0000 |
commit | 54af0352fb8c3b48b0f379ea1c48006aa1c34615 (patch) | |
tree | 8c00bd00f8cde9adbfd90db018205cf2e669d666 /cc/test/pixel_test.cc | |
parent | 576748e8df1fdb8a21958671fe860946f12c82f5 (diff) | |
download | chromium_src-54af0352fb8c3b48b0f379ea1c48006aa1c34615.zip chromium_src-54af0352fb8c3b48b0f379ea1c48006aa1c34615.tar.gz chromium_src-54af0352fb8c3b48b0f379ea1c48006aa1c34615.tar.bz2 |
Fix UpdateTilePriorities viewport in Android WebView.
This patch fixes the tile management viewport to be the on-screen-visible
rect for the last hardware draw. There are two problems I needed to solve:
1) Suppress UpdateTilePriorities from happening when the last draw was a
software draw, which is specified by the new
"viewport_valid_for_tile_management" bool.
2) In some cases, the clip rect is smaller than the WebView's visible
viewport -- for example when the Android Browser progress bar is forcing
redraws, the clip is only a small area at the top of the screen. I
switched to using the visible viewport for UpdateDrawProperties +
glViewport, and introduce a separate "DeviceClip" to override glScissor.
(It's necessary to make the change at this level, rather than directly
plumbing the visible viewport to UpdateTilePriorities, because
UpdateTilePriorities also makes use of outputs from the draw properties
calculation.)
I also cleaned up all uses of device_viewport_size() to call DrawViewportSize()
instead, with the sole exception of UnscaledScrollableViewportSize() which
should continue to use the main-thread device_viewport_size_ in all cases
(because that's the viewport for scrolling, not drawing).
New tests: PictureLayerImplTest.SuppressUpdateTilePriorities,
ExternalStencilPixelTest.DeviceClip
NOTRY=true
BUG=232844
Review URL: https://chromiumcodereview.appspot.com/23171014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221321 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test/pixel_test.cc')
-rw-r--r-- | cc/test/pixel_test.cc | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc index 73c4437..8801596 100644 --- a/cc/test/pixel_test.cc +++ b/cc/test/pixel_test.cc @@ -28,12 +28,17 @@ class PixelTest::PixelTestRendererClient : public RendererClient, public OutputSurfaceClient { public: explicit PixelTestRendererClient(gfx::Rect device_viewport) - : device_viewport_(device_viewport), stencil_enabled_(false) {} + : device_viewport_(device_viewport), + device_clip_(device_viewport), + stencil_enabled_(false) {} // RendererClient implementation. virtual gfx::Rect DeviceViewport() const OVERRIDE { return device_viewport_; } + virtual gfx::Rect DeviceClip() const OVERRIDE { + return device_clip_; + } virtual float DeviceScaleFactor() const OVERRIDE { return 1.f; } @@ -64,9 +69,13 @@ class PixelTest::PixelTestRendererClient virtual void BeginFrame(const BeginFrameArgs& args) OVERRIDE {} virtual void OnSwapBuffersComplete(const CompositorFrameAck* ack) OVERRIDE {} virtual void DidLoseOutputSurface() OVERRIDE {} - virtual void SetExternalDrawConstraints(const gfx::Transform& transform, - gfx::Rect viewport) OVERRIDE { + virtual void SetExternalDrawConstraints( + const gfx::Transform& transform, + gfx::Rect viewport, + gfx::Rect clip, + bool valid_for_tile_management) OVERRIDE { device_viewport_ = viewport; + device_clip_ = clip; } virtual void SetExternalStencilTest(bool enable) OVERRIDE { stencil_enabled_ = enable; @@ -77,6 +86,7 @@ class PixelTest::PixelTestRendererClient private: gfx::Rect device_viewport_; + gfx::Rect device_clip_; bool stencil_enabled_; LayerTreeSettings settings_; }; @@ -188,6 +198,11 @@ void PixelTest::ForceExpandedViewport(gfx::Size surface_expansion, } } +void PixelTest::ForceDeviceClip(gfx::Rect clip) { + static_cast<PixelTestOutputSurface*>(output_surface_.get()) + ->set_device_clip(clip); +} + void PixelTest::EnableExternalStencilTest() { fake_client_->SetExternalStencilTest(true); } |