diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-13 17:28:50 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-09-13 17:28:50 +0000 |
commit | b6ea1c11d25b58a688509dca89a22b0922c7e05e (patch) | |
tree | 5268cae653fc6460202286bd2c219a049791f4ae /ui | |
parent | 3df2f1ad335dce38556f7a91de9895c6a489732e (diff) | |
download | chromium_src-b6ea1c11d25b58a688509dca89a22b0922c7e05e.zip chromium_src-b6ea1c11d25b58a688509dca89a22b0922c7e05e.tar.gz chromium_src-b6ea1c11d25b58a688509dca89a22b0922c7e05e.tar.bz2 |
Makes copying layers clone external textures.
BUG=146428
TEST=none
R=piman@chromium.org
Review URL: https://codereview.chromium.org/10910242
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156571 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r-- | ui/aura/demo/demo_main.cc | 3 | ||||
-rw-r--r-- | ui/aura/test/test_window_delegate.cc | 4 | ||||
-rw-r--r-- | ui/aura/test/test_window_delegate.h | 1 | ||||
-rw-r--r-- | ui/aura/window.cc | 2 | ||||
-rw-r--r-- | ui/aura/window_delegate.h | 6 | ||||
-rw-r--r-- | ui/compositor/layer.h | 1 | ||||
-rw-r--r-- | ui/views/widget/desktop_native_widget_aura.cc | 7 | ||||
-rw-r--r-- | ui/views/widget/desktop_native_widget_aura.h | 1 | ||||
-rw-r--r-- | ui/views/widget/native_widget_aura.cc | 7 | ||||
-rw-r--r-- | ui/views/widget/native_widget_aura.h | 1 |
10 files changed, 33 insertions, 0 deletions
diff --git a/ui/aura/demo/demo_main.cc b/ui/aura/demo/demo_main.cc index dd80765..7b8f93d 100644 --- a/ui/aura/demo/demo_main.cc +++ b/ui/aura/demo/demo_main.cc @@ -64,6 +64,9 @@ class DemoWindowDelegate : public aura::WindowDelegate { virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE {} virtual bool HasHitTestMask() const OVERRIDE { return false; } virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE {} + scoped_refptr<ui::Texture> CopyTexture() { + return scoped_refptr<ui::Texture>(); + } // Overridden from ui::EventHandler: virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE { diff --git a/ui/aura/test/test_window_delegate.cc b/ui/aura/test/test_window_delegate.cc index a88eb69..8815c92 100644 --- a/ui/aura/test/test_window_delegate.cc +++ b/ui/aura/test/test_window_delegate.cc @@ -93,6 +93,10 @@ bool TestWindowDelegate::HasHitTestMask() const { void TestWindowDelegate::GetHitTestMask(gfx::Path* mask) const { } +scoped_refptr<ui::Texture> TestWindowDelegate::CopyTexture() { + return scoped_refptr<ui::Texture>(); +} + ui::EventResult TestWindowDelegate::OnKeyEvent(ui::KeyEvent* event) { return ui::ER_UNHANDLED; } diff --git a/ui/aura/test/test_window_delegate.h b/ui/aura/test/test_window_delegate.h index 1ce73ac..8076690 100644 --- a/ui/aura/test/test_window_delegate.h +++ b/ui/aura/test/test_window_delegate.h @@ -49,6 +49,7 @@ class TestWindowDelegate : public WindowDelegate { virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE; virtual bool HasHitTestMask() const OVERRIDE; virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; + virtual scoped_refptr<ui::Texture> CopyTexture() OVERRIDE; // Overridden from ui::EventHandler: virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE; diff --git a/ui/aura/window.cc b/ui/aura/window.cc index 30f53fa..ae0778d 100644 --- a/ui/aura/window.cc +++ b/ui/aura/window.cc @@ -167,6 +167,8 @@ ui::Layer* Window::RecreateLayer() { return NULL; old_layer->set_delegate(NULL); + if (delegate_ && old_layer->external_texture()) + old_layer->SetExternalTexture(delegate_->CopyTexture()); layer_ = new ui::Layer(old_layer->type()); layer_owner_.reset(layer_); layer_->SetVisible(old_layer->visible()); diff --git a/ui/aura/window_delegate.h b/ui/aura/window_delegate.h index ba25a12..fb98de7 100644 --- a/ui/aura/window_delegate.h +++ b/ui/aura/window_delegate.h @@ -6,6 +6,7 @@ #define UI_AURA_WINDOW_DELEGATE_H_ #include "base/compiler_specific.h" +#include "base/memory/ref_counted.h" #include "ui/aura/aura_export.h" #include "ui/base/events/event_constants.h" #include "ui/base/events/event_handler.h" @@ -23,6 +24,7 @@ namespace ui { class GestureEvent; class KeyEvent; class MouseEvent; +class Texture; class TouchEvent; } @@ -94,6 +96,10 @@ class AURA_EXPORT WindowDelegate : public ui::EventHandler { // above returns true. virtual void GetHitTestMask(gfx::Path* mask) const = 0; + // Called from RecreateLayer() if the layer the window is associated with has + // an external texture. + virtual scoped_refptr<ui::Texture> CopyTexture() = 0; + protected: virtual ~WindowDelegate() {} diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h index c150fb3..f9fcbc9 100644 --- a/ui/compositor/layer.h +++ b/ui/compositor/layer.h @@ -220,6 +220,7 @@ class COMPOSITOR_EXPORT Layer // Assigns a new external texture. |texture| can be NULL to disable external // updates. void SetExternalTexture(ui::Texture* texture); + ui::Texture* external_texture() { return texture_.get(); } // Sets the layer's fill color. May only be called for LAYER_SOLID_COLOR. void SetColor(SkColor color); diff --git a/ui/views/widget/desktop_native_widget_aura.cc b/ui/views/widget/desktop_native_widget_aura.cc index 56f972b..ea5d644 100644 --- a/ui/views/widget/desktop_native_widget_aura.cc +++ b/ui/views/widget/desktop_native_widget_aura.cc @@ -369,6 +369,13 @@ bool DesktopNativeWidgetAura::HasHitTestMask() const { void DesktopNativeWidgetAura::GetHitTestMask(gfx::Path* mask) const { } +scoped_refptr<ui::Texture> DesktopNativeWidgetAura::CopyTexture() { + // The layer we create doesn't have an external texture, so this should never + // get invoked. + NOTREACHED(); + return scoped_refptr<ui::Texture>(); +} + //////////////////////////////////////////////////////////////////////////////// // DesktopNativeWidgetAura, ui::EventHandler implementation: diff --git a/ui/views/widget/desktop_native_widget_aura.h b/ui/views/widget/desktop_native_widget_aura.h index 9b79296..e24ad92 100644 --- a/ui/views/widget/desktop_native_widget_aura.h +++ b/ui/views/widget/desktop_native_widget_aura.h @@ -127,6 +127,7 @@ class VIEWS_EXPORT DesktopNativeWidgetAura virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE; virtual bool HasHitTestMask() const OVERRIDE; virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; + virtual scoped_refptr<ui::Texture> CopyTexture() OVERRIDE; // Overridden from ui::EventHandler: virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE; diff --git a/ui/views/widget/native_widget_aura.cc b/ui/views/widget/native_widget_aura.cc index a90db1f..6bb1cf2 100644 --- a/ui/views/widget/native_widget_aura.cc +++ b/ui/views/widget/native_widget_aura.cc @@ -832,6 +832,13 @@ void NativeWidgetAura::GetHitTestMask(gfx::Path* mask) const { delegate_->GetHitTestMask(mask); } +scoped_refptr<ui::Texture> NativeWidgetAura::CopyTexture() { + // The layer we create doesn't have an external texture, so this should never + // get invoked. + NOTREACHED(); + return scoped_refptr<ui::Texture>(); +} + //////////////////////////////////////////////////////////////////////////////// // NativeWidgetAura, ui::EventHandler implementation: diff --git a/ui/views/widget/native_widget_aura.h b/ui/views/widget/native_widget_aura.h index 7aa9bd37f..2d1934e 100644 --- a/ui/views/widget/native_widget_aura.h +++ b/ui/views/widget/native_widget_aura.h @@ -149,6 +149,7 @@ class VIEWS_EXPORT NativeWidgetAura : public internal::NativeWidgetPrivate, virtual void OnWindowTargetVisibilityChanged(bool visible) OVERRIDE; virtual bool HasHitTestMask() const OVERRIDE; virtual void GetHitTestMask(gfx::Path* mask) const OVERRIDE; + virtual scoped_refptr<ui::Texture> CopyTexture() OVERRIDE; // Overridden from ui::EventHandler: virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |