summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorluken@chromium.org <luken@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-25 05:59:08 +0000
committerluken@chromium.org <luken@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-25 05:59:08 +0000
commit1d96e0315b34e2d0668f71ae01f0d3382710df8a (patch)
treef511562669f0aade538e7ed463ad94ede2531ee7 /ui
parentce6a63f6fcdb00aa7931958668283ed86c285f76 (diff)
downloadchromium_src-1d96e0315b34e2d0668f71ae01f0d3382710df8a.zip
chromium_src-1d96e0315b34e2d0668f71ae01f0d3382710df8a.tar.gz
chromium_src-1d96e0315b34e2d0668f71ae01f0d3382710df8a.tar.bz2
plumbing fills_bounds_completely from aura to content_layer_updater
BUG=313494 Review URL: https://codereview.chromium.org/191453002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259160 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/aura/window.cc5
-rw-r--r--ui/aura/window.h3
-rw-r--r--ui/compositor/clone_layer.cc1
-rw-r--r--ui/compositor/layer.cc8
-rw-r--r--ui/compositor/layer.h6
-rw-r--r--ui/views/widget/desktop_aura/desktop_native_widget_aura.cc4
6 files changed, 27 insertions, 0 deletions
diff --git a/ui/aura/window.cc b/ui/aura/window.cc
index 63fe91f..9201123 100644
--- a/ui/aura/window.cc
+++ b/ui/aura/window.cc
@@ -301,6 +301,11 @@ void Window::SetTransparent(bool transparent) {
layer()->SetFillsBoundsOpaquely(!transparent_);
}
+void Window::SetFillsBoundsCompletely(bool fills_bounds) {
+ if (layer())
+ layer()->SetFillsBoundsCompletely(fills_bounds);
+}
+
Window* Window::GetRootWindow() {
return const_cast<Window*>(
static_cast<const Window*>(this)->GetRootWindow());
diff --git a/ui/aura/window.h b/ui/aura/window.h
index 342503f..f456687 100644
--- a/ui/aura/window.h
+++ b/ui/aura/window.h
@@ -101,6 +101,9 @@ class AURA_EXPORT Window : public ui::LayerDelegate,
bool transparent() const { return transparent_; }
void SetTransparent(bool transparent);
+ // See description in Layer::SetFillsBoundsCompletely.
+ void SetFillsBoundsCompletely(bool fills_bounds);
+
WindowDelegate* delegate() { return delegate_; }
const WindowDelegate* delegate() const { return delegate_; }
diff --git a/ui/compositor/clone_layer.cc b/ui/compositor/clone_layer.cc
index f1337b0c..f49460f 100644
--- a/ui/compositor/clone_layer.cc
+++ b/ui/compositor/clone_layer.cc
@@ -27,6 +27,7 @@ scoped_ptr<ui::Layer> CloneLayer(LayerOwner* layer_owner) {
new_layer->SetMasksToBounds(old_layer->GetMasksToBounds());
new_layer->set_name(old_layer->name());
new_layer->SetFillsBoundsOpaquely(old_layer->fills_bounds_opaquely());
+ new_layer->SetFillsBoundsCompletely(old_layer->FillsBoundsCompletely());
// Install new layer as a sibling of the old layer, stacked below it.
if (old_layer->parent()) {
diff --git a/ui/compositor/layer.cc b/ui/compositor/layer.cc
index f4c735b..1637d5e 100644
--- a/ui/compositor/layer.cc
+++ b/ui/compositor/layer.cc
@@ -61,6 +61,7 @@ Layer::Layer()
visible_(true),
force_render_surface_(false),
fills_bounds_opaquely_(true),
+ fills_bounds_completely_(false),
background_blur_radius_(0),
layer_saturation_(0.0f),
layer_brightness_(0.0f),
@@ -85,6 +86,7 @@ Layer::Layer(LayerType type)
visible_(true),
force_render_surface_(false),
fills_bounds_opaquely_(true),
+ fills_bounds_completely_(false),
background_blur_radius_(0),
layer_saturation_(0.0f),
layer_brightness_(0.0f),
@@ -444,6 +446,10 @@ void Layer::SetFillsBoundsOpaquely(bool fills_bounds_opaquely) {
cc_layer_->SetContentsOpaque(fills_bounds_opaquely);
}
+void Layer::SetFillsBoundsCompletely(bool fills_bounds_completely) {
+ fills_bounds_completely_ = fills_bounds_completely;
+}
+
void Layer::SwitchToLayer(scoped_refptr<cc::Layer> new_layer) {
// Finish animations being handled by cc_layer_.
if (animator_.get()) {
@@ -662,6 +668,8 @@ void Layer::PaintContents(SkCanvas* sk_canvas,
canvas->Restore();
}
+bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; }
+
unsigned Layer::PrepareTexture() {
DCHECK(texture_layer_.get());
return texture_->PrepareTexture();
diff --git a/ui/compositor/layer.h b/ui/compositor/layer.h
index 209e99e..ed805bf 100644
--- a/ui/compositor/layer.h
+++ b/ui/compositor/layer.h
@@ -249,6 +249,10 @@ class COMPOSITOR_EXPORT Layer
void SetFillsBoundsOpaquely(bool fills_bounds_opaquely);
bool fills_bounds_opaquely() const { return fills_bounds_opaquely_; }
+ // Set to true if this layer always paints completely within its bounds. If so
+ // we can omit an unnecessary clear, even if the layer is transparent.
+ void SetFillsBoundsCompletely(bool fills_bounds_completely);
+
const std::string& name() const { return name_; }
void set_name(const std::string& name) { name_ = name; }
@@ -318,6 +322,7 @@ class COMPOSITOR_EXPORT Layer
virtual void PaintContents(
SkCanvas* canvas, const gfx::Rect& clip, gfx::RectF* opaque) OVERRIDE;
virtual void DidChangeLayerCanUseLCDText() OVERRIDE {}
+ virtual bool FillsBoundsCompletely() const OVERRIDE;
cc::Layer* cc_layer() { return cc_layer_; }
@@ -424,6 +429,7 @@ class COMPOSITOR_EXPORT Layer
bool force_render_surface_;
bool fills_bounds_opaquely_;
+ bool fills_bounds_completely_;
// Union of damaged rects, in pixel coordinates, to be used when
// compositor is ready to paint the content.
diff --git a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
index c14d1ce..e619661 100644
--- a/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ b/ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -1182,6 +1182,10 @@ void DesktopNativeWidgetAura::InstallInputMethodEventFilter() {
void DesktopNativeWidgetAura::UpdateWindowTransparency() {
content_window_->SetTransparent(
desktop_window_tree_host_->ShouldWindowContentsBeTransparent());
+ // Regardless of transparency or not, this root content window will always
+ // fill its bounds completely, so set this flag to true to avoid an
+ // unecessary clear before update.
+ content_window_->SetFillsBoundsCompletely(true);
}
void DesktopNativeWidgetAura::RootWindowDestroyed() {