Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1535)

Unified Diff: cc/layers/picture_layer_impl.cc

Issue 13863015: Add flag for drawing layers to screen with Ganesh (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Stencil buffer support, --draw-layers-with-ganesh Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/output/gl_renderer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 =
« no previous file with comments | « cc/layers/layer_impl.cc ('k') | cc/output/gl_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698