Qt 4.8
Public Functions | Static Public Functions | Private Functions | Properties | List of all members
QDirectFBPixmapData Class Reference

#include <qdirectfbpixmap.h>

Inheritance diagram for QDirectFBPixmapData:
QPixmapData QDirectFBPaintDevice QCustomRasterPaintDevice QPaintDevice

Public Functions

virtual QImagebuffer ()
 
virtual void copy (const QPixmapData *data, const QRect &rect)
 
virtual void fill (const QColor &color)
 
virtual bool fromData (const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags)
 
virtual bool fromFile (const QString &filename, const char *format, Qt::ImageConversionFlags flags)
 
virtual void fromImage (const QImage &image, Qt::ImageConversionFlags flags)
 
bool hasAlphaChannel () const
 
virtual int metric (QPaintDevice::PaintDeviceMetric m) const
 
virtual QPaintEnginepaintEngine () const
 
QImage::Format pixelFormat () const
 
 QDirectFBPixmapData (QDirectFBScreen *screen, PixelType pixelType)
 
virtual void resize (int width, int height)
 
virtual bool scroll (int dx, int dy, const QRect &rect)
 
virtual QImage toImage () const
 
virtual QPixmap transformed (const QTransform &matrix, Qt::TransformationMode mode) const
 
 ~QDirectFBPixmapData ()
 
- Public Functions inherited from QPixmapData
virtual QPixmap alphaChannel () const
 
qint64 cacheKey () const
 
ClassId classId () const
 
int colorCount () const
 
virtual QPixmapDatacreateCompatiblePixmapData () const
 
int depth () const
 
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
 
int serialNumber () const
 
virtual void setAlphaChannel (const QPixmap &alphaChannel)
 
virtual void setMask (const QBitmap &mask)
 
virtual QImage toImage (const QRect &rect) const
 
int width () const
 
virtual ~QPixmapData ()
 
- Public Functions inherited from QDirectFBPaintDevice
int bytesPerLine () const
 Returns the number of bytes per line in the framebuffer. More...
 
virtual IDirectFBSurface * directFBSurface () const
 
QImage::Format format () const
 Returns the format of the device's memory buffet. More...
 
DFBSurfaceLockFlags lockFlags () const
 
bool lockSurface (DFBSurfaceLockFlags lockFlags)
 
void * memory () const
 Returns a pointer to the paint device's memory buffer, or 0 if no such buffer exists. More...
 
QSize size () const
 
void unlockSurface ()
 
 ~QDirectFBPaintDevice ()
 
- Public Functions inherited from QCustomRasterPaintDevice
int devType () const
 
 QCustomRasterPaintDevice (QWidget *w)
 Constructs a custom raster based paint device for the given top-level widget. More...
 
- Public Functions inherited from QPaintDevice
int colorCount () const
 
int depth () const
 
virtual HDC getDC () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
QT_DEPRECATED int numColors () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
virtual void releaseDC (HDC hdc) const
 
int width () const
 
int widthMM () const
 
virtual ~QPaintDevice ()
 

Static Public Functions

static bool hasAlphaChannel (const QImage &img, Qt::ImageConversionFlags flags=Qt::AutoColor)
 
- Static Public Functions inherited from QPixmapData
static QPixmapDatacreate (int w, int h, PixelType type)
 
- Static Public Functions inherited from QPaintDevice
static QWSDisplayqwsDisplay ()
 

Private Functions

bool fromDataBufferDescription (const DFBDataBufferDescription &dataBuffer)
 
void invalidate ()
 

Properties

bool alpha
 

Additional Inherited Members

- Public Types inherited from QPixmapData
enum  ClassId {
  RasterClass, X11Class, MacClass, DirectFBClass,
  OpenGLClass, OpenVGClass, RuntimeClass, BlitterClass,
  CustomClass = 1024
}
 
enum  PixelType { PixmapType, BitmapType }
 
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric {
  PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM,
  PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY,
  PdmPhysicalDpiX, PdmPhysicalDpiY
}
 
- Protected Functions inherited from QPixmapData
void setSerialNumber (int serNo)
 
- Protected Functions inherited from QDirectFBPaintDevice
int dotsPerMeterX () const
 
int dotsPerMeterY () const
 
 QDirectFBPaintDevice (QDirectFBScreen *scr)
 
- Protected Functions inherited from QPaintDevice
 QPaintDevice ()
 
- Protected Variables inherited from QPixmapData
int d
 
int h
 
bool is_null
 
int w
 
- Protected Variables inherited from QDirectFBPaintDevice
int bpl
 
IDirectFBSurface * dfbSurface
 
QDirectFBPaintEngineengine
 
QImage::Format imageFormat
 
QImage lockedImage
 
DFBSurfaceLockFlags lockFlgs
 
ucharmem
 
QDirectFBScreenscreen
 
- Protected Variables inherited from QPaintDevice
ushort painters
 

Detailed Description

Definition at line 62 of file qdirectfbpixmap.h.

Constructors and Destructors

◆ QDirectFBPixmapData()

QDirectFBPixmapData::QDirectFBPixmapData ( QDirectFBScreen screen,
PixelType  pixelType 
)

Definition at line 58 of file qdirectfbpixmap.cpp.

Referenced by transformed().

60  alpha(false)
61 {
62  setSerialNumber(0);
63 }
QDirectFBPaintDevice(QDirectFBScreen *scr)
PixelType pixelType() const
QPixmapData(PixelType pixelType, int classId)
Definition: qpixmapdata.cpp:68
void setSerialNumber(int serNo)

◆ ~QDirectFBPixmapData()

QDirectFBPixmapData::~QDirectFBPixmapData ( )

Definition at line 65 of file qdirectfbpixmap.cpp.

66 {
67 }

Functions

◆ buffer()

QImage * QDirectFBPixmapData::buffer ( )
virtual

Reimplemented from QPixmapData.

Definition at line 526 of file qdirectfbpixmap.cpp.

Referenced by fromData(), toImage(), and transformed().

527 {
528  if (!lockFlgs) {
529  lockSurface(DSLF_READ|DSLF_WRITE);
530  }
533  return &lockedImage;
534 }
DFBSurfaceLockFlags lockFlgs
bool isNull() const
Returns true if it is a null image, otherwise returns false.
Definition: qimage.cpp:1542
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
bool lockSurface(DFBSurfaceLockFlags lockFlags)

◆ copy()

void QDirectFBPixmapData::copy ( const QPixmapData data,
const QRect rect 
)
virtual

Reimplemented from QPixmapData.

Definition at line 332 of file qdirectfbpixmap.cpp.

333 {
334  if (data->classId() != DirectFBClass) {
335  QPixmapData::copy(data, rect);
336  return;
337  }
338 
339  const QDirectFBPixmapData *otherData = static_cast<const QDirectFBPixmapData*>(data);
340 #ifdef QT_NO_DIRECTFB_SUBSURFACE
341  if (otherData->lockFlags()) {
342  const_cast<QDirectFBPixmapData*>(otherData)->unlockSurface();
343  }
344 #endif
345  IDirectFBSurface *src = otherData->directFBSurface();
346  alpha = data->hasAlphaChannel();
347  imageFormat = (alpha
350 
351 
354  if (!dfbSurface) {
355  qWarning("QDirectFBPixmapData::copy()");
356  invalidate();
357  return;
358  }
359 
360  if (alpha) {
361  dfbSurface->Clear(dfbSurface, 0, 0, 0, 0);
362  dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_BLEND_ALPHACHANNEL);
363  } else {
364  dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
365  }
366  const DFBRectangle blitRect = { rect.x(), rect.y(),
367  rect.width(), rect.height() };
368  w = rect.width();
369  h = rect.height();
370  d = otherData->d;
371  is_null = (w <= 0 || h <= 0);
372  unlockSurface();
373  DFBResult result = dfbSurface->Blit(dfbSurface, src, &blitRect, 0, 0);
374 #if (Q_DIRECTFB_VERSION >= 0x010000)
375  dfbSurface->ReleaseSource(dfbSurface);
376 #endif
377  if (result != DFB_OK) {
378  DirectFBError("QDirectFBPixmapData::copy()", result);
379  invalidate();
380  return;
381  }
382 
384 }
static int global_ser_no
IDirectFBSurface * createDFBSurface(const QImage &image, QImage::Format format, SurfaceCreationOptions options, DFBResult *result=0)
QDirectFBScreen * screen
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
QImage::Format alphaPixmapFormat() const
DFBSurfaceLockFlags lockFlags() const
QSize size() const
Returns the size of the rectangle.
Definition: qrect.h:309
Q_CORE_EXPORT void qWarning(const char *,...)
static const char * data(const QByteArray &arr)
ClassId classId() const
IDirectFBSurface * dfbSurface
virtual bool hasAlphaChannel() const =0
QImage::Format pixelFormat() const
Returns the pixel format of the screen, or QImage::Format_Invalid if the pixel format is not a suppor...
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
virtual void copy(const QPixmapData *data, const QRect &rect)
static QDirectFBScreen * instance()
virtual IDirectFBSurface * directFBSurface() const
void setSerialNumber(int serNo)

◆ fill()

void QDirectFBPixmapData::fill ( const QColor color)
virtual

Implements QPixmapData.

Definition at line 402 of file qdirectfbpixmap.cpp.

403 {
404  if (!serialNumber())
405  return;
406 
408 
409  alpha |= (color.alpha() < 255);
410 
411  if (alpha && isOpaqueFormat(imageFormat)) {
412  QSize size;
413  dfbSurface->GetSize(dfbSurface, &size.rwidth(), &size.rheight());
419  if (!dfbSurface) {
420  qWarning("QDirectFBPixmapData::fill()");
421  invalidate();
422  return;
423  }
424  }
425 
426  dfbSurface->Clear(dfbSurface, color.red(), color.green(), color.blue(), color.alpha());
427 }
static int global_ser_no
IDirectFBSurface * createDFBSurface(const QImage &image, QImage::Format format, SurfaceCreationOptions options, DFBResult *result=0)
void releaseDFBSurface(IDirectFBSurface *surface)
QDirectFBScreen * screen
ushort red
Returns the red color component of this color.
Definition: qcolor.h:243
QImage::Format alphaPixmapFormat() const
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
int serialNumber() const
Q_CORE_EXPORT void qWarning(const char *,...)
static bool isOpaqueFormat(QImage::Format format)
IDirectFBSurface * dfbSurface
ushort blue
Returns the blue color component of this color.
Definition: qcolor.h:245
ushort alpha
Returns the alpha color component of this color.
Definition: qcolor.h:242
int & rheight()
Returns a reference to the height.
Definition: qsize.h:144
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
void setSerialNumber(int serNo)
ushort green
Returns the green color component of this color.
Definition: qcolor.h:244
int & rwidth()
Returns a reference to the width.
Definition: qsize.h:141
int depth() const
Returns the depth of the framebuffer, in bits per pixel.
Definition: qscreen_qws.h:229

◆ fromData()

bool QDirectFBPixmapData::fromData ( const uchar buffer,
uint  len,
const char *  format,
Qt::ImageConversionFlags  flags 
)
virtual

Reimplemented from QPixmapData.

Definition at line 206 of file qdirectfbpixmap.cpp.

Referenced by fromFile().

208 {
209  if (flags == Qt::AutoColor) {
210  DFBDataBufferDescription description;
211  description.flags = DBDESC_MEMORY;
212  description.memory.data = buffer;
213  description.memory.length = len;
214  if (fromDataBufferDescription(description))
215  return true;
216  // fall back to Qt
217  }
218  return QPixmapData::fromData(buffer, len, format, flags);
219 }
bool fromDataBufferDescription(const DFBDataBufferDescription &dataBuffer)
virtual bool fromData(const uchar *buffer, uint len, const char *format, Qt::ImageConversionFlags flags)
virtual QImage * buffer()

◆ fromDataBufferDescription()

bool QDirectFBPixmapData::fromDataBufferDescription ( const DFBDataBufferDescription &  dataBuffer)
private

Definition at line 235 of file qdirectfbpixmap.cpp.

Referenced by fromData(), fromFile(), and hasAlphaChannel().

236 {
237  IDirectFB *dfb = screen->dfb();
238  Q_ASSERT(dfb);
239  DFBResult result = DFB_OK;
240  IDirectFBDataBuffer *dataBufferPtr;
241  if ((result = dfb->CreateDataBuffer(dfb, &dataBufferDescription, &dataBufferPtr)) != DFB_OK) {
242  DirectFBError("QDirectFBPixmapData::fromDataBufferDescription()", result);
243  return false;
244  }
245  QDirectFBPointer<IDirectFBDataBuffer> dataBuffer(dataBufferPtr);
246 
247  IDirectFBImageProvider *providerPtr;
248  if ((result = dataBuffer->CreateImageProvider(dataBuffer.data(), &providerPtr)) != DFB_OK)
249  return false;
250 
251  QDirectFBPointer<IDirectFBImageProvider> provider(providerPtr);
252 
253  DFBImageDescription imageDescription;
254  result = provider->GetImageDescription(provider.data(), &imageDescription);
255  if (result != DFB_OK) {
256  DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't get image description", result);
257  return false;
258  }
259 
260  if (imageDescription.caps & DICAPS_COLORKEY) {
261  return false;
262  }
263 
264  DFBSurfaceDescription surfaceDescription;
265  if ((result = provider->GetSurfaceDescription(provider.data(), &surfaceDescription)) != DFB_OK) {
266  DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't get surface description", result);
267  return false;
268  }
269 
270  alpha = imageDescription.caps & DICAPS_ALPHACHANNEL;
272 
273  dfbSurface = screen->createDFBSurface(QSize(surfaceDescription.width, surfaceDescription.height),
275 
276  result = provider->RenderTo(provider.data(), dfbSurface, 0);
277  if (result != DFB_OK) {
278  DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't render to surface", result);
279  return false;
280  }
281 
282  w = surfaceDescription.width;
283  h = surfaceDescription.height;
284  is_null = (w <= 0 || h <= 0);
287 
288 #if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
289  screen->setDirectFBImageProvider(providerPtr);
290  provider.take();
291 #endif
292 
293  return true;
294 }
static int global_ser_no
IDirectFBSurface * createDFBSurface(const QImage &image, QImage::Format format, SurfaceCreationOptions options, DFBResult *result=0)
QDirectFBScreen * screen
QImage::Format alphaPixmapFormat() const
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
IDirectFB * dfb()
IDirectFBSurface * dfbSurface
QImage::Format pixelFormat() const
Returns the pixel format of the screen, or QImage::Format_Invalid if the pixel format is not a suppor...
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
void setSerialNumber(int serNo)
int depth() const
Returns the depth of the framebuffer, in bits per pixel.
Definition: qscreen_qws.h:229

◆ fromFile()

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

Reimplemented from QPixmapData.

Definition at line 179 of file qdirectfbpixmap.cpp.

181 {
182  if (!QFile::exists(filename))
183  return false;
184  if (flags == Qt::AutoColor) {
185  if (filename.startsWith(QLatin1Char(':'))) { // resource
186  QFile file(filename);
187  if (!file.open(QIODevice::ReadOnly))
188  return false;
189  const QByteArray data = file.readAll();
190  file.close();
191  return fromData(reinterpret_cast<const uchar*>(data.constData()), data.size(), format, flags);
192  } else {
193  DFBDataBufferDescription description;
194  description.flags = DBDESC_FILE;
195  const QByteArray fileNameData = filename.toLocal8Bit();
196  description.file = fileNameData.constData();
197  if (fromDataBufferDescription(description)) {
198  return true;
199  }
200  // fall back to Qt
201  }
202  }
203  return QPixmapData::fromFile(filename, format, flags);
204 }
virtual bool fromFile(const QString &filename, const char *format, Qt::ImageConversionFlags flags)
virtual bool fromData(const uchar *buffer, uint len, 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 fromDataBufferDescription(const DFBDataBufferDescription &dataBuffer)
bool exists() const
Returns true if the file specified by fileName() exists; otherwise returns false. ...
Definition: qfile.cpp:626
QImage::Format format() const
Returns the format of the device&#39;s memory buffet.
static const char * data(const QByteArray &arr)
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
The QFile class provides an interface for reading from and writing to files.
Definition: qfile.h:65
int size() const
Returns the number of bytes in this byte array.
Definition: qbytearray.h:402
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ fromImage()

void QDirectFBPixmapData::fromImage ( const QImage image,
Qt::ImageConversionFlags  flags 
)
virtual

Implements QPixmapData.

Definition at line 298 of file qdirectfbpixmap.cpp.

Referenced by transformed().

299 {
302 
303  QImage image;
304  if ((flags & ~Qt::NoOpaqueDetection) != Qt::AutoColor) {
305  image = img.convertToFormat(imageFormat, flags);
306  flags = Qt::AutoColor;
307  } else if (img.format() == QImage::Format_RGB32 || img.depth() == 1) {
308  image = img.convertToFormat(imageFormat, flags);
309  } else if (img.format() != imageFormat) {
310  image = img.convertToFormat(imageFormat, flags);
311  } else {
312  image = img;
313  }
314 
316  if (!dfbSurface) {
317  qWarning("QDirectFBPixmapData::fromImage()");
318  invalidate();
319  return;
320  }
321 
322  w = image.width();
323  h = image.height();
324  is_null = (w <= 0 || h <= 0);
327 #ifdef QT_NO_DIRECTFB_OPAQUE_DETECTION
328  Q_UNUSED(flags);
329 #endif
330 }
static int global_ser_no
IDirectFBSurface * createDFBSurface(const QImage &image, QImage::Format format, SurfaceCreationOptions options, DFBResult *result=0)
QDirectFBScreen * screen
QImage::Format alphaPixmapFormat() const
Format format() const
Returns the format of the image.
Definition: qimage.cpp:2305
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
IDirectFBSurface * dfbSurface
int width() const
Returns the width of the image.
Definition: qimage.cpp:1557
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
Returns a copy of the image in the given format.
Definition: qimage.cpp:3966
QImage::Format pixelFormat() const
Returns the pixel format of the screen, or QImage::Format_Invalid if the pixel format is not a suppor...
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572
bool hasAlphaChannel() const
void setSerialNumber(int serNo)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
int depth() const
Returns the depth of the framebuffer, in bits per pixel.
Definition: qscreen_qws.h:229

◆ hasAlphaChannel() [1/2]

bool QDirectFBPixmapData::hasAlphaChannel ( ) const
inlinevirtual

◆ hasAlphaChannel() [2/2]

bool QDirectFBPixmapData::hasAlphaChannel ( const QImage img,
Qt::ImageConversionFlags  flags = Qt::AutoColor 
)
static

Definition at line 166 of file qdirectfbpixmap.cpp.

167 {
168  if (img.depth() == 1)
169  return true;
170 #ifdef QT_DIRECTFB_OPAQUE_DETECTION
171  return ((flags & Qt::NoOpaqueDetection) ? img.hasAlphaChannel() : checkForAlphaPixels(img));
172 #else
173  Q_UNUSED(flags);
174  return img.hasAlphaChannel();
175 #endif
176 }
bool hasAlphaChannel() const
Returns true if the image has a format that respects the alpha channel, otherwise returns false...
Definition: qimage.cpp:6495
int depth() const
Returns the depth of the image.
Definition: qimage.cpp:1620
static bool checkForAlphaPixels(const QImage &img)
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729

◆ invalidate()

void QDirectFBPixmapData::invalidate ( )
private

Definition at line 564 of file qdirectfbpixmap.cpp.

Referenced by copy(), fill(), fromImage(), hasAlphaChannel(), and resize().

565 {
566  if (dfbSurface) {
568  dfbSurface = 0;
569  }
570  setSerialNumber(0);
571  alpha = false;
572  d = w = h = 0;
573  is_null = true;
575 }
void releaseDFBSurface(IDirectFBSurface *surface)
QDirectFBScreen * screen
IDirectFBSurface * dfbSurface
void setSerialNumber(int serNo)

◆ metric()

virtual int QDirectFBPixmapData::metric ( QPaintDevice::PaintDeviceMetric  m) const
inlinevirtual

Implements QPixmapData.

Definition at line 86 of file qdirectfbpixmap.h.

86 { return QDirectFBPaintDevice::metric(m); }
int metric(QPaintDevice::PaintDeviceMetric metric) const
Reimplemented Function

◆ paintEngine()

QPaintEngine * QDirectFBPixmapData::paintEngine ( ) const
virtual

Implements QPixmapData.

Definition at line 515 of file qdirectfbpixmap.cpp.

516 {
517  if (!engine) {
518  // QDirectFBPixmapData is also a QCustomRasterPaintDevice, so pass
519  // that to the paint engine:
520  QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this);
521  that->engine = new QDirectFBPaintEngine(that);
522  }
523  return engine;
524 }
QDirectFBPaintEngine * engine

◆ pixelFormat()

QImage::Format QDirectFBPixmapData::pixelFormat ( ) const
inline

Definition at line 88 of file qdirectfbpixmap.h.

88 { return imageFormat; }

◆ resize()

void QDirectFBPixmapData::resize ( int  width,
int  height 
)
virtual

Implements QPixmapData.

Definition at line 69 of file qdirectfbpixmap.cpp.

70 {
71  if (width <= 0 || height <= 0) {
72  invalidate();
73  return;
74  }
75 
81  alpha = false;
82  if (!dfbSurface) {
83  invalidate();
84  qWarning("QDirectFBPixmapData::resize(): Unable to allocate surface");
85  return;
86  }
87 
88  w = width;
89  h = height;
90  is_null = (w <= 0 || h <= 0);
92 }
static int global_ser_no
IDirectFBSurface * createDFBSurface(const QImage &image, QImage::Format format, SurfaceCreationOptions options, DFBResult *result=0)
QDirectFBScreen * screen
int width() const
Q_CORE_EXPORT void qWarning(const char *,...)
IDirectFBSurface * dfbSurface
QImage::Format pixelFormat() const
Returns the pixel format of the screen, or QImage::Format_Invalid if the pixel format is not a suppor...
int height() const
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
void setSerialNumber(int serNo)
int depth() const
Returns the depth of the framebuffer, in bits per pixel.
Definition: qscreen_qws.h:229

◆ scroll()

bool QDirectFBPixmapData::scroll ( int  dx,
int  dy,
const QRect rect 
)
virtual

Reimplemented from QPixmapData.

Definition at line 537 of file qdirectfbpixmap.cpp.

538 {
539  if (!dfbSurface) {
540  return false;
541  }
542  unlockSurface();
543  DFBResult result = dfbSurface->SetBlittingFlags(dfbSurface, DSBLIT_NOFX);
544  if (result != DFB_OK) {
545  DirectFBError("QDirectFBPixmapData::scroll", result);
546  return false;
547  }
548  result = dfbSurface->SetPorterDuff(dfbSurface, DSPD_NONE);
549  if (result != DFB_OK) {
550  DirectFBError("QDirectFBPixmapData::scroll", result);
551  return false;
552  }
553 
554  const DFBRectangle source = { rect.x(), rect.y(), rect.width(), rect.height() };
555  result = dfbSurface->Blit(dfbSurface, dfbSurface, &source, source.x + dx, source.y + dy);
556  if (result != DFB_OK) {
557  DirectFBError("QDirectFBPixmapData::scroll", result);
558  return false;
559  }
560 
561  return true;
562 }
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
IDirectFBSurface * dfbSurface
int y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252

◆ toImage()

QImage QDirectFBPixmapData::toImage ( ) const
virtual

Implements QPixmapData.

Definition at line 480 of file qdirectfbpixmap.cpp.

481 {
482  if (!dfbSurface)
483  return QImage();
484 
485 #if 0
486  // In later versions of DirectFB one can set a flag to tell
487  // DirectFB not to move the surface to videomemory. When that
488  // happens we can use this (hopefully faster) codepath
489 #ifndef QT_NO_DIRECTFB_PREALLOCATED
491  if (IDirectFBSurface *imgSurface = screen->createDFBSurface(ret, QDirectFBScreen::DontTrackSurface)) {
492  if (hasAlphaChannel()) {
493  imgSurface->SetBlittingFlags(imgSurface, DSBLIT_BLEND_ALPHACHANNEL);
494  imgSurface->Clear(imgSurface, 0, 0, 0, 0);
495  } else {
496  imgSurface->SetBlittingFlags(imgSurface, DSBLIT_NOFX);
497  }
498  imgSurface->Blit(imgSurface, dfbSurface, 0, 0, 0);
499 #if (Q_DIRECTFB_VERSION >= 0x010000)
500  imgSurface->ReleaseSource(imgSurface);
501 #endif
502  imgSurface->Release(imgSurface);
503  return ret;
504  }
505 #endif
506 #endif
507 
508  QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this);
509  const QImage *img = that->buffer();
510  return img->copy();
511 }
QImage copy(const QRect &rect=QRect()) const
Returns a sub-area of the image as a new image.
Definition: qimage.cpp:1410
IDirectFBSurface * createDFBSurface(const QImage &image, QImage::Format format, SurfaceCreationOptions options, DFBResult *result=0)
QDirectFBScreen * screen
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
static QImage::Format getImageFormat(IDirectFBSurface *surface)
IDirectFBSurface * dfbSurface
virtual QImage * buffer()
bool hasAlphaChannel() const

◆ transformed()

QPixmap QDirectFBPixmapData::transformed ( const QTransform matrix,
Qt::TransformationMode  mode 
) const
virtual

Reimplemented from QPixmapData.

Definition at line 429 of file qdirectfbpixmap.cpp.

431 {
432  QDirectFBPixmapData *that = const_cast<QDirectFBPixmapData*>(this);
433 #ifdef QT_NO_DIRECTFB_SUBSURFACE
434  if (lockFlags())
435  that->unlockSurface();
436 #endif
437 
438  if (!dfbSurface || transform.type() != QTransform::TxScale
439  || mode != Qt::FastTransformation)
440  {
441  const QImage *image = that->buffer();
442  Q_ASSERT(image);
443  const QImage transformed = image->transformed(transform, mode);
445  data->fromImage(transformed, Qt::AutoColor);
446  return QPixmap(data);
447  }
448 
449  const QSize size = transform.mapRect(QRect(0, 0, w, h)).size();
450  if (size.isEmpty())
451  return QPixmap();
452 
455  DFBSurfaceBlittingFlags flags = DSBLIT_NOFX;
456  data->alpha = alpha;
457  if (alpha) {
458  flags = DSBLIT_BLEND_ALPHACHANNEL;
459  }
460  data->dfbSurface = screen->createDFBSurface(size,
461  imageFormat,
463  if (flags & DSBLIT_BLEND_ALPHACHANNEL) {
464  data->dfbSurface->Clear(data->dfbSurface, 0, 0, 0, 0);
465  }
466  data->dfbSurface->SetBlittingFlags(data->dfbSurface, flags);
467 
468  const DFBRectangle destRect = { 0, 0, size.width(), size.height() };
469  data->dfbSurface->StretchBlit(data->dfbSurface, dfbSurface, 0, &destRect);
470  data->w = size.width();
471  data->h = size.height();
472  data->is_null = (data->w <= 0 || data->h <= 0);
473 
474 #if (Q_DIRECTFB_VERSION >= 0x010000)
475  data->dfbSurface->ReleaseSource(data->dfbSurface);
476 #endif
477  return QPixmap(data);
478 }
QDirectFBPixmapData(QDirectFBScreen *screen, PixelType pixelType)
static int global_ser_no
IDirectFBSurface * createDFBSurface(const QImage &image, QImage::Format format, SurfaceCreationOptions options, DFBResult *result=0)
QDirectFBScreen * screen
friend class QPixmap
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
virtual void fromImage(const QImage &image, Qt::ImageConversionFlags flags)
DFBSurfaceLockFlags lockFlags() const
int width() const
Returns the width.
Definition: qsize.h:126
The QImage class provides a hardware-independent image representation that allows direct access to th...
Definition: qimage.h:87
static const char * data(const QByteArray &arr)
QImage transformed(const QMatrix &matrix, Qt::TransformationMode mode=Qt::FastTransformation) const
Returns a copy of the image that is transformed using the given transformation matrix and transformat...
Definition: qimage.cpp:4698
IDirectFBSurface * dfbSurface
virtual QImage * buffer()
int height() const
Returns the height.
Definition: qsize.h:129
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
bool isEmpty() const
Returns true if either of the width and height is less than or equal to 0; otherwise returns false...
Definition: qsize.h:120
virtual QPixmap transformed(const QTransform &matrix, Qt::TransformationMode mode) const
void setSerialNumber(int serNo)

Properties

◆ alpha

bool QDirectFBPixmapData::alpha
private

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