Various anti-alias fixups after recent changes.
SVN revision: 29439
This commit is contained in:
parent
6b8e7b18f6
commit
09cbba40d4
|
@ -657,7 +657,8 @@ BackgroundRealize(Background * bg, Win win, Drawable draw, unsigned int rw,
|
|||
{
|
||||
/* Window, no fg, no offset, and scale to 100%, or tiled, no trans */
|
||||
pmap = BackgroundCreatePixmap(win, w, h);
|
||||
EImageRenderOnDrawable(bg->bg.im, win, pmap, 0, 0, 0, w, h);
|
||||
EImageRenderOnDrawable(bg->bg.im, win, pmap, EIMAGE_ANTI_ALIAS,
|
||||
0, 0, w, h);
|
||||
|
||||
#if 0 /* FIXME - Remove? */
|
||||
if (x == 0 && y == 0) /* Hmmm. Always true. */
|
||||
|
@ -707,7 +708,8 @@ BackgroundRealize(Background * bg, Win win, Drawable draw, unsigned int rw,
|
|||
else
|
||||
{
|
||||
EImageGetSize(bg->bg.im, &ww, &hh);
|
||||
EImageBlend(im, bg->bg.im, 0, 0, 0, ww, hh, x, y, w, h, 1, 0);
|
||||
EImageBlend(im, bg->bg.im, EIMAGE_ANTI_ALIAS, 0, 0, ww, hh,
|
||||
x, y, w, h, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -720,10 +722,11 @@ BackgroundRealize(Background * bg, Win win, Drawable draw, unsigned int rw,
|
|||
x = ((rw - w) * bg->top.xjust) >> 10;
|
||||
y = ((rh - h) * bg->top.yjust) >> 10;
|
||||
|
||||
EImageBlend(im, bg->top.im, 1, 0, 0, ww, hh, x, y, w, h, 0, 0);
|
||||
EImageBlend(im, bg->top.im, EIMAGE_BLEND | EIMAGE_ANTI_ALIAS,
|
||||
0, 0, ww, hh, x, y, w, h, 0);
|
||||
}
|
||||
|
||||
EImageRenderOnDrawable(im, win, pmap, 0, 0, 0, rw, rh);
|
||||
EImageRenderOnDrawable(im, win, pmap, EIMAGE_ANTI_ALIAS, 0, 0, rw, rh);
|
||||
if (im != bg->bg.im)
|
||||
EImageFree(im);
|
||||
|
||||
|
|
|
@ -1156,8 +1156,8 @@ ContainerDraw(Container * ct)
|
|||
if (ct->draw_icon_base && ct->im_item_base)
|
||||
{
|
||||
EImageGetSize(ct->im_item_base, &ww, &hh);
|
||||
EImageBlend(im, ct->im_item_base, 1, 0, 0, ww, hh,
|
||||
cto->xo, cto->yo, cto->wo, cto->ho, 1, 0);
|
||||
EImageBlend(im, ct->im_item_base, EIMAGE_BLEND | EIMAGE_ANTI_ALIAS,
|
||||
0, 0, ww, hh, cto->xo, cto->yo, cto->wo, cto->ho, 1);
|
||||
}
|
||||
|
||||
ct->ops->ObjPlace(ct, cto, im);
|
||||
|
|
|
@ -446,7 +446,8 @@ DialogDrawButton(Dialog * d __UNUSED__, DButton * db)
|
|||
db->w - (h + 2 + pad->left + pad->right),
|
||||
h, h, TextclassGetJustification(db->tclass));
|
||||
|
||||
EImageRenderOnDrawable(im, db->win, None, EIMAGE_BLEND,
|
||||
EImageRenderOnDrawable(im, db->win, None,
|
||||
EIMAGE_BLEND | EIMAGE_ANTI_ALIAS,
|
||||
pad->left, pad->top, h, h);
|
||||
EImageFree(im);
|
||||
}
|
||||
|
|
55
src/eimage.c
55
src/eimage.c
|
@ -53,6 +53,20 @@ EImageInit(Display * dpy)
|
|||
imlib_context_set_dither(1);
|
||||
}
|
||||
|
||||
static void
|
||||
_EImageFlagsSet(int flags)
|
||||
{
|
||||
imlib_context_set_anti_alias((flags & EIMAGE_ANTI_ALIAS) ? 1 : 0);
|
||||
imlib_context_set_blend((flags & EIMAGE_BLEND) ? 1 : 0);
|
||||
}
|
||||
|
||||
static void
|
||||
_EImageFlagsReset(void)
|
||||
{
|
||||
imlib_context_set_anti_alias(0);
|
||||
imlib_context_set_blend(0);
|
||||
}
|
||||
|
||||
EImage *
|
||||
EImageLoad(const char *file)
|
||||
{
|
||||
|
@ -208,21 +222,17 @@ EImageOrientate(EImage * im, int orientation)
|
|||
}
|
||||
|
||||
void
|
||||
EImageBlend(EImage * im, EImage * src, int blend,
|
||||
EImageBlend(EImage * im, EImage * src, int flags,
|
||||
int sx, int sy, int sw, int sh,
|
||||
int dx, int dy, int dw, int dh, int merge_alpha, int anti_alias)
|
||||
int dx, int dy, int dw, int dh, int merge_alpha)
|
||||
{
|
||||
imlib_context_set_image(im);
|
||||
if (anti_alias)
|
||||
imlib_context_set_anti_alias(1);
|
||||
if (blend)
|
||||
imlib_context_set_blend(1);
|
||||
if (flags)
|
||||
_EImageFlagsSet(flags);
|
||||
imlib_blend_image_onto_image(src, merge_alpha, sx, sy, sw, sh,
|
||||
dx, dy, dw, dh);
|
||||
if (blend)
|
||||
imlib_context_set_blend(0);
|
||||
if (anti_alias)
|
||||
imlib_context_set_anti_alias(0);
|
||||
if (flags)
|
||||
_EImageFlagsReset();
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -248,7 +258,7 @@ EImageBlendCM(EImage * im, EImage * src, EImageColorModifier * icm)
|
|||
}
|
||||
|
||||
void
|
||||
EImageTile(EImage * im, EImage * tile, int blend, int tw, int th,
|
||||
EImageTile(EImage * im, EImage * tile, int flags, int tw, int th,
|
||||
int dx, int dy, int dw, int dh, int ox, int oy)
|
||||
{
|
||||
Imlib_Image tim;
|
||||
|
@ -258,6 +268,9 @@ EImageTile(EImage * im, EImage * tile, int blend, int tw, int th,
|
|||
if (tw <= 0 || th <= 0)
|
||||
return;
|
||||
|
||||
if (flags)
|
||||
_EImageFlagsSet(flags);
|
||||
|
||||
imlib_context_set_image(tile);
|
||||
sw = imlib_image_get_width();
|
||||
sh = imlib_image_get_height();
|
||||
|
@ -308,8 +321,7 @@ EImageTile(EImage * im, EImage * tile, int blend, int tw, int th,
|
|||
ww = dw - x;
|
||||
if (ww <= 0)
|
||||
break;
|
||||
imlib_blend_image_onto_image(tim, blend, tx, ty, ww, hh,
|
||||
x, y, ww, hh);
|
||||
imlib_blend_image_onto_image(tim, 0, tx, ty, ww, hh, x, y, ww, hh);
|
||||
tx = 0;
|
||||
x += ww;
|
||||
ww = tw;
|
||||
|
@ -324,6 +336,9 @@ EImageTile(EImage * im, EImage * tile, int blend, int tw, int th,
|
|||
imlib_free_image();
|
||||
imlib_context_set_image(im); /* FIXME - Remove */
|
||||
}
|
||||
|
||||
if (flags)
|
||||
_EImageFlagsReset();
|
||||
}
|
||||
|
||||
EImage *
|
||||
|
@ -364,20 +379,6 @@ EImageGrabDrawableScaled(Win win, Drawable draw, Pixmap mask,
|
|||
return im;
|
||||
}
|
||||
|
||||
static void
|
||||
_EImageFlagsSet(int flags)
|
||||
{
|
||||
imlib_context_set_anti_alias((flags & EIMAGE_ANTI_ALIAS) ? 1 : 0);
|
||||
imlib_context_set_blend((flags & EIMAGE_BLEND) ? 1 : 0);
|
||||
}
|
||||
|
||||
static void
|
||||
_EImageFlagsReset(void)
|
||||
{
|
||||
imlib_context_set_anti_alias(0);
|
||||
imlib_context_set_blend(0);
|
||||
}
|
||||
|
||||
void
|
||||
EImageRenderOnDrawable(EImage * im, Win win, Drawable draw, int flags,
|
||||
int x, int y, int w, int h)
|
||||
|
|
|
@ -63,13 +63,13 @@ void EImageFill(EImage * im, int x, int y, int w, int h, int r,
|
|||
int g, int b, int a);
|
||||
void EImageOrientate(EImage * im, int orientation);
|
||||
|
||||
void EImageBlend(EImage * im, EImage * src, int blend,
|
||||
void EImageBlend(EImage * im, EImage * src, int flags,
|
||||
int sx, int sy, int sw, int sh,
|
||||
int dx, int dy, int dw, int dh,
|
||||
int merge_alpha, int anti_alias);
|
||||
int merge_alpha);
|
||||
void EImageBlendCM(EImage * im, EImage * src,
|
||||
EImageColorModifier * icm);
|
||||
void EImageTile(EImage * im, EImage * tile, int blend, int tw,
|
||||
void EImageTile(EImage * im, EImage * tile, int flags, int tw,
|
||||
int th, int dx, int dy, int dw, int dh, int ox,
|
||||
int oy);
|
||||
|
||||
|
|
|
@ -606,8 +606,8 @@ IconboxObjPlace(Container * ct __UNUSED__, ContainerObject * cto, EImage * im)
|
|||
return;
|
||||
|
||||
EImageGetSize(cto->im, &w, &h);
|
||||
EImageBlend(im, cto->im, 1, 0, 0, w, h,
|
||||
cto->xi, cto->yi, cto->wi, cto->hi, 1, 1);
|
||||
EImageBlend(im, cto->im, EIMAGE_BLEND | EIMAGE_ANTI_ALIAS, 0, 0, w, h,
|
||||
cto->xi, cto->yi, cto->wi, cto->hi, 1);
|
||||
}
|
||||
|
||||
extern const ContainerOps IconboxOps;
|
||||
|
|
|
@ -236,7 +236,8 @@ WarpFocusWinPaint(WarpFocusWin * fw)
|
|||
Conf.warplist.icon_mode);
|
||||
if (im)
|
||||
{
|
||||
EImageRenderOnDrawable(im, wi->win, None, EIMAGE_BLEND,
|
||||
EImageRenderOnDrawable(im, wi->win, None,
|
||||
EIMAGE_BLEND | EIMAGE_ANTI_ALIAS,
|
||||
pad->left + ICON_PAD, ICON_PAD,
|
||||
icon_size, icon_size);
|
||||
EImageFree(im);
|
||||
|
|
Loading…
Reference in New Issue