Index: cc/trees/layer_tree_host_impl_unittest.cc |
diff --git a/cc/trees/layer_tree_host_impl_unittest.cc b/cc/trees/layer_tree_host_impl_unittest.cc |
index 919382fde14f4d59713f0eb7803b8591c8a9581c..14efaa27ca7f79161db9fe1c9c8c65858c72c1e5 100644 |
--- a/cc/trees/layer_tree_host_impl_unittest.cc |
+++ b/cc/trees/layer_tree_host_impl_unittest.cc |
@@ -1646,8 +1646,7 @@ TEST_F(LayerTreeHostImplTest, CompositorFrameMetadata) { |
} |
} |
-// TODO(enne): Convert this to PictureLayerImpl |
-class DidDrawCheckLayer : public TiledLayerImpl { |
+class DidDrawCheckLayer : public LayerImpl { |
public: |
static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, int id) { |
return scoped_ptr<LayerImpl>(new DidDrawCheckLayer(tree_impl, id)); |
@@ -1658,18 +1657,18 @@ class DidDrawCheckLayer : public TiledLayerImpl { |
will_draw_called_ = true; |
if (will_draw_returns_false_) |
return false; |
- return TiledLayerImpl::WillDraw(draw_mode, provider); |
+ return LayerImpl::WillDraw(draw_mode, provider); |
} |
virtual void AppendQuads(QuadSink* quad_sink, |
AppendQuadsData* append_quads_data) OVERRIDE { |
append_quads_called_ = true; |
- TiledLayerImpl::AppendQuads(quad_sink, append_quads_data); |
+ LayerImpl::AppendQuads(quad_sink, append_quads_data); |
} |
virtual void DidDraw(ResourceProvider* provider) OVERRIDE { |
did_draw_called_ = true; |
- TiledLayerImpl::DidDraw(provider); |
+ LayerImpl::DidDraw(provider); |
} |
bool will_draw_called() const { return will_draw_called_; } |
@@ -1686,7 +1685,7 @@ class DidDrawCheckLayer : public TiledLayerImpl { |
protected: |
DidDrawCheckLayer(LayerTreeImpl* tree_impl, int id) |
- : TiledLayerImpl(tree_impl, id), |
+ : LayerImpl(tree_impl, id), |
will_draw_returns_false_(false), |
will_draw_called_(false), |
append_quads_called_(false), |
@@ -1695,14 +1694,7 @@ class DidDrawCheckLayer : public TiledLayerImpl { |
SetBounds(gfx::Size(10, 10)); |
SetContentBounds(gfx::Size(10, 10)); |
SetDrawsContent(true); |
- set_skips_draw(false); |
draw_properties().visible_content_rect = gfx::Rect(0, 0, 10, 10); |
- |
- scoped_ptr<LayerTilingData> tiler = |
- LayerTilingData::Create(gfx::Size(100, 100), |
- LayerTilingData::HAS_BORDER_TEXELS); |
- tiler->SetTilingRect(gfx::Rect(content_bounds())); |
- SetTilingData(*tiler.get()); |
} |
private: |
@@ -1878,39 +1870,32 @@ class MissingTextureAnimatingLayer : public DidDrawCheckLayer { |
static scoped_ptr<LayerImpl> Create(LayerTreeImpl* tree_impl, |
int id, |
bool tile_missing, |
- bool skips_draw, |
bool animating, |
ResourceProvider* resource_provider) { |
return scoped_ptr<LayerImpl>(new MissingTextureAnimatingLayer( |
tree_impl, |
id, |
tile_missing, |
- skips_draw, |
animating, |
resource_provider)); |
} |
virtual void AppendQuads(QuadSink* quad_sink, |
AppendQuadsData* append_quads_data) OVERRIDE { |
- TiledLayerImpl::AppendQuads(quad_sink, append_quads_data); |
- if (tile_missing_) |
+ LayerImpl::AppendQuads(quad_sink, append_quads_data); |
+ if (tile_missing_) { |
append_quads_data->had_incomplete_tile = true; |
+ append_quads_data->num_missing_tiles = true; |
danakj
2014/06/09 17:03:40
num_missing_tiles is not a bool it's a count.
it
sohanjg
2014/06/10 14:12:44
Done.
|
+ } |
} |
private: |
MissingTextureAnimatingLayer(LayerTreeImpl* tree_impl, |
int id, |
bool tile_missing, |
- bool skips_draw, |
bool animating, |
ResourceProvider* resource_provider) |
: DidDrawCheckLayer(tree_impl, id), tile_missing_(tile_missing) { |
- scoped_ptr<LayerTilingData> tiling_data = |
- LayerTilingData::Create(gfx::Size(10, 10), |
- LayerTilingData::NO_BORDER_TEXELS); |
- tiling_data->SetTilingRect(gfx::Rect(bounds())); |
- SetTilingData(*tiling_data.get()); |
- set_skips_draw(skips_draw); |
if (!tile_missing) { |
ResourceProvider::ResourceId resource = |
resource_provider->CreateResource(gfx::Size(1, 1), |
@@ -1918,7 +1903,6 @@ class MissingTextureAnimatingLayer : public DidDrawCheckLayer { |
ResourceProvider::TextureUsageAny, |
RGBA_8888); |
resource_provider->AllocateForTesting(resource); |
- PushTileProperties(0, 0, resource, gfx::Rect(), false); |
} |
if (animating) |
AddAnimatedTransformToLayer(this, 10.0, 3, 0); |
@@ -1934,13 +1918,11 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWhenNoTexturesMissing) { |
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
bool tile_missing = false; |
- bool skips_draw = false; |
bool is_animating = false; |
root->AddChild( |
MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
2, |
tile_missing, |
- skips_draw, |
is_animating, |
host_impl_->resource_provider())); |
@@ -1957,13 +1939,11 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawSucceedsWithAnimatedLayer) { |
DidDrawCheckLayer* root = |
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
bool tile_missing = false; |
- bool skips_draw = false; |
bool is_animating = true; |
root->AddChild( |
MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
2, |
tile_missing, |
- skips_draw, |
is_animating, |
host_impl_->resource_provider())); |
@@ -1984,13 +1964,11 @@ TEST_F(LayerTreeHostImplTest, |
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
bool tile_missing = true; |
- bool skips_draw = false; |
bool is_animating = false; |
root->AddChild( |
MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
4, |
tile_missing, |
- skips_draw, |
is_animating, |
host_impl_->resource_provider())); |
LayerTreeHostImpl::FrameData frame; |
@@ -2007,13 +1985,11 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawFailsWhenAnimationUsesCheckerboard) { |
DidDrawCheckLayer* root = |
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
bool tile_missing = true; |
- bool skips_draw = false; |
bool is_animating = true; |
root->AddChild( |
MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
6, |
tile_missing, |
- skips_draw, |
is_animating, |
host_impl_->resource_provider())); |
LayerTreeHostImpl::FrameData frame; |
@@ -2025,19 +2001,17 @@ TEST_F(LayerTreeHostImplTest, PrepareToDrawFailsWhenAnimationUsesCheckerboard) { |
TEST_F(LayerTreeHostImplTest, |
PrepareToDrawSucceedsWithMissingSkippedAnimatedLayer) { |
- // When the layer skips draw and we're animating, we still draw the frame. |
+ // When we're animating, we draw the frame. |
host_impl_->active_tree()->SetRootLayer( |
DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); |
DidDrawCheckLayer* root = |
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
bool tile_missing = false; |
- bool skips_draw = true; |
bool is_animating = true; |
root->AddChild( |
MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
8, |
tile_missing, |
- skips_draw, |
is_animating, |
host_impl_->resource_provider())); |
LayerTreeHostImpl::FrameData frame; |
@@ -2048,19 +2022,17 @@ TEST_F(LayerTreeHostImplTest, |
TEST_F(LayerTreeHostImplTest, |
PrepareToDrawSucceedsWhenHighResRequiredButNoMissingTextures) { |
- // When the layer skips draw and we're animating, we still draw the frame. |
+ // When we're not animating, we draw the frame. |
host_impl_->active_tree()->SetRootLayer( |
DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); |
DidDrawCheckLayer* root = |
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
bool tile_missing = false; |
- bool skips_draw = false; |
bool is_animating = false; |
root->AddChild( |
MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
8, |
tile_missing, |
- skips_draw, |
is_animating, |
host_impl_->resource_provider())); |
host_impl_->active_tree()->SetRequiresHighResToDraw(); |
@@ -2072,19 +2044,18 @@ TEST_F(LayerTreeHostImplTest, |
TEST_F(LayerTreeHostImplTest, |
PrepareToDrawFailsWhenHighResRequiredAndMissingTextures) { |
- // When the layer skips draw and we're animating, we still draw the frame. |
+ // When a texture is missing and we're not animating, we dont draw the frame |
+ // if we Set RequiresHighResToDraw. |
host_impl_->active_tree()->SetRootLayer( |
DidDrawCheckLayer::Create(host_impl_->active_tree(), 7)); |
DidDrawCheckLayer* root = |
static_cast<DidDrawCheckLayer*>(host_impl_->active_tree()->root_layer()); |
bool tile_missing = true; |
- bool skips_draw = false; |
bool is_animating = false; |
root->AddChild( |
MissingTextureAnimatingLayer::Create(host_impl_->active_tree(), |
8, |
tile_missing, |
- skips_draw, |
is_animating, |
host_impl_->resource_provider())); |
host_impl_->active_tree()->SetRequiresHighResToDraw(); |