summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dw/style.cc11
-rw-r--r--dw/style.hh10
2 files changed, 14 insertions, 7 deletions
diff --git a/dw/style.cc b/dw/style.cc
index 3b57ffcf..685c3980 100644
--- a/dw/style.cc
+++ b/dw/style.cc
@@ -490,6 +490,11 @@ void StyleImage::StyleImgRenderer::setBuffer (core::Imgbuf *buffer, bool resize)
// another image buffer, the "tiled" image buffer, which is
// larger (the "optimal" size is defined as OPT_BG_IMG_W *
// OPT_BG_IMG_H) and contains the "source" buffer several times.
+ //
+ // This "tiled" buffer is not used when 'background-repeat' has
+ // another value than 'repeat', for obvious reasons. Image
+ // buffers only "tiled" in one dimension (to optimize 'repeat-x'
+ // and 'repeat-y') are not supported.
if (image->imgbufSrc->getRootWidth() * image->imgbufSrc->getRootHeight()
< MIN_BG_IMG_W * MIN_BG_IMG_H) {
@@ -1219,11 +1224,11 @@ void drawBackgroundImage (View *view, StyleImage *backgroundImage,
int imgWidthS = imgbufS->getRootWidth ();
int imgHeightS = imgbufS->getRootHeight ();
- Imgbuf *imgbufT = backgroundImage->getImgbufTiled();
+ Imgbuf *imgbufT = backgroundImage->getImgbufTiled(repeatX, repeatY);
int imgWidthT = imgbufT->getRootWidth ();
int imgHeightT = imgbufT->getRootHeight ();
- int tilesX = backgroundImage->getTilesX ();
- int tilesY = backgroundImage->getTilesY ();
+ int tilesX = backgroundImage->getTilesX (repeatX, repeatY);
+ int tilesY = backgroundImage->getTilesY (repeatX, repeatY);
for (int tileX = tileX1; tileX <= tileX2; tileX += tilesX)
for (int tileY = tileY1; tileY <= tileY2; tileY += tilesY) {
diff --git a/dw/style.hh b/dw/style.hh
index ce8e2e6f..089cf59b 100644
--- a/dw/style.hh
+++ b/dw/style.hh
@@ -827,10 +827,12 @@ public:
{ if (--refCount == 0) delete this; }
inline Imgbuf *getImgbufSrc () { return imgbufSrc; }
- inline Imgbuf *getImgbufTiled ()
- { return imgbufTiled ? imgbufTiled : imgbufSrc; }
- inline int getTilesX () { return imgbufTiled ? tilesX : 1; }
- inline int getTilesY () { return imgbufTiled ? tilesY : 1; }
+ inline Imgbuf *getImgbufTiled (bool repeatX, bool repeatY)
+ { return (imgbufTiled && repeatX && repeatY) ? imgbufTiled : imgbufSrc; }
+ inline int getTilesX (bool repeatX, bool repeatY)
+ { return (imgbufTiled && repeatX && repeatY) ? tilesX : 1; }
+ inline int getTilesY (bool repeatX, bool repeatY)
+ { return (imgbufTiled && repeatX && repeatY) ? tilesY : 1; }
inline ImgRenderer *getMainImgRenderer () { return imgRendererDist; }
/**