summaryrefslogtreecommitdiff
path: root/decorations
diff options
authorEleni Maria Stea <elenimaria.stea@canonical.com>2016-02-01 01:29:06 +0200
committerEleni Maria Stea <elenimaria.stea@canonical.com>2016-02-01 01:29:06 +0200
commitd42ef6b4e5db3673ae21b2d982d069e487e1b805 (patch)
tree674055fd5dac7e2e841baff87205ef0b8872e5a9 /decorations
parentdf8e9e7a8c1565c999a1f0a16ac807fda9b33def (diff)
used larger textures because CairoGraphics::BlurSurface uses exponential
blur with infinite area and so the shadow textures don't fit the windows (bzr r4067.7.8)
Diffstat (limited to 'decorations')
-rw-r--r--decorations/DecoratedWindow.cpp6
-rw-r--r--decorations/DecorationsManager.cpp10
2 files changed, 11 insertions, 5 deletions
diff --git a/decorations/DecoratedWindow.cpp b/decorations/DecoratedWindow.cpp
index 587230d40..870a9b793 100644
--- a/decorations/DecoratedWindow.cpp
+++ b/decorations/DecoratedWindow.cpp
@@ -649,8 +649,10 @@ void Window::Impl::ComputeShapedShadowQuad()
CompRect border = win_->borderRect();
nux::Point2D<int> shadow_offset = manager_->shadow_offset();
- int x = border.x() + shadow_offset.x - ShadowRadius() * 2;
- int y = border.y() + shadow_offset.y - ShadowRadius() * 2;
+// ideally it would be -radius for the *2 part see comment in Manager::Impl::BuildShapedShadowTexture
+// in DecorationsManager.cpp Make sure to keep these factors in sync.
+ int x = border.x() + shadow_offset.x - radius * 2;
+ int y = border.y() + shadow_offset.y - radius * 2;
int width = texture->width();
int height = texture->height();
diff --git a/decorations/DecorationsManager.cpp b/decorations/DecorationsManager.cpp
index 521f9c127..281c2ffa3 100644
--- a/decorations/DecorationsManager.cpp
+++ b/decorations/DecorationsManager.cpp
@@ -91,14 +91,18 @@ cu::PixmapTexture::Ptr Manager::Impl::BuildShadowTexture(unsigned radius, nux::C
}
cu::PixmapTexture::Ptr Manager::Impl::BuildShapedShadowTexture(unsigned int radius, nux::Color const& color, DecorationsShape const& shape) {
- int img_width = shape.getWidth() + radius * 2;
- int img_height = shape.getHeight() + radius * 2;
+ //Ideally it would be shape.getWidth + radius * 2 but Cairographics::BlurSurface isn't bounded by the radius
+ //and we need to compensate by using a larger texture. Make sure to modify Window::Impl::ComputeShapedShadowQuad in
+ //DecoratedWindow.cpp if you change the factor.
+ int blur_margin_factor = 2;
+ int img_width = shape.getWidth() + radius * 2 * blur_margin_factor;
+ int img_height = shape.getHeight() + radius * 2 * blur_margin_factor;
nux::CairoGraphics img(CAIRO_FORMAT_ARGB32, img_width, img_height);
auto* img_ctx = img.GetInternalContext();
for (int i=0; i<shape.getRectangleCount(); i++) {
XRectangle rect = shape.getRectangle(i);
- cairo_rectangle(img_ctx, rect.x + radius * 2, rect.y + radius * 2, rect.width, rect.height);
+ cairo_rectangle(img_ctx, rect.x + radius * blur_margin_factor, rect.y + radius * blur_margin_factor, rect.width, rect.height);
cairo_set_source_rgba(img_ctx, color.red, color.green, color.blue, color.alpha);
cairo_fill(img_ctx);
}