eRect srcarea=area;
srcarea.moveBy(-pos.x(), -pos.y());
-
+
if ((surface->data_phys && src.surface->data_phys) && (gAccel::getInstance()))
if (!gAccel::getInstance()->blit(surface, src.surface, area.topLeft(), srcarea, flag))
continue;
- flag &= ~ blitAlphaBlend;
-
+
if ((surface->bpp == 8) && (src.surface->bpp==8))
{
__u8 *srcptr=(__u8*)src.surface->data;
__u8 *dstptr=(__u8*)surface->data;
-
+
srcptr+=srcarea.left()*src.surface->bypp+srcarea.top()*src.surface->stride;
dstptr+=area.left()*surface->bypp+area.top()*surface->stride;
for (int y=0; y<area.height(); y++)
{
__u32 *srcptr=(__u32*)src.surface->data;
__u32 *dstptr=(__u32*)surface->data;
-
+
srcptr+=srcarea.left()+srcarea.top()*src.surface->stride/4;
dstptr+=area.left()+area.top()*surface->stride/4;
for (int y=0; y<area.height(); y++)
} else if (flag & blitAlphaBlend)
{
// uh oh. this is only until hardware accel is working.
-
+
int width=area.width();
// ARGB color space!
unsigned char *src=(unsigned char*)srcptr;
unsigned char dr = dst[2];
unsigned char dg = dst[1];
unsigned char db = dst[0];
-
+
dst[3] = BLEND(0xFF, da, sa);
dst[2] = BLEND(sr, dr, sa);
dst[1] = BLEND(sg, dg, sa);
dst[0] = BLEND(sb, db, sa);
-
+
src += 4; dst += 4;
}
} else
pal[i]=0x010101*i;
pal[i]^=0xFF000000;
}
-
+
srcptr+=srcarea.left()*src.surface->bypp+srcarea.top()*src.surface->stride;
dstptr+=area.left()*surface->bypp+area.top()*surface->stride;
for (int y=0; y<area.height(); y++)
{
}
-void ePixmap::setAlphatest(bool alphatest)
+void ePixmap::setAlphatest(int alphatest)
{
m_alphatest = alphatest;
setTransparent(alphatest);
getStyle(style);
// we don't clear the background before because of performance reasons.
-// when the pixmap is too small to fix the whole widget area, the widget is
+// when the pixmap is too small to fit the whole widget area, the widget is
// transparent anyway, so the background is already painted.
// eWidget::event(event, data, data2);
-
+
gPainter &painter = *(gPainter*)data2;
if (m_pixmap)
- painter.blit(m_pixmap, ePoint(0, 0), eRect(), m_alphatest?gPainter::BT_ALPHATEST:0);
-
+ {
+ int flags = 0;
+ if (m_alphatest == 0)
+ flags = 0;
+ else if (m_alphatest == 1)
+ flags = gPainter::BT_ALPHATEST;
+ else if (m_alphatest == 2)
+ flags = gPainter::BT_ALPHABLEND;
+ painter.blit(m_pixmap, ePoint(0, 0), eRect(), flags);
+ }
+
return 0;
}
case evtChangedPixmap:
class ePixmap: public eWidget
{
- bool m_alphatest;
+ int m_alphatest;
public:
ePixmap(eWidget *parent);
void setPixmap(gPixmap *pixmap);
void setPixmap(ePtr<gPixmap> &pixmap);
void setPixmapFromFile(const char *filename);
- void setAlphatest(bool alphatest);
+ void setAlphatest(int alphatest); /* 1 for alphatest, 2 for alphablend */
protected:
ePtr<gPixmap> m_pixmap;
int event(int event, void *data=0, void *data2=0);