diff options
| author | Daniel van Vugt <daniel.van.vugt@canonical.com> | 2012-10-10 10:14:38 +0000 |
|---|---|---|
| committer | Tarmac <> | 2012-10-10 10:14:38 +0000 |
| commit | 69ce17c7b0e312b7e4d846660de0320430a57736 (patch) | |
| tree | 80e08d8768db3a708cbee952b91e6517fa5d09ea /plugins/unityshell/src | |
| parent | b9088178658c40e3ff4c5042cede761fad140e83 (diff) | |
| parent | 23023306c1ecaba2bafea59ed5bd1651975f7143 (diff) | |
Draw the panel shadow only within the redraw region. Using a bounding box
allowed parts to get redrawn when they should not, appearing as small chunks of extra-dark panel shadow. (LP: #1057528). Fixes: https://bugs.launchpad.net/bugs/1057528. Approved by Łukasz Zemczak, Marco Trevisan (Treviño). (bzr r2818)
Diffstat (limited to 'plugins/unityshell/src')
| -rw-r--r-- | plugins/unityshell/src/unityshell.cpp | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/plugins/unityshell/src/unityshell.cpp b/plugins/unityshell/src/unityshell.cpp index 01f40c744..571c8f82a 100644 --- a/plugins/unityshell/src/unityshell.cpp +++ b/plugins/unityshell/src/unityshell.cpp @@ -560,6 +560,9 @@ void UnityScreen::setPanelShadowMatrix(const GLMatrix& matrix) void UnityScreen::paintPanelShadow(const CompRegion& clip) { + if (panel_controller_->opacity() == 0.0f) + return; + if (sources_.GetSource(local::RELAYOUT_TIMEOUT)) return; @@ -585,22 +588,6 @@ void UnityScreen::paintPanelShadow(const CompRegion& clip) if (redraw.isEmpty()) return; - const CompRect& bounds(redraw.boundingRect()); - - // Sub-rectangle of the shadow needing redrawing: - float x1 = bounds.x1(); - float y1 = bounds.y1(); - float x2 = bounds.x2(); - float y2 = bounds.y2(); - - // Texture coordinates of the above rectangle: - float tx1 = (x1 - shadowX) / shadowWidth; - float ty1 = (y1 - shadowY) / shadowHeight; - float tx2 = (x2 - shadowX) / shadowWidth; - float ty2 = (y2 - shadowY) / shadowHeight; - - nuxPrologue(); - // compiz doesn't use the same method of tracking monitors as our toolkit // we need to make sure we properly associate with the right monitor int current_monitor = -1; @@ -616,8 +603,14 @@ void UnityScreen::paintPanelShadow(const CompRegion& clip) i++; } - if (!(launcher_controller_->IsOverlayOpen() && current_monitor == overlay_monitor_) - && panel_controller_->opacity() > 0.0f) + if (launcher_controller_->IsOverlayOpen() && current_monitor == overlay_monitor_) + return; + + nuxPrologue(); + + const CompRect::vector& rects = redraw.rects(); + + for (auto const& r : rects) { foreach(GLTexture * tex, _shadow_texture) { @@ -639,6 +632,18 @@ void UnityScreen::paintPanelShadow(const CompRegion& clip) (GLushort)(panel_controller_->opacity() * 0xFFFF) }; + // Sub-rectangle of the shadow needing redrawing: + float x1 = r.x1(); + float y1 = r.y1(); + float x2 = r.x2(); + float y2 = r.y2(); + + // Texture coordinates of the above rectangle: + float tx1 = (x1 - shadowX) / shadowWidth; + float ty1 = (y1 - shadowY) / shadowHeight; + float tx2 = (x2 - shadowX) / shadowWidth; + float ty2 = (y2 - shadowY) / shadowHeight; + vertexData = { x1, y1, 0, x1, y2, 0, |
