summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2009-12-11 19:02:11 -0500
committerDana Jansens <danakj@orodu.net>2009-12-11 19:02:11 -0500
commitacafa38c8ea210b12ed92fc16281b915ab61542c (patch)
treece4c7d2a4a9b3478a4d48af2c54ada06593ed022 /render
parent2f09e0ce388f63c341cb328d795766e2bd0dc24b (diff)
parent9ba2b04e96449fea5b6bd212aa3d431638754bdd (diff)
Merge branch 'backport' into work
Conflicts: openbox/config.c openbox/event.c openbox/prop.c openbox/prop.h openbox/screen.c openbox/screen.h
Diffstat (limited to 'render')
-rw-r--r--render/image.c18
-rw-r--r--render/render.c20
2 files changed, 23 insertions, 15 deletions
diff --git a/render/image.c b/render/image.c
index fc30714e..79f47fe2 100644
--- a/render/image.c
+++ b/render/image.c
@@ -221,7 +221,7 @@ static RrImagePic* ResizeImage(RrPixel32 *src,
return pic;
}
-/*! This drawns an RGBA picture into the target, within the rectangle specified
+/*! This draws an RGBA picture into the target, within the rectangle specified
by the area parameter. If the area's size differs from the source's then it
will be centered within the rectangle */
void DrawRGBA(RrPixel32 *target, gint target_w, gint target_h,
@@ -405,11 +405,13 @@ void RrImageDrawImage(RrPixel32 *target, RrTextureImage *img,
pic = NULL;
free_pic = FALSE;
- /* is there an original of this size? (only w or h has to be right cuz
- we maintain aspect ratios) */
+ /* is there an original of this size? (only the larger of
+ w or h has to be right cuz we maintain aspect ratios) */
for (i = 0; i < self->n_original; ++i)
- if (self->original[i]->width == area->width ||
- self->original[i]->height == area->height)
+ if ((self->original[i]->width >= self->original[i]->height &&
+ self->original[i]->width == area->width) ||
+ (self->original[i]->width <= self->original[i]->height &&
+ self->original[i]->height == area->height))
{
pic = self->original[i];
break;
@@ -417,8 +419,10 @@ void RrImageDrawImage(RrPixel32 *target, RrTextureImage *img,
/* is there a resize of this size? */
for (i = 0; i < self->n_resized; ++i)
- if (self->resized[i]->width == area->width ||
- self->resized[i]->height == area->height)
+ if ((self->resized[i]->width >= self->resized[i]->height &&
+ self->resized[i]->width == area->width) ||
+ (self->resized[i]->width <= self->resized[i]->height &&
+ self->resized[i]->height == area->height))
{
gint j;
RrImagePic *saved;
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,