[directfb] Prepare to select the alpha/opaque pixel formats
Right now we assume to use 32bpp but depending on the hardware this might not be optimal at all. Begin to prepare the code for not having a 32bpp surfaces. Change-Id: Iedfa49c568559e074dfaeae2a216c9eb93721d2c Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
This commit is contained in:
parent
d43775b93b
commit
b1c803a925
@ -74,11 +74,11 @@ QDirectFbBlitter::QDirectFbBlitter(const QSize &rect, bool alpha)
|
||||
|
||||
if (alpha) {
|
||||
surfaceDesc.caps = DSCAPS_PREMULTIPLIED;
|
||||
surfaceDesc.pixelformat = DSPF_ARGB;
|
||||
surfaceDesc.pixelformat = QDirectFbBlitter::alphaPixmapFormat();
|
||||
surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_CAPS | DSDESC_PIXELFORMAT);
|
||||
} else {
|
||||
surfaceDesc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT);
|
||||
surfaceDesc.pixelformat = DSPF_RGB32;
|
||||
surfaceDesc.pixelformat = QDirectFbBlitter::pixmapFormat();
|
||||
}
|
||||
|
||||
|
||||
@ -92,6 +92,21 @@ QDirectFbBlitter::~QDirectFbBlitter()
|
||||
unlock();
|
||||
}
|
||||
|
||||
DFBSurfacePixelFormat QDirectFbBlitter::alphaPixmapFormat()
|
||||
{
|
||||
return DSPF_ARGB;
|
||||
}
|
||||
|
||||
DFBSurfacePixelFormat QDirectFbBlitter::pixmapFormat()
|
||||
{
|
||||
return DSPF_RGB32;
|
||||
}
|
||||
|
||||
DFBSurfacePixelFormat QDirectFbBlitter::selectPixmapFormat(bool withAlpha)
|
||||
{
|
||||
return withAlpha ? alphaPixmapFormat() : pixmapFormat();
|
||||
}
|
||||
|
||||
void QDirectFbBlitter::fillRect(const QRectF &rect, const QColor &color)
|
||||
{
|
||||
m_surface->SetColor(m_surface.data(), color.red(), color.green(), color.blue(), color.alpha());
|
||||
|
@ -58,6 +58,10 @@ public:
|
||||
virtual void fillRect(const QRectF &rect, const QColor &color);
|
||||
virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect);
|
||||
|
||||
static DFBSurfacePixelFormat alphaPixmapFormat();
|
||||
static DFBSurfacePixelFormat pixmapFormat();
|
||||
static DFBSurfacePixelFormat selectPixmapFormat(bool withAlpha);
|
||||
|
||||
protected:
|
||||
virtual QImage *doLock();
|
||||
virtual void doUnlock();
|
||||
|
Loading…
Reference in New Issue
Block a user