Qt 4.8
Public Functions | Private Functions | List of all members
QDirectFbBlitterPlatformPixmap Class Reference

#include <qdirectfbblitter.h>

Inheritance diagram for QDirectFbBlitterPlatformPixmap:
QBlittablePixmapData QPixmapData

Public Functions

QBlittablecreateBlittable (const QSize &size, bool alpha) const
 
QDirectFbBlitterdfbBlitter () const
 
virtual bool fromFile (const QString &filename, const char *format, Qt::ImageConversionFlags flags)
 
- Public Functions inherited from QBlittablePixmapData
QBlittableblittable () const
 
QImagebuffer ()
 
void fill (const QColor &color)
 
void fromImage (const QImage &image, Qt::ImageConversionFlags flags)
 
bool hasAlphaChannel () const
 
void markRasterOverlay (const QRectF &)
 
void markRasterOverlay (const QPointF &, const QTextItem &)
 
void markRasterOverlay (const QVectorPath &)
 
void markRasterOverlay (const QPainterPath &)
 
void markRasterOverlay (const QRect *rects, int rectCount)
 
void markRasterOverlay (const QRectF *rects, int rectCount)
 
void markRasterOverlay (const QPointF *points, int pointCount)
 
void markRasterOverlay (const QPoint *points, int pointCount)
 
int metric (QPaintDevice::PaintDeviceMetric metric) const
 
QPaintEnginepaintEngine () const
 
 QBlittablePixmapData ()
 
void resize (int width, int height)
 
void setBlittable (QBlittable *blittable)
 
QImage toImage () const
 
void unmarkRasterOverlay (const QRectF &)
 
 ~QBlittablePixmapData ()
 
- Public Functions inherited from QPixmapData
virtual QPixmap alphaChannel () const
 
qint64 cacheKey () const
 
ClassId classId () const
 
int colorCount () const
 
virtual void copy (const QPixmapData *data, const QRect &rect)
 
virtual QPixmapDatacreateCompatiblePixmapData () const
 
int depth () const
 
virtual bool fromData (const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags)
 
virtual void fromImageReader (QImageReader *imageReader, Qt::ImageConversionFlags flags)
 
int height () const
 
bool isNull () const
 
virtual QBitmap mask () const
 
QT_DEPRECATED int numColors () const
 
PixelType pixelType () const
 
 QPixmapData (PixelType pixelType, int classId)
 
virtual QPixmapDataruntimeData () const
 
virtual bool scroll (int dx, int dy, const QRect &rect)
 
int serialNumber () const
 
virtual void setAlphaChannel (const QPixmap &alphaChannel)
 
virtual void setMask (const QBitmap &mask)
 
virtual QImage toImage (const QRect &rect) const
 
virtual QPixmap transformed (const QTransform &matrix, Qt::TransformationMode mode) const
 
int width () const
 
virtual ~QPixmapData ()
 

Private Functions

bool fromDataBufferDescription (const DFBDataBufferDescription &)
 

Additional Inherited Members

- Public Types inherited from QPixmapData
enum  ClassId {
  RasterClass, X11Class, MacClass, DirectFBClass,
  OpenGLClass, OpenVGClass, RuntimeClass, BlitterClass,
  CustomClass = 1024
}
 
enum  PixelType { PixmapType, BitmapType }
 
- Static Public Functions inherited from QPixmapData
static QPixmapDatacreate (int w, int h, PixelType type)
 
- Protected Functions inherited from QPixmapData
void setSerialNumber (int serNo)
 
- Protected Variables inherited from QBlittablePixmapData
bool m_alpha
 
QScopedPointer< QBlittablem_blittable
 
QScopedPointer< QBlitterPaintEnginem_engine
 
- Protected Variables inherited from QPixmapData
int d
 
int h
 
bool is_null
 
int w
 

Detailed Description

Definition at line 84 of file qdirectfbblitter.h.

Functions

◆ createBlittable()

QBlittable * QDirectFbBlitterPlatformPixmap::createBlittable ( const QSize size,
bool  alpha 
) const
inlinevirtual

Implements QBlittablePixmapData.

Definition at line 98 of file qdirectfbblitter.h.

99 {
100  return new QDirectFbBlitter(size, alpha);
101 }

◆ dfbBlitter()

QDirectFbBlitter * QDirectFbBlitterPlatformPixmap::dfbBlitter ( ) const
inline

Definition at line 103 of file qdirectfbblitter.h.

104 {
105  return static_cast<QDirectFbBlitter*>(blittable());
106 }
QBlittable * blittable() const

◆ fromDataBufferDescription()

bool QDirectFbBlitterPlatformPixmap::fromDataBufferDescription ( const DFBDataBufferDescription &  dataBufferDescription)
private

Definition at line 237 of file qdirectfbblitter.cpp.

238 {
239  DFBResult result;
240  IDirectFB *dfb = QDirectFbConvenience::dfbInterface();
241 
242  // Create a data buffer
244  result = dfb->CreateDataBuffer(dfb, &dataBufferDescription, dataBuffer.outPtr());
245  if (result != DFB_OK) {
246  DirectFBError(QDFB_PRETTY, result);
247  return false;
248  }
249 
250  // Create the image provider
252  result = dataBuffer->CreateImageProvider(dataBuffer.data(), provider.outPtr());
253  if (result != DFB_OK) {
254  DirectFBError(QDFB_PRETTY, result);
255  return false;
256  }
257 
258  // Extract image information
259  DFBImageDescription imageDescription;
260  result = provider->GetImageDescription(provider.data(), &imageDescription);
261  if (result != DFB_OK) {
262  DirectFBError(QDFB_PRETTY, result);
263  return false;
264  }
265 
266  // Can we handle this directlu?
267  if (imageDescription.caps & DICAPS_COLORKEY)
268  return false;
269 
270  DFBSurfaceDescription surfaceDescription;
271  result = provider->GetSurfaceDescription(provider.data(), &surfaceDescription);
272  if (result != DFB_OK) {
273  DirectFBError(QDFB_PRETTY, result);
274  return false;
275  }
276 
277  m_alpha = imageDescription.caps & DICAPS_ALPHACHANNEL;
278  resize(surfaceDescription.width, surfaceDescription.height);
279  // TODO: FIXME; update d
280 
281 
282  result = provider->RenderTo(provider.data(), dfbBlitter()->dfbSurface(), 0);
283  if (result != DFB_OK) {
284  DirectFBError(QDFB_PRETTY, result);
285  return false;
286  }
287 
288  return true;
289 }
QDirectFbBlitter * dfbBlitter() const
T * data() const
Returns the value of the pointer referenced by this object.
#define QDFB_PRETTY
IDirectFBSurface * dfbSurface() const
static IDirectFB * dfbInterface()
void resize(int width, int height)

◆ fromFile()

bool QDirectFbBlitterPlatformPixmap::fromFile ( const QString filename,
const char *  format,
Qt::ImageConversionFlags  flags 
)
virtual

Reimplemented from QPixmapData.

Definition at line 291 of file qdirectfbblitter.cpp.

293 {
294  // If we can't find the file, pass it on to the base class as it is
295  // trying harder by appending various extensions to the path.
296  if (!QFile::exists(filename))
297  return QBlittablePixmapData::fromFile(filename, format, flags);
298 
299  // Stop if there is a requirement for colors
300  if (flags != Qt::AutoColor)
301  return QBlittablePixmapData::fromFile(filename, format, flags);
302 
303  // Deal with resources
304  if (filename.startsWith(QLatin1Char(':')))
305  return QBlittablePixmapData::fromFile(filename, format, flags);
306 
307  // Try to use directfb to load it.
308  DFBDataBufferDescription description;
309  description.flags = DBDESC_FILE;
310  const QByteArray fileNameData = filename.toLocal8Bit();
311  description.file = fileNameData.constData();
312  if (fromDataBufferDescription(description))
313  return true;
314 
315  // Fallback
316  return QBlittablePixmapData::fromFile(filename, format, flags);
317 }
virtual bool fromFile(const QString &filename, const char *format, Qt::ImageConversionFlags flags)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
Definition: qstring.cpp:3734
bool exists() const
Returns true if the file specified by fileName() exists; otherwise returns false. ...
Definition: qfile.cpp:626
QByteArray toLocal8Bit() const Q_REQUIRED_RESULT
Returns the local 8-bit representation of the string as a QByteArray.
Definition: qstring.cpp:4049
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
bool fromDataBufferDescription(const DFBDataBufferDescription &)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

The documentation for this class was generated from the following files: