summaryrefslogtreecommitdiffstats
path: root/views/layer_helper.cc
diff options
context:
space:
mode:
authorbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-15 21:55:46 +0000
committerbacker@chromium.org <backer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-15 21:55:46 +0000
commit0e4ba0ce9d5b2db277316132ccf15953185c3d31 (patch)
treec6c946b7da0f8b20bf64c36e2b4a1d2421cf2eeb /views/layer_helper.cc
parent5a8b12dc6eba4c0697a557eeec61eae805f8ee7d (diff)
downloadchromium_src-0e4ba0ce9d5b2db277316132ccf15953185c3d31.zip
chromium_src-0e4ba0ce9d5b2db277316132ccf15953185c3d31.tar.gz
chromium_src-0e4ba0ce9d5b2db277316132ccf15953185c3d31.tar.bz2
External textures outlive layers.
When the View is hidden, we destroy the associated Layer, but the external texture should persist. Similarly, if a View is made visible, we create a Layer and the Layer should have that external texture. The solution is to push the external texture logic and state up into the LayerHelper, which persists. BUG=none TEST=none Review URL: http://codereview.chromium.org/7904024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@101388 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views/layer_helper.cc')
-rw-r--r--views/layer_helper.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/views/layer_helper.cc b/views/layer_helper.cc
index 6ba2b5e..6ffd34a 100644
--- a/views/layer_helper.cc
+++ b/views/layer_helper.cc
@@ -5,6 +5,7 @@
#include "views/layer_helper.h"
#include "views/layer_property_setter.h"
+#include "ui/gfx/compositor/compositor.h"
#include "ui/gfx/compositor/layer.h"
#include "ui/gfx/transform.h"
@@ -38,11 +39,19 @@ void LayerHelper::SetLayer(ui::Layer* layer) {
if (!property_setter_.get())
property_setter_.reset(LayerPropertySetter::CreateDefaultSetter());
property_setter_->Installed(this->layer());
+ if (layer_updated_externally())
+ layer_->SetExternalTexture(external_texture_.get());
} else if (!property_setter_explicitly_set_) {
property_setter_.reset(NULL);
}
}
+void LayerHelper::SetExternalTexture(ui::Texture* texture) {
+ external_texture_ = texture;
+ if (layer_.get())
+ layer_->SetExternalTexture(texture);
+}
+
void LayerHelper::SetPropertySetter(LayerPropertySetter* setter) {
if (property_setter_.get() && layer())
property_setter_->Uninstalled(layer());
@@ -55,7 +64,9 @@ void LayerHelper::SetPropertySetter(LayerPropertySetter* setter) {
}
bool LayerHelper::ShouldPaintToLayer() const {
- return paint_to_layer_ || (transform_.get() && transform_->HasChange());
+ return paint_to_layer_ ||
+ layer_updated_externally() ||
+ (transform_.get() && transform_->HasChange());
}
} // namespace internal