diff options
| author | Dana Jansens <danakj@orodu.net> | 2009-12-09 13:47:38 -0500 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2009-12-09 15:08:30 -0500 |
| commit | 437739b6a3399765747b09b0777b1db9d0e6b483 (patch) | |
| tree | d1b1a8692e7880c91248dc954c35417db0e58b12 | |
| parent | 324ba15ebc79eb95cf6ec9c0f7d42250fc30f11b (diff) | |
Fix for rendering RGBA and Image textures.
RGBA and Image textures could exceed their tarea if given an x or y offset
inside the area that is > 0.
| -rw-r--r-- | render/render.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/render/render.c b/render/render.c index 7c00c146..20002e32 100644 --- a/render/render.c +++ b/render/render.c @@ -135,12 +135,14 @@ Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h) { RrRect narea = tarea; RrTextureImage *img = &a->texture[i].data.image; - if (img->twidth) - narea.width = MIN(tarea.width, img->twidth); - if (img->theight) - narea.height = MIN(tarea.height, img->theight); narea.x += img->tx; + narea.width -= img->tx; narea.y += img->ty; + narea.height -= img->ty; + if (img->twidth) + narea.width = MIN(narea.width, img->twidth); + if (img->theight) + narea.height = MIN(narea.height, img->theight); RrImageDrawImage(a->surface.pixel_data, &a->texture[i].data.image, a->w, a->h, @@ -153,12 +155,14 @@ Pixmap RrPaintPixmap(RrAppearance *a, gint w, gint h) { RrRect narea = tarea; RrTextureRGBA *rgb = &a->texture[i].data.rgba; - if (rgb->twidth) - narea.width = MIN(tarea.width, rgb->twidth); - if (rgb->theight) - narea.height = MIN(tarea.height, rgb->theight); narea.x += rgb->tx; + narea.width -= rgb->tx; narea.y += rgb->ty; + narea.height -= rgb->ty; + if (rgb->twidth) + narea.width = MIN(narea.width, rgb->twidth); + if (rgb->theight) + narea.height = MIN(narea.height, rgb->theight); RrImageDrawRGBA(a->surface.pixel_data, &a->texture[i].data.rgba, a->w, a->h, |
