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

Unified Diff: views/view.cc

Issue 7605024: views: Force child views to paint into their own texture when the parent has an external texture. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/view.cc
diff --git a/views/view.cc b/views/view.cc
index 480d94485488e47eb3bec0d97c05247f5735f91a..136f52a32736f247400e04d48274dd5938e6886b 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -1216,10 +1216,6 @@ void View::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) {
}
bool View::SetExternalTexture(ui::Texture* texture) {
- // A little heavy-handed -- it should be that each child has it's own layer.
- // The desired use case is where there are no children.
- DCHECK_EQ(child_count(), 0);
-
if (!texture && !layer_helper_.get())
return true;
@@ -1234,6 +1230,13 @@ bool View::SetExternalTexture(ui::Texture* texture) {
if (use_external && !layer())
return false;
+ // Child views must not paint into the external texture. So make sure each
+ // child view has its own layer to paint into.
+ if (use_external) {
+ for (Views::iterator i = children_.begin(); i != children_.end(); ++i)
+ (*i)->SetPaintToLayer(true);
rjkroege 2011/08/10 14:29:53 this is not recursive right? It's only the immedia
sadrul 2011/08/10 14:33:05 Yes, that is correct (i.e. not recursive).
+ }
+
layer_helper_->set_layer_updated_externally(use_external);
layer_helper_->set_bitmap_needs_updating(!use_external);
if (layer())
@@ -1720,7 +1723,9 @@ bool View::ConvertPointFromAncestor(const View* ancestor,
bool View::ShouldPaintToLayer() const {
return use_acceleration_when_possible &&
- layer_helper_.get() && layer_helper_->ShouldPaintToLayer();
+ ((layer_helper_.get() && layer_helper_->ShouldPaintToLayer()) ||
+ (parent_ && parent_->layer_helper_.get() &&
+ parent_->layer_helper_->layer_updated_externally()));
}
void View::CreateLayer() {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698