fix window icon rendering, was using incorrect size.
This commit is contained in:
parent
02c7f2e8af
commit
a081582e3a
3 changed files with 25 additions and 16 deletions
|
@ -2,14 +2,20 @@
|
|||
#include "../kernel/geom.h"
|
||||
#include "image.h"
|
||||
|
||||
void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position)
|
||||
void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position,
|
||||
Rect *surarea)
|
||||
{
|
||||
unsigned long *draw = rgba->data;
|
||||
int c, sfw, sfh;
|
||||
unsigned int i, e, bgi;
|
||||
unsigned int i, e;
|
||||
sfw = position->width;
|
||||
sfh = position->height;
|
||||
|
||||
/* it would be nice if this worked, but this function is well broken in these
|
||||
cercumstances. */
|
||||
g_assert(position->width == surarea->width &&
|
||||
position->height == surarea->height);
|
||||
|
||||
g_assert(rgba->data != NULL);
|
||||
|
||||
if ((rgba->width != sfw || rgba->height != sfh) &&
|
||||
|
@ -42,7 +48,7 @@ void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position)
|
|||
draw = rgba->cache;
|
||||
|
||||
/* apply the alpha channel */
|
||||
for (i = 0, c = 0, e = sfw*sfh; i < e; ++i, ++bgi) {
|
||||
for (i = 0, c = 0, e = sfw*sfh; i < e; ++i) {
|
||||
unsigned char alpha = draw[i] >> 24;
|
||||
unsigned char r = draw[i] >> 16;
|
||||
unsigned char g = draw[i] >> 8;
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "render.h"
|
||||
#include "../kernel/geom.h"
|
||||
|
||||
void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position);
|
||||
void image_draw(pixel32 *target, TextureRGBA *rgba, Rect *position,
|
||||
Rect *surarea);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -233,20 +233,22 @@ void x_paint(Window win, Appearance *l)
|
|||
|
||||
for (i = 0; i < l->textures; i++) {
|
||||
tarea = l->texture[i].position;
|
||||
if (l->surface.data.planar.relief != Flat) {
|
||||
switch (l->surface.data.planar.bevel) {
|
||||
case Bevel1:
|
||||
if (l->surface.data.planar.grad != Background_ParentRelative) {
|
||||
if (l->surface.data.planar.relief != Flat) {
|
||||
switch (l->surface.data.planar.bevel) {
|
||||
case Bevel1:
|
||||
tarea.x += 1; tarea.y += 1;
|
||||
tarea.width -= 2; tarea.height -= 2;
|
||||
break;
|
||||
case Bevel2:
|
||||
tarea.x += 2; tarea.y += 2;
|
||||
tarea.width -= 4; tarea.height -= 4;
|
||||
break;
|
||||
}
|
||||
} else if (l->surface.data.planar.border) {
|
||||
tarea.x += 1; tarea.y += 1;
|
||||
tarea.width -= 2; tarea.height -= 2;
|
||||
break;
|
||||
case Bevel2:
|
||||
tarea.x += 2; tarea.y += 2;
|
||||
tarea.width -= 4; tarea.height -= 4;
|
||||
break;
|
||||
}
|
||||
} else if (l->surface.data.planar.border) {
|
||||
tarea.x += 1; tarea.y += 1;
|
||||
tarea.width -= 2; tarea.height -= 2;
|
||||
}
|
||||
|
||||
switch (l->texture[i].type) {
|
||||
|
@ -279,7 +281,7 @@ void x_paint(Window win, Appearance *l)
|
|||
case RGBA:
|
||||
image_draw(l->surface.data.planar.pixel_data,
|
||||
&l->texture[i].data.rgba,
|
||||
&tarea);
|
||||
&tarea, &l->area);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue