Ensure textures have the correct size bevor applying 'bevel'
Mathias Gumz akira at fluxbox dot org
1 files changed,
8 insertions(+),
7 deletions(-)
jump to
M
src/FbTk/TextureRender.cc
→
src/FbTk/TextureRender.cc
@@ -779,25 +779,26 @@ pixmap.fillRectangle(gc.gc(), 0, 0, width, height);
if (texture.type() & Texture::INTERLACED) { lgc.setForeground(texture.colorTo()); - register unsigned int i = 0; - for (; i < height; i += 2) + unsigned int i; + for (i = 0; i < height; i += 2) pixmap.drawLine(lgc.gc(), 0, i, width - 1, i); } lgc.setForeground(texture.loColor()); - if (texture.type() & Texture::BEVEL1) { + + if (height > 1 && width > 1 && texture.type() & Texture::BEVEL1) { if (texture.type() & Texture::RAISED) { - drawBevelRectangle(pixmap, lgc.gc(), hgc.gc(), 0, height - 1, width -1 , 0); + drawBevelRectangle(pixmap, lgc.gc(), hgc.gc(), 0, height - 1, width - 1, 0); } else if (texture.type() & Texture::SUNKEN) { drawBevelRectangle(pixmap, hgc.gc(), lgc.gc(), 0, height - 1, width - 1, 0); } - } else if (texture.type() & Texture::BEVEL2) { + } else if (width > 2 && height > 2 && texture.type() & Texture::BEVEL2) { if (texture.type() & Texture::RAISED) { - drawBevelRectangle(pixmap, lgc.gc(), hgc.gc(), 1, height - 3, width - 3, 1); + drawBevelRectangle(pixmap, lgc.gc(), hgc.gc(), 1, height - 2, width - 2, 1); } else if (texture.type() & Texture::SUNKEN) { - drawBevelRectangle(pixmap, hgc.gc(), lgc.gc(), 1, height - 3, width - 3, 1); + drawBevelRectangle(pixmap, hgc.gc(), lgc.gc(), 1, height - 2, width - 2, 1); } }