exo: Handle cross-fade animations properly.
Cross-fade animations used for example when maximizing a
window will recreate the layer hierarchy and cross fade between
the old layers and the new layers. This relies on the contents
of the new layers being updated within some amount of time.
Produce new texture mailboxes when a layer is recreated until
we have an interface that provides some guarantee that the
client will.
BUG=549781
TEST=exo_unittests
Review-Url: https://codereview.chromium.org/2041663002
Cr-Commit-Position: refs/heads/master@{#397968}
diff --git a/components/exo/surface.h b/components/exo/surface.h
index 6c3acd7a..111b4d80 100644
--- a/components/exo/surface.h
+++ b/components/exo/surface.h
@@ -21,6 +21,7 @@
#include "ui/aura/window.h"
#include "ui/aura/window_observer.h"
#include "ui/compositor/compositor_observer.h"
+#include "ui/compositor/layer_owner_delegate.h"
#include "ui/gfx/geometry/rect.h"
namespace base {
@@ -81,6 +82,7 @@
// It has a location, size and pixel contents.
class Surface : public aura::Window,
public aura::WindowObserver,
+ public ui::LayerOwnerDelegate,
public ui::CompositorObserver {
public:
Surface();
@@ -202,6 +204,9 @@
void OnWindowRemovingFromRootWindow(aura::Window* window,
aura::Window* new_root) override;
+ // Overridden from ui::LayerOwnerDelegate:
+ void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override;
+
// Overridden from ui::CompositorObserver:
void OnCompositingDidCommit(ui::Compositor* compositor) override;
void OnCompositingStarted(ui::Compositor* compositor,
@@ -219,11 +224,17 @@
}
// Commit the current attached buffer to a TextureLayer.
- void CommitLayerContents();
+ void CommitTextureContents();
// Commit the current attached buffer to a SurfaceLayer.
void CommitSurfaceContents();
+ // Set TextureLayer contents to the current buffer.
+ void SetTextureLayerContents(ui::Layer* layer);
+
+ // Set SurfaceLayer contents to the current buffer.
+ void SetSurfaceLayerContents(ui::Layer* layer);
+
// This returns true when the surface has some contents assigned to it.
bool has_contents() const { return !!current_buffer_; }
@@ -283,15 +294,24 @@
// The crop rectangle to take effect when Commit() is called.
gfx::RectF pending_crop_;
+ // The active crop rectangle.
+ gfx::RectF crop_;
+
// The secure output visibility state to take effect when Commit() is called.
bool pending_only_visible_on_secure_output_;
+ // The active secure output visibility state.
+ bool only_visible_on_secure_output_;
+
// The blend mode state to take effect when Commit() is called.
SkXfermode::Mode pending_blend_mode_;
// The alpha state to take effect when Commit() is called.
float pending_alpha_;
+ // The active alpha state.
+ float alpha_;
+
// The buffer that is currently set as content of surface.
base::WeakPtr<Buffer> current_buffer_;