summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-06 01:48:29 +0000
committerdanakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-06 01:48:29 +0000
commit650b3faff7b94dc651751d6f928d90d879059f54 (patch)
tree1ede2fa9feadd3959b56c445e5178e55b83c82b5
parent2285e5544fb729014dcc37f8c9f870cc1a88ddf9 (diff)
downloadchromium_src-650b3faff7b94dc651751d6f928d90d879059f54.zip
chromium_src-650b3faff7b94dc651751d6f928d90d879059f54.tar.gz
chromium_src-650b3faff7b94dc651751d6f928d90d879059f54.tar.bz2
cc: Deblur layers that animate-scale-down on creation.
Layers that appear at a scale 1.5 with a transform animation that would take them to 1.0 end up drawing with the 1.5 tiling still when they complete their animation. This happens for two reasons: 1. It uses stale data in ManageTilings to tell if the layer is animating. 2. The active tree says it has ideal tilings when it has tilings >= ideal. We fix 1 by setting the animating draw properties flag before computing contents scales in calcDrawProperties. We fix 2 by not telling the scheduler that we drew with all ideal tilings if we did not. While fixing 2 we get rid of the tree walk in swapBuffers, by tracking if any incomplete tiles were used in the AppendQuadsData instead. BUG=173806 NOTRY=true Review URL: https://codereview.chromium.org/12188002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180851 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--cc/append_quads_data.h4
-rw-r--r--cc/contents_scaling_layer.cc1
-rw-r--r--cc/contents_scaling_layer.h1
-rw-r--r--cc/contents_scaling_layer_unittest.cc1
-rw-r--r--cc/image_layer.cc1
-rw-r--r--cc/image_layer.h1
-rw-r--r--cc/layer.cc1
-rw-r--r--cc/layer.h1
-rw-r--r--cc/layer_impl.cc1
-rw-r--r--cc/layer_impl.h1
-rw-r--r--cc/layer_tree_host_common.cc9
-rw-r--r--cc/layer_tree_host_common_unittest.cc5
-rw-r--r--cc/layer_tree_host_impl.cc14
-rw-r--r--cc/layer_tree_host_impl.h2
-rw-r--r--cc/layer_tree_host_impl_unittest.cc3
-rw-r--r--cc/layer_tree_host_unittest.cc3
-rw-r--r--cc/picture_layer_impl.cc46
-rw-r--r--cc/picture_layer_impl.h3
-rw-r--r--cc/picture_layer_impl_unittest.cc34
-rw-r--r--cc/scrollbar_layer.cc2
-rw-r--r--cc/scrollbar_layer.h1
-rw-r--r--cc/single_thread_proxy.cc6
-rw-r--r--cc/single_thread_proxy.h1
-rw-r--r--cc/test/fake_layer_tree_host_impl_client.h1
-rw-r--r--cc/test/tiled_layer_test_common.cc2
-rw-r--r--cc/test/tiled_layer_test_common.h1
-rw-r--r--cc/thread_proxy.cc6
-rw-r--r--cc/thread_proxy.h2
28 files changed, 89 insertions, 65 deletions
diff --git a/cc/append_quads_data.h b/cc/append_quads_data.h
index 43f9a72..a988eee 100644
--- a/cc/append_quads_data.h
+++ b/cc/append_quads_data.h
@@ -13,6 +13,7 @@ namespace cc {
struct AppendQuadsData {
AppendQuadsData()
: hadOcclusionFromOutsideTargetSurface(false)
+ , hadIncompleteTile(false)
, numMissingTiles(0)
, renderPassId(0, 0)
{
@@ -20,6 +21,7 @@ struct AppendQuadsData {
explicit AppendQuadsData(RenderPass::Id renderPassId)
: hadOcclusionFromOutsideTargetSurface(false)
+ , hadIncompleteTile(false)
, numMissingTiles(0)
, renderPassId(renderPassId)
{
@@ -28,6 +30,8 @@ struct AppendQuadsData {
// Set by the QuadCuller.
bool hadOcclusionFromOutsideTargetSurface;
// Set by the layer appending quads.
+ bool hadIncompleteTile;
+ // Set by the layer appending quads.
int64 numMissingTiles;
// Given to the layer appending quads.
const RenderPass::Id renderPassId;
diff --git a/cc/contents_scaling_layer.cc b/cc/contents_scaling_layer.cc
index 5d3502b..b53755f44 100644
--- a/cc/contents_scaling_layer.cc
+++ b/cc/contents_scaling_layer.cc
@@ -22,6 +22,7 @@ ContentsScalingLayer::~ContentsScalingLayer() {
void ContentsScalingLayer::calculateContentsScale(
float ideal_contents_scale,
+ bool animating_transform_to_screen,
float* contents_scale_x,
float* contents_scale_y,
gfx::Size* content_bounds) {
diff --git a/cc/contents_scaling_layer.h b/cc/contents_scaling_layer.h
index fa5357e..a338002 100644
--- a/cc/contents_scaling_layer.h
+++ b/cc/contents_scaling_layer.h
@@ -16,6 +16,7 @@ class CC_EXPORT ContentsScalingLayer : public Layer {
public:
virtual void calculateContentsScale(
float ideal_contents_scale,
+ bool animating_transform_to_screen,
float* contents_scale_x,
float* contents_scale_y,
gfx::Size* content_bounds) OVERRIDE;
diff --git a/cc/contents_scaling_layer_unittest.cc b/cc/contents_scaling_layer_unittest.cc
index 5d17e9c..38ba4d7 100644
--- a/cc/contents_scaling_layer_unittest.cc
+++ b/cc/contents_scaling_layer_unittest.cc
@@ -33,6 +33,7 @@ class MockContentsScalingLayer : public ContentsScalingLayer {
// Simulate calcDrawProperties.
calculateContentsScale(
contentsScale,
+ false, // animating_transform_to_screen
&drawProperties().contents_scale_x,
&drawProperties().contents_scale_y,
&drawProperties().content_bounds);
diff --git a/cc/image_layer.cc b/cc/image_layer.cc
index 9b95968..06f10ac 100644
--- a/cc/image_layer.cc
+++ b/cc/image_layer.cc
@@ -77,6 +77,7 @@ LayerUpdater* ImageLayer::updater() const
void ImageLayer::calculateContentsScale(
float ideal_contents_scale,
+ bool animating_transform_to_screen,
float* contentsScaleX,
float* contentsScaleY,
gfx::Size* contentBounds)
diff --git a/cc/image_layer.h b/cc/image_layer.h
index c3a4b90..7b70fcd 100644
--- a/cc/image_layer.h
+++ b/cc/image_layer.h
@@ -23,6 +23,7 @@ public:
virtual void update(ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats*) OVERRIDE;
virtual void calculateContentsScale(
float idealContentsScale,
+ bool animating_transform_to_screen,
float* contentsScaleX,
float* contentsScaleY,
gfx::Size* contentBounds) OVERRIDE;
diff --git a/cc/layer.cc b/cc/layer.cc
index 7b70155..1f22bad 100644
--- a/cc/layer.cc
+++ b/cc/layer.cc
@@ -314,6 +314,7 @@ void Layer::setBackgroundColor(SkColor backgroundColor)
void Layer::calculateContentsScale(
float idealContentsScale,
+ bool animatingTransformToScreen,
float* contentsScaleX,
float* contentsScaleY,
gfx::Size* contentBounds)
diff --git a/cc/layer.h b/cc/layer.h
index 80e9b6e..d31fe84 100644
--- a/cc/layer.h
+++ b/cc/layer.h
@@ -228,6 +228,7 @@ public:
gfx::Size contentBounds() const { return m_drawProperties.content_bounds; }
virtual void calculateContentsScale(
float idealContentsScale,
+ bool animatingTransformToScreen,
float* contentsScaleX,
float* contentsScaleY,
gfx::Size* contentBounds);
diff --git a/cc/layer_impl.cc b/cc/layer_impl.cc
index 2788c725..dcf531f 100644
--- a/cc/layer_impl.cc
+++ b/cc/layer_impl.cc
@@ -805,6 +805,7 @@ void LayerImpl::setContentsScale(float contentsScaleX, float contentsScaleY)
void LayerImpl::calculateContentsScale(
float idealContentsScale,
+ bool animatingTransformToScreen,
float* contentsScaleX,
float* contentsScaleY,
gfx::Size* contentBounds)
diff --git a/cc/layer_impl.h b/cc/layer_impl.h
index d711627..5e0e32d 100644
--- a/cc/layer_impl.h
+++ b/cc/layer_impl.h
@@ -212,6 +212,7 @@ public:
virtual void calculateContentsScale(
float idealContentsScale,
+ bool animatingTransformToScreen,
float* contentsScaleX,
float* contentsScaleY,
gfx::Size* contentBounds);
diff --git a/cc/layer_tree_host_common.cc b/cc/layer_tree_host_common.cc
index bffc7db..fd01a49 100644
--- a/cc/layer_tree_host_common.cc
+++ b/cc/layer_tree_host_common.cc
@@ -405,10 +405,11 @@ gfx::Transform computeScrollCompensationMatrixForChildren(LayerImpl* layer, cons
}
template<typename LayerType>
-static inline void calculateContentsScale(LayerType* layer, float contentsScale)
+static inline void calculateContentsScale(LayerType* layer, float contentsScale, bool animatingTransformToScreen)
{
layer->calculateContentsScale(
contentsScale,
+ animatingTransformToScreen,
&layer->drawProperties().contents_scale_x,
&layer->drawProperties().contents_scale_y,
&layer->drawProperties().content_bounds);
@@ -418,6 +419,7 @@ static inline void calculateContentsScale(LayerType* layer, float contentsScale)
{
maskLayer->calculateContentsScale(
contentsScale,
+ animatingTransformToScreen,
&maskLayer->drawProperties().contents_scale_x,
&maskLayer->drawProperties().contents_scale_y,
&maskLayer->drawProperties().content_bounds);
@@ -428,6 +430,7 @@ static inline void calculateContentsScale(LayerType* layer, float contentsScale)
{
replicaMaskLayer->calculateContentsScale(
contentsScale,
+ animatingTransformToScreen,
&replicaMaskLayer->drawProperties().contents_scale_x,
&replicaMaskLayer->drawProperties().contents_scale_y,
&replicaMaskLayer->drawProperties().content_bounds);
@@ -438,7 +441,7 @@ static inline void updateLayerContentsScale(LayerImpl* layer, const gfx::Transfo
{
gfx::Vector2dF transformScale = MathUtil::computeTransform2dScaleComponents(combinedTransform, deviceScaleFactor * pageScaleFactor);
float contentsScale = std::max(transformScale.x(), transformScale.y());
- calculateContentsScale(layer, contentsScale);
+ calculateContentsScale(layer, contentsScale, animatingTransformToScreen);
}
static inline void updateLayerContentsScale(Layer* layer, const gfx::Transform& combinedTransform, float deviceScaleFactor, float pageScaleFactor, bool animatingTransformToScreen)
@@ -465,7 +468,7 @@ static inline void updateLayerContentsScale(Layer* layer, const gfx::Transform&
if (!layer->boundsContainPageScale())
contentsScale *= pageScaleFactor;
- calculateContentsScale(layer, contentsScale);
+ calculateContentsScale(layer, contentsScale, animatingTransformToScreen);
}
template<typename LayerType, typename LayerList>
diff --git a/cc/layer_tree_host_common_unittest.cc b/cc/layer_tree_host_common_unittest.cc
index 587f9e5..9666390 100644
--- a/cc/layer_tree_host_common_unittest.cc
+++ b/cc/layer_tree_host_common_unittest.cc
@@ -4092,12 +4092,15 @@ public:
virtual void calculateContentsScale(
float idealContentsScale,
+ bool animatingTransformToScreen,
float* contentsScaleX,
float* contentsScaleY,
gfx::Size* contentBounds) OVERRIDE
{
- Layer::calculateContentsScale(
+ // Skip over the ContentLayer to the base Layer class.
+ Layer::calculateContentsScale(
idealContentsScale,
+ animatingTransformToScreen,
contentsScaleX,
contentsScaleY,
contentBounds);
diff --git a/cc/layer_tree_host_impl.cc b/cc/layer_tree_host_impl.cc
index d1e9040..ec47946 100644
--- a/cc/layer_tree_host_impl.cc
+++ b/cc/layer_tree_host_impl.cc
@@ -120,6 +120,7 @@ private:
};
LayerTreeHostImpl::FrameData::FrameData()
+ : containsIncompleteTile(false)
{
}
@@ -509,6 +510,9 @@ bool LayerTreeHostImpl::calculateRenderPasses(FrameData& frame)
drawFrame = false;
}
+ if (appendQuadsData.hadIncompleteTile)
+ frame.containsIncompleteTile = true;
+
occlusionTracker.leaveLayer(it);
}
@@ -843,15 +847,7 @@ const RendererCapabilities& LayerTreeHostImpl::rendererCapabilities() const
bool LayerTreeHostImpl::swapBuffers()
{
- DCHECK(m_renderer);
- bool result = m_renderer->swapBuffers();
-
- if (m_settings.implSidePainting &&
- !activeTree()->AreVisibleResourcesReady()) {
- m_client->didSwapUseIncompleteTileOnImplThread();
- }
-
- return result;
+ return m_renderer->swapBuffers();
}
const gfx::Size& LayerTreeHostImpl::deviceViewportSize() const
diff --git a/cc/layer_tree_host_impl.h b/cc/layer_tree_host_impl.h
index ae4f21a..98368f3 100644
--- a/cc/layer_tree_host_impl.h
+++ b/cc/layer_tree_host_impl.h
@@ -50,7 +50,6 @@ public:
virtual void onCanDrawStateChanged(bool canDraw) = 0;
virtual void onHasPendingTreeStateChanged(bool hasPendingTree) = 0;
virtual void setNeedsRedrawOnImplThread() = 0;
- virtual void didSwapUseIncompleteTileOnImplThread() = 0;
virtual void didUploadVisibleHighResolutionTileOnImplThread() = 0;
virtual void setNeedsCommitOnImplThread() = 0;
virtual void setNeedsManageTilesOnImplThread() = 0;
@@ -104,6 +103,7 @@ public:
RenderPassIdHashMap renderPassesById;
const LayerList* renderSurfaceLayerList;
LayerList willDrawLayers;
+ bool containsIncompleteTile;
// RenderPassSink implementation.
virtual void appendRenderPass(scoped_ptr<RenderPass>) OVERRIDE;
diff --git a/cc/layer_tree_host_impl_unittest.cc b/cc/layer_tree_host_impl_unittest.cc
index b490257..06a4e96 100644
--- a/cc/layer_tree_host_impl_unittest.cc
+++ b/cc/layer_tree_host_impl_unittest.cc
@@ -67,7 +67,6 @@ public:
, m_hasPendingTree(false)
, m_didRequestCommit(false)
, m_didRequestRedraw(false)
- , m_didSwapUseIncompleteTile(false)
, m_didUploadVisibleHighResolutionTile(false)
, m_reduceMemoryResult(true)
{
@@ -95,7 +94,6 @@ public:
virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { m_onCanDrawStateChangedCalled = true; }
virtual void onHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE { m_hasPendingTree = hasPendingTree; }
virtual void setNeedsRedrawOnImplThread() OVERRIDE { m_didRequestRedraw = true; }
- virtual void didSwapUseIncompleteTileOnImplThread() OVERRIDE { m_didSwapUseIncompleteTile = true; }
virtual void didUploadVisibleHighResolutionTileOnImplThread() OVERRIDE { m_didUploadVisibleHighResolutionTile = true; }
virtual void setNeedsCommitOnImplThread() OVERRIDE { m_didRequestCommit = true; }
virtual void setNeedsManageTilesOnImplThread() OVERRIDE { }
@@ -229,7 +227,6 @@ protected:
bool m_hasPendingTree;
bool m_didRequestCommit;
bool m_didRequestRedraw;
- bool m_didSwapUseIncompleteTile;
bool m_didUploadVisibleHighResolutionTile;
bool m_reduceMemoryResult;
};
diff --git a/cc/layer_tree_host_unittest.cc b/cc/layer_tree_host_unittest.cc
index 7cb46ba..63799bf 100644
--- a/cc/layer_tree_host_unittest.cc
+++ b/cc/layer_tree_host_unittest.cc
@@ -865,12 +865,15 @@ public:
virtual void calculateContentsScale(
float idealContentsScale,
+ bool animatingTransformToScreen,
float* contentsScaleX,
float* contentsScaleY,
gfx::Size* contentBounds) OVERRIDE
{
+ // Skip over the ContentLayer's method to the base Layer class.
Layer::calculateContentsScale(
idealContentsScale,
+ animatingTransformToScreen,
contentsScaleX,
contentsScaleY,
contentBounds);
diff --git a/cc/picture_layer_impl.cc b/cc/picture_layer_impl.cc
index cf3d6d9..25bb52b 100644
--- a/cc/picture_layer_impl.cc
+++ b/cc/picture_layer_impl.cc
@@ -162,9 +162,14 @@ void PictureLayerImpl::appendQuads(QuadSink& quadSink,
if (quadSink.append(quad.PassAs<DrawQuad>(), appendQuadsData))
appendQuadsData.numMissingTiles++;
}
+
+ appendQuadsData.hadIncompleteTile = true;
continue;
}
+ if (iter->contents_scale() != ideal_contents_scale_)
+ appendQuadsData.hadIncompleteTile = true;
+
gfx::RectF texture_rect = iter.texture_rect();
gfx::Rect opaque_rect = iter->opaque_rect();
opaque_rect.Intersect(content_rect);
@@ -256,6 +261,7 @@ void PictureLayerImpl::didLoseOutputSurface() {
void PictureLayerImpl::calculateContentsScale(
float ideal_contents_scale,
+ bool animating_transform_to_screen,
float* contents_scale_x,
float* contents_scale_y,
gfx::Size* content_bounds) {
@@ -280,7 +286,7 @@ void PictureLayerImpl::calculateContentsScale(
ideal_device_scale_ = ideal_device_scale;
ideal_source_scale_ = std::max(ideal_source_scale, min_source_scale);
- ManageTilings();
+ ManageTilings(animating_transform_to_screen);
// The content scale and bounds for a PictureLayerImpl is somewhat fictitious.
// There are (usually) several tilings at different scales. However, the
@@ -436,6 +442,7 @@ ResourceProvider::ResourceId PictureLayerImpl::contentsResourceId() const {
}
bool PictureLayerImpl::areVisibleResourcesReady() const {
+ DCHECK(layerTreeImpl()->IsPendingTree());
DCHECK(ideal_contents_scale_);
const gfx::Rect& rect = visibleContentRect();
@@ -448,17 +455,15 @@ bool PictureLayerImpl::areVisibleResourcesReady() const {
float min_acceptable_scale =
std::min(raster_contents_scale, ideal_contents_scale_);
- if (layerTreeImpl()->IsPendingTree()) {
- if (PictureLayerImpl* twin = ActiveTwin()) {
- float twin_raster_contents_scale =
- twin->raster_page_scale_ *
- twin->raster_device_scale_ *
- twin->raster_source_scale_;
+ if (PictureLayerImpl* twin = ActiveTwin()) {
+ float twin_raster_contents_scale =
+ twin->raster_page_scale_ *
+ twin->raster_device_scale_ *
+ twin->raster_source_scale_;
- min_acceptable_scale = std::min(
- min_acceptable_scale,
- std::min(twin->ideal_contents_scale_, twin_raster_contents_scale));
- }
+ min_acceptable_scale = std::min(
+ min_acceptable_scale,
+ std::min(twin->ideal_contents_scale_, twin_raster_contents_scale));
}
Region missing_region = rect;
@@ -536,7 +541,7 @@ inline bool IsCloserToThan(
} // namespace
-void PictureLayerImpl::ManageTilings() {
+void PictureLayerImpl::ManageTilings(bool animating_transform_to_screen) {
DCHECK(ideal_contents_scale_);
DCHECK(ideal_page_scale_);
DCHECK(ideal_device_scale_);
@@ -549,9 +554,6 @@ void PictureLayerImpl::ManageTilings() {
bool is_active_layer = layerTreeImpl()->IsActiveTree();
bool is_pinching = layerTreeImpl()->PinchGestureActive();
- bool is_animating =
- drawTransformIsAnimating() ||
- screenSpaceTransformIsAnimating();
bool change_target_tiling = false;
@@ -564,9 +566,9 @@ void PictureLayerImpl::ManageTilings() {
// appropriate rate.
if (is_active_layer) {
- if (raster_source_scale_was_animating_ && !is_animating)
+ if (raster_source_scale_was_animating_ && !animating_transform_to_screen)
change_target_tiling = true;
- raster_source_scale_was_animating_ = is_animating;
+ raster_source_scale_was_animating_ = animating_transform_to_screen;
}
if (is_active_layer && is_pinching) {
@@ -594,12 +596,14 @@ void PictureLayerImpl::ManageTilings() {
raster_device_scale_ = ideal_device_scale_;
raster_source_scale_ = ideal_source_scale_;
+ float raster_contents_scale = ideal_contents_scale_;
+
// Don't allow animating CSS scales to drop below 1.
- if (is_animating)
- raster_source_scale_ = std::max(raster_source_scale_, 1.f);
+ if (animating_transform_to_screen) {
+ raster_contents_scale = std::max(
+ raster_contents_scale, 1.f * ideal_page_scale_ * ideal_device_scale_);
+ }
- float raster_contents_scale =
- raster_page_scale_ * raster_device_scale_ * raster_source_scale_;
float low_res_raster_contents_scale = std::max(
raster_contents_scale * low_res_factor,
layerTreeImpl()->settings().minimumContentsScale);
diff --git a/cc/picture_layer_impl.h b/cc/picture_layer_impl.h
index afe625e..72df41e 100644
--- a/cc/picture_layer_impl.h
+++ b/cc/picture_layer_impl.h
@@ -40,6 +40,7 @@ public:
virtual void didLoseOutputSurface() OVERRIDE;
virtual void calculateContentsScale(
float ideal_contents_scale,
+ bool animating_transform_to_screen,
float* contents_scale_x,
float* contents_scale_y,
gfx::Size* content_bounds) OVERRIDE;
@@ -73,7 +74,7 @@ protected:
PictureLayerTiling* AddTiling(float contents_scale);
void RemoveTiling(float contents_scale);
void SyncFromActiveLayer(const PictureLayerImpl* other);
- void ManageTilings();
+ void ManageTilings(bool animating_transform_to_screen);
void CleanUpTilingsOnActiveLayer(
std::vector<PictureLayerTiling*> used_tilings);
PictureLayerImpl* PendingTwin() const;
diff --git a/cc/picture_layer_impl_unittest.cc b/cc/picture_layer_impl_unittest.cc
index 0f71c18..340e60c 100644
--- a/cc/picture_layer_impl_unittest.cc
+++ b/cc/picture_layer_impl_unittest.cc
@@ -181,13 +181,15 @@ class PictureLayerImplTest : public testing::Test {
}
}
- void SetContentsScaleOnBothLayers(float scale) {
+ void SetContentsScaleOnBothLayers(float scale, bool animating_transform) {
float result_scale_x, result_scale_y;
gfx::Size result_bounds;
pending_layer_->calculateContentsScale(
- scale, &result_scale_x, &result_scale_y, &result_bounds);
+ scale, animating_transform,
+ &result_scale_x, &result_scale_y, &result_bounds);
active_layer_->calculateContentsScale(
- scale, &result_scale_x, &result_scale_y, &result_bounds);
+ scale, animating_transform,
+ &result_scale_x, &result_scale_y, &result_bounds);
}
protected:
@@ -397,7 +399,7 @@ TEST_F(PictureLayerImplTest, ManageTilingsWithNoRecording) {
host_impl_.pendingTree()->SetPageScaleFactorAndLimits(1.f, 1.f, 1.f);
pending_layer_->calculateContentsScale(
- 1.f, &result_scale_x, &result_scale_y, &result_bounds);
+ 1.f, false, &result_scale_x, &result_scale_y, &result_bounds);
EXPECT_EQ(0u, pending_layer_->tilings().num_tilings());
}
@@ -425,7 +427,7 @@ TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) {
host_impl_.pendingTree()->SetPageScaleFactorAndLimits(3.2f, 3.2f, 3.2f);
pending_layer_->calculateContentsScale(
- 1.3f, &result_scale_x, &result_scale_y, &result_bounds);
+ 1.3f, false, &result_scale_x, &result_scale_y, &result_bounds);
ASSERT_EQ(2u, pending_layer_->tilings().num_tilings());
EXPECT_FLOAT_EQ(
1.3f,
@@ -437,7 +439,7 @@ TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) {
// If we change the layer's CSS scale factor, then we should not get new
// tilings.
pending_layer_->calculateContentsScale(
- 1.8f, &result_scale_x, &result_scale_y, &result_bounds);
+ 1.8f, false, &result_scale_x, &result_scale_y, &result_bounds);
ASSERT_EQ(2u, pending_layer_->tilings().num_tilings());
EXPECT_FLOAT_EQ(
1.3f,
@@ -450,7 +452,7 @@ TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) {
host_impl_.pendingTree()->SetPageScaleFactorAndLimits(2.2f, 2.2f, 2.2f);
pending_layer_->calculateContentsScale(
- 1.8f, &result_scale_x, &result_scale_y, &result_bounds);
+ 1.8f, false, &result_scale_x, &result_scale_y, &result_bounds);
ASSERT_EQ(4u, pending_layer_->tilings().num_tilings());
EXPECT_FLOAT_EQ(
1.8f,
@@ -463,7 +465,7 @@ TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) {
host_impl_.setDeviceScaleFactor(1.4f);
pending_layer_->calculateContentsScale(
- 1.9f, &result_scale_x, &result_scale_y, &result_bounds);
+ 1.9f, false, &result_scale_x, &result_scale_y, &result_bounds);
ASSERT_EQ(6u, pending_layer_->tilings().num_tilings());
EXPECT_FLOAT_EQ(
1.9f,
@@ -478,7 +480,7 @@ TEST_F(PictureLayerImplTest, ManageTilingsCreatesTilings) {
host_impl_.pendingTree()->SetPageScaleFactorAndLimits(1.4f, 1.4f, 1.4f);
pending_layer_->calculateContentsScale(
- 1.9f, &result_scale_x, &result_scale_y, &result_bounds);
+ 1.9f, false, &result_scale_x, &result_scale_y, &result_bounds);
ASSERT_EQ(6u, pending_layer_->tilings().num_tilings());
EXPECT_FLOAT_EQ(
1.9f,
@@ -512,7 +514,7 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
host_impl_.pendingTree()->SetPageScaleFactorAndLimits(3.2f, 3.2f, 3.2f);
host_impl_.activeTree()->SetPageScaleFactorAndLimits(3.2f, 3.2f, 3.2f);
- SetContentsScaleOnBothLayers(1.f);
+ SetContentsScaleOnBothLayers(1.f, false);
ASSERT_EQ(2u, active_layer_->tilings().num_tilings());
// We only have ideal tilings, so they aren't removed.
@@ -521,7 +523,7 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
ASSERT_EQ(2u, active_layer_->tilings().num_tilings());
// Changing the ideal but not creating new tilings.
- SetContentsScaleOnBothLayers(1.5f);
+ SetContentsScaleOnBothLayers(1.5f, false);
ASSERT_EQ(2u, active_layer_->tilings().num_tilings());
// The tilings are still our target scale, so they aren't removed.
@@ -532,7 +534,7 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
// Create a 1.2 scale tiling. Now we have 1.0 and 1.2 tilings. Ideal = 1.2.
host_impl_.pendingTree()->SetPageScaleFactorAndLimits(1.2f, 1.2f, 1.2f);
host_impl_.activeTree()->SetPageScaleFactorAndLimits(1.2f, 1.2f, 1.2f);
- SetContentsScaleOnBothLayers(1.2f);
+ SetContentsScaleOnBothLayers(1.2f, false);
ASSERT_EQ(4u, active_layer_->tilings().num_tilings());
EXPECT_FLOAT_EQ(
1.f,
@@ -549,7 +551,7 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
ASSERT_EQ(4u, active_layer_->tilings().num_tilings());
// Now move the ideal scale to 0.5. Our target stays 1.2.
- SetContentsScaleOnBothLayers(0.5f);
+ SetContentsScaleOnBothLayers(0.5f, false);
// All the tilings are between are target and the ideal, so they are not
// removed.
@@ -558,7 +560,7 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
ASSERT_EQ(4u, active_layer_->tilings().num_tilings());
// Now move the ideal scale to 1.0. Our target stays 1.2.
- SetContentsScaleOnBothLayers(1.f);
+ SetContentsScaleOnBothLayers(1.f, false);
// All the tilings are between are target and the ideal, so they are not
// removed.
@@ -568,7 +570,7 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
// Now move the ideal scale to 1.1 on the active layer. Our target stays 1.2.
active_layer_->calculateContentsScale(
- 1.1f, &result_scale_x, &result_scale_y, &result_bounds);
+ 1.1f, false, &result_scale_x, &result_scale_y, &result_bounds);
// Because the pending layer's ideal scale is still 1.0, our tilings fall
// in the range [1.0,1.2] and are kept.
@@ -579,7 +581,7 @@ TEST_F(PictureLayerImplTest, CleanUpTilings) {
// Move the ideal scale on the pending layer to 1.1 as well. Our target stays
// 1.2 still.
pending_layer_->calculateContentsScale(
- 1.1f, &result_scale_x, &result_scale_y, &result_bounds);
+ 1.1f, false, &result_scale_x, &result_scale_y, &result_bounds);
// Our 1.0 tiling now falls outside the range between our ideal scale and our
// target raster scale. But it is in our used tilings set, so nothing is
diff --git a/cc/scrollbar_layer.cc b/cc/scrollbar_layer.cc
index c3e1640..6fad23c 100644
--- a/cc/scrollbar_layer.cc
+++ b/cc/scrollbar_layer.cc
@@ -85,12 +85,14 @@ float ScrollbarLayer::clampScaleToMaxTextureSize(float scale) {
void ScrollbarLayer::calculateContentsScale(
float idealContentsScale,
+ bool animatingTransformToScreen,
float* contentsScaleX,
float* contentsScaleY,
gfx::Size* contentBounds)
{
ContentsScalingLayer::calculateContentsScale(
clampScaleToMaxTextureSize(idealContentsScale),
+ animatingTransformToScreen,
contentsScaleX,
contentsScaleY,
contentBounds);
diff --git a/cc/scrollbar_layer.h b/cc/scrollbar_layer.h
index 2d0c1a8..e26cbde 100644
--- a/cc/scrollbar_layer.h
+++ b/cc/scrollbar_layer.h
@@ -41,6 +41,7 @@ public:
virtual void pushPropertiesTo(LayerImpl*) OVERRIDE;
virtual void calculateContentsScale(
float idealContentsScale,
+ bool animatingTransformToScreen,
float* contentsScaleX,
float* contentsScaleY,
gfx::Size* contentBounds) OVERRIDE;
diff --git a/cc/single_thread_proxy.cc b/cc/single_thread_proxy.cc
index 3d223a0..659f7af 100644
--- a/cc/single_thread_proxy.cc
+++ b/cc/single_thread_proxy.cc
@@ -275,12 +275,6 @@ void SingleThreadProxy::setNeedsRedrawOnImplThread()
m_layerTreeHost->scheduleComposite();
}
-void SingleThreadProxy::didSwapUseIncompleteTileOnImplThread()
-{
- // implSidePainting only.
- NOTREACHED();
-}
-
void SingleThreadProxy::didUploadVisibleHighResolutionTileOnImplThread()
{
// implSidePainting only.
diff --git a/cc/single_thread_proxy.h b/cc/single_thread_proxy.h
index 35a7c50..b204614 100644
--- a/cc/single_thread_proxy.h
+++ b/cc/single_thread_proxy.h
@@ -54,7 +54,6 @@ public:
virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE { }
virtual void onHasPendingTreeStateChanged(bool havePendingTree) OVERRIDE;
virtual void setNeedsRedrawOnImplThread() OVERRIDE;
- virtual void didSwapUseIncompleteTileOnImplThread() OVERRIDE;
virtual void didUploadVisibleHighResolutionTileOnImplThread() OVERRIDE;
virtual void setNeedsCommitOnImplThread() OVERRIDE;
virtual void setNeedsManageTilesOnImplThread() OVERRIDE;
diff --git a/cc/test/fake_layer_tree_host_impl_client.h b/cc/test/fake_layer_tree_host_impl_client.h
index 3291ee9..f874a97 100644
--- a/cc/test/fake_layer_tree_host_impl_client.h
+++ b/cc/test/fake_layer_tree_host_impl_client.h
@@ -20,7 +20,6 @@ class FakeLayerTreeHostImplClient : public LayerTreeHostImplClient {
virtual void onCanDrawStateChanged(bool) OVERRIDE { }
virtual void onHasPendingTreeStateChanged(bool) OVERRIDE { }
virtual void setNeedsRedrawOnImplThread() OVERRIDE { }
- virtual void didSwapUseIncompleteTileOnImplThread() OVERRIDE { }
virtual void didUploadVisibleHighResolutionTileOnImplThread() OVERRIDE { }
virtual void setNeedsCommitOnImplThread() OVERRIDE { }
virtual void setNeedsManageTilesOnImplThread() OVERRIDE { }
diff --git a/cc/test/tiled_layer_test_common.cc b/cc/test/tiled_layer_test_common.cc
index d78facb..d35db09 100644
--- a/cc/test/tiled_layer_test_common.cc
+++ b/cc/test/tiled_layer_test_common.cc
@@ -138,6 +138,7 @@ void FakeTiledLayer::updateContentsScale(float idealContentsScale)
{
calculateContentsScale(
idealContentsScale,
+ false, // animating_transform_to_screen
&drawProperties().contents_scale_x,
&drawProperties().contents_scale_y,
&drawProperties().content_bounds);
@@ -156,6 +157,7 @@ void FakeTiledLayerWithScaledBounds::setContentBounds(const gfx::Size& contentBo
void FakeTiledLayerWithScaledBounds::calculateContentsScale(
float idealContentsScale,
+ bool animatingTransformToScreen,
float* contentsScaleX,
float* contentsScaleY,
gfx::Size* contentBounds)
diff --git a/cc/test/tiled_layer_test_common.h b/cc/test/tiled_layer_test_common.h
index 954e8cf..2e09b79 100644
--- a/cc/test/tiled_layer_test_common.h
+++ b/cc/test/tiled_layer_test_common.h
@@ -120,6 +120,7 @@ public:
void setContentBounds(const gfx::Size& contentBounds);
virtual void calculateContentsScale(
float idealContentsScale,
+ bool animatingTransformToScreen,
float* contentsScaleX,
float* contentsScaleY,
gfx::Size* contentBounds) OVERRIDE;
diff --git a/cc/thread_proxy.cc b/cc/thread_proxy.cc
index 2d24429..86806cd 100644
--- a/cc/thread_proxy.cc
+++ b/cc/thread_proxy.cc
@@ -847,9 +847,13 @@ ScheduledActionDrawAndSwapResult ThreadProxy::scheduledActionDrawAndSwapInternal
}
m_readbackRequestOnImplThread->completion.signal();
m_readbackRequestOnImplThread = 0;
- } else if (drawFrame)
+ } else if (drawFrame) {
result.didSwap = m_layerTreeHostImpl->swapBuffers();
+ if (frame.containsIncompleteTile)
+ didSwapUseIncompleteTileOnImplThread();
+ }
+
// Tell the main thread that the the newly-commited frame was drawn.
if (m_nextFrameIsNewlyCommittedFrameOnImplThread) {
m_nextFrameIsNewlyCommittedFrameOnImplThread = false;
diff --git a/cc/thread_proxy.h b/cc/thread_proxy.h
index 9223933..f79d6d2 100644
--- a/cc/thread_proxy.h
+++ b/cc/thread_proxy.h
@@ -63,7 +63,6 @@ public:
virtual void onCanDrawStateChanged(bool canDraw) OVERRIDE;
virtual void onHasPendingTreeStateChanged(bool hasPendingTree) OVERRIDE;
virtual void setNeedsRedrawOnImplThread() OVERRIDE;
- virtual void didSwapUseIncompleteTileOnImplThread() OVERRIDE;
virtual void didUploadVisibleHighResolutionTileOnImplThread() OVERRIDE;
virtual void setNeedsCommitOnImplThread() OVERRIDE;
virtual void setNeedsManageTilesOnImplThread() OVERRIDE;
@@ -145,6 +144,7 @@ private:
void commitPendingOnImplThreadForTesting(CommitPendingRequest* request);
void capturePictureOnImplThread(CompletionEvent*, skia::RefPtr<SkPicture>*);
void renewTreePriorityOnImplThread();
+ void didSwapUseIncompleteTileOnImplThread();
// Accessed on main thread only.
bool m_animateRequested; // Set only when setNeedsAnimate is called.