In views desktop, it is possible for child layers to intersect. (This situation occurs when the omnibox is open)
Refactored logic for hole such that the hole does not overlap immediate child layers which cannot have a hole.
Review URL: http://codereview.chromium.org/7976040
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103305 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ui/gfx/compositor/layer.h b/ui/gfx/compositor/layer.h
index 97f6909..625067a 100644
--- a/ui/gfx/compositor/layer.h
+++ b/ui/gfx/compositor/layer.h
@@ -140,23 +140,7 @@
// repaint.
void SchedulePaint(const gfx::Rect& invalid_rect);
- // Draws the layer with hole if hole is non empty.
- // hole looks like:
- //
- // layer____________________________
- // |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
- // |xxxxxxxxxxxxx top xxxxxxxxxxxxxx|
- // |________________________________|
- // |xxxxx| |xxxxx|
- // |xxxxx| Hole Rect |xxxxx|
- // |left | (not composited) |right|
- // |_____|____________________|_____|
- // |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
- // |xxxxxxxxxx bottom xxxxxxxxxxxxxx|
- // |________________________________|
- //
- // Legend:
- // composited area: x
+ // Does drawing for the layer.
void Draw();
// Draws a tree of Layers, by calling Draw() on each in the hierarchy starting
@@ -174,10 +158,6 @@
// use the combined result, but this is only temporary.
float GetCombinedOpacity() const;
- // calls Texture::Draw only if the region to be drawn is non empty
- void DrawRegion(const ui::TextureDrawParams& params,
- const gfx::Rect& region_to_draw);
-
// Called during the Draw() pass to freshen the Layer's contents from the
// delegate.
void UpdateLayerCanvas();
@@ -191,6 +171,28 @@
// view has no transform with respect to its parent.
void RecomputeHole();
+ // Returns true if the layer paints every pixel (fills_bounds_opaquely)
+ // and the alpha of the layer is 1.0f.
+ bool IsCompletelyOpaque() const;
+
+ // Determines the regions that don't intersect |rect| and places the
+ // result in |sides|.
+ //
+ // rect_____________________________
+ // |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
+ // |xxxxxxxxxxxxx top xxxxxxxxxxxxxx|
+ // |________________________________|
+ // |xxxxx| |xxxxx|
+ // |xxxxx|region_to_punch_out |xxxxx|
+ // |left | |right|
+ // |_____|____________________|_____|
+ // |xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx|
+ // |xxxxxxxxxx bottom xxxxxxxxxxxxxx|
+ // |________________________________|
+ static void PunchHole(const gfx::Rect& rect,
+ const gfx::Rect& region_to_punch_out,
+ std::vector<gfx::Rect>* sides);
+
// Drop all textures for layers below and including this one. Called when
// the layer is removed from a hierarchy. Textures will be re-generated if
// the layer is subsequently re-attached and needs to be drawn.