Index: cc/layers/picture_layer_impl.cc |
diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc |
index 3d6188711e5b5d109ced38efb7226fc58981080a..c24d7a41d5ba57ef44381866f92fb8d12af117a0 100644 |
--- a/cc/layers/picture_layer_impl.cc |
+++ b/cc/layers/picture_layer_impl.cc |
@@ -119,8 +119,14 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, |
color = DebugColors::SolidColorTileBorderColor(); |
width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); |
} else if (mode == ManagedTileState::DrawingInfo::PICTURE_PILE_MODE) { |
- color = DebugColors::PictureTileBorderColor(); |
- width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); |
+ if (CanDrawDirectlyToBackbuffer()) { |
+ color = DebugColors::DirectPictureTileBorderColor(); |
+ width = |
+ DebugColors::DirectPictureTileBorderWidth(layer_tree_impl()); |
+ } else { |
+ color = DebugColors::PictureTileBorderColor(); |
+ width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); |
+ } |
} else if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { |
color = DebugColors::HighResTileBorderColor(); |
width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); |
@@ -148,6 +154,25 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, |
} |
} |
+ if (CanDrawDirectlyToBackbuffer() && |
+ layer_tree_impl()->settings().draw_layers_with_ganesh) { |
+ scoped_ptr<PictureDrawQuad> quad = PictureDrawQuad::Create(); |
+ gfx::Rect opaque_rect; |
+ quad->SetNew(shared_quad_state, |
+ content_rect, |
+ opaque_rect, |
+ gfx::RectF(0, 0, 1, 1), |
+ content_rect.size(), |
+ false, |
+ content_rect, |
+ contents_scale_x(), |
+ CanDrawDirectlyToBackbuffer(), |
+ pile_); |
+ if (quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data)) |
+ append_quads_data->num_missing_tiles++; |
+ return; |
+ } |
+ |
// Keep track of the tilings that were used so that tilings that are |
// unused can be considered for removal. |
std::vector<PictureLayerTiling*> seen_tilings; |
@@ -228,6 +253,7 @@ void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, |
drawing_info.contents_swizzled(), |
iter->content_rect(), |
iter->contents_scale(), |
+ CanDrawDirectlyToBackbuffer(), |
pile_); |
quad_sink->Append(quad.PassAs<DrawQuad>(), append_quads_data); |
break; |
@@ -347,6 +373,19 @@ void PictureLayerImpl::CalculateContentsScale( |
ideal_device_scale_ = ideal_device_scale; |
ideal_source_scale_ = std::max(ideal_source_scale, min_source_scale); |
+ if (CanDrawDirectlyToBackbuffer() && |
+ layer_tree_impl()->settings().draw_layers_with_ganesh) { |
+ if (tilings_) |
+ tilings_->RemoveAllTilings(); |
+ |
+ *contents_scale_x = ideal_contents_scale_; |
+ *contents_scale_y = ideal_contents_scale_; |
+ *content_bounds = gfx::ToCeiledSize(gfx::ScaleSize(bounds(), |
+ ideal_contents_scale_, |
+ ideal_contents_scale_)); |
+ return; |
+ } |
+ |
ManageTilings(animating_transform_to_screen); |
// The content scale and bounds for a PictureLayerImpl is somewhat fictitious. |
@@ -547,6 +586,9 @@ bool PictureLayerImpl::AreVisibleResourcesReady() const { |
DCHECK(layer_tree_impl()->IsPendingTree()); |
DCHECK(ideal_contents_scale_); |
+ if (!tilings_->num_tilings()) |
+ return true; |
+ |
gfx::Rect rect(visible_content_rect()); |
float min_acceptable_scale = |