Qt 4.8
Public Functions | Protected Functions | Protected Variables | List of all members
QDirectFBPaintDevice Class Reference

#include <qdirectfbpaintdevice.h>

Inheritance diagram for QDirectFBPaintDevice:
QCustomRasterPaintDevice QPaintDevice QDirectFBPixmapData QDirectFBWindowSurface

Public Functions

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...
 
int metric (QPaintDevice::PaintDeviceMetric metric) const
 Reimplemented Function More...
 
QPaintEnginepaintEngine () const
 
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 ()
 

Protected Functions

int dotsPerMeterX () const
 
int dotsPerMeterY () const
 
 QDirectFBPaintDevice (QDirectFBScreen *scr)
 
- Protected Functions inherited from QPaintDevice
 QPaintDevice ()
 

Protected Variables

int bpl
 
IDirectFBSurface * dfbSurface
 
QDirectFBPaintEngineengine
 
QImage::Format imageFormat
 
QImage lockedImage
 
DFBSurfaceLockFlags lockFlgs
 
ucharmem
 
QDirectFBScreenscreen
 
- Protected Variables inherited from QPaintDevice
ushort painters
 

Additional Inherited Members

- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric {
  PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM,
  PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY,
  PdmPhysicalDpiX, PdmPhysicalDpiY
}
 
- Static Public Functions inherited from QPaintDevice
static QWSDisplayqwsDisplay ()
 

Detailed Description

Definition at line 58 of file qdirectfbpaintdevice.h.

Constructors and Destructors

◆ ~QDirectFBPaintDevice()

QDirectFBPaintDevice::~QDirectFBPaintDevice ( )

Definition at line 60 of file qdirectfbpaintdevice.cpp.

61 {
63  unlockSurface();
64 #ifdef QT_DIRECTFB_SUBSURFACE
65  releaseSubSurface();
66 #endif
67  if (dfbSurface) {
69  }
70  }
71  delete engine;
72 }
void releaseDFBSurface(IDirectFBSurface *surface)
QDirectFBScreen * screen
QDirectFBPaintEngine * engine
IDirectFBSurface * dfbSurface
static QDirectFBScreen * instance()

◆ QDirectFBPaintDevice()

QDirectFBPaintDevice::QDirectFBPaintDevice ( QDirectFBScreen scr)
protected

Definition at line 50 of file qdirectfbpaintdevice.cpp.

Referenced by lockFlags().

52  bpl(-1), lockFlgs(DFBSurfaceLockFlags(0)), mem(0), engine(0), imageFormat(QImage::Format_Invalid)
53 {
54 #ifdef QT_DIRECTFB_SUBSURFACE
55  subSurface = 0;
56  syncPending = false;
57 #endif
58 }
DFBSurfaceLockFlags lockFlgs
QDirectFBScreen * screen
QDirectFBPaintEngine * engine
IDirectFBSurface * dfbSurface
QCustomRasterPaintDevice(QWidget *w)
Constructs a custom raster based paint device for the given top-level widget.

Functions

◆ bytesPerLine()

int QDirectFBPaintDevice::bytesPerLine ( ) const
virtual

Returns the number of bytes per line in the framebuffer.

Note that this number might be larger than the framebuffer width.

Reimplemented from QCustomRasterPaintDevice.

Definition at line 143 of file qdirectfbpaintdevice.cpp.

144 {
145  Q_ASSERT(!mem || bpl != -1);
146  return bpl;
147 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ directFBSurface()

IDirectFBSurface * QDirectFBPaintDevice::directFBSurface ( ) const
virtual

◆ dotsPerMeterX()

int QDirectFBPaintDevice::dotsPerMeterX ( ) const
inlineprotected

Definition at line 78 of file qdirectfbpaintdevice.h.

Referenced by metric().

79  {
80  return (screen->deviceWidth() * 1000) / screen->physicalWidth();
81  }
QDirectFBScreen * screen
int deviceWidth() const
Returns the physical width of the framebuffer device in pixels.
Definition: qscreen_qws.h:233
int physicalWidth() const
Returns the physical width of the screen in millimeters.
Definition: qscreen_qws.h:290

◆ dotsPerMeterY()

int QDirectFBPaintDevice::dotsPerMeterY ( ) const
inlineprotected

Definition at line 82 of file qdirectfbpaintdevice.h.

Referenced by metric().

83  {
84  return (screen->deviceHeight() * 1000) / screen->physicalHeight();
85  }
int physicalHeight() const
Returns the physical height of the screen in millimeters.
Definition: qscreen_qws.h:291
QDirectFBScreen * screen
int deviceHeight() const
Returns the full height of the framebuffer device in pixels.
Definition: qscreen_qws.h:234

◆ format()

QImage::Format QDirectFBPaintDevice::format ( ) const
virtual

Returns the format of the device's memory buffet.

The default format is QImage::Format_ARGB32_Premultiplied. The only other valid format is QImage::Format_RGB16.

Reimplemented from QCustomRasterPaintDevice.

Definition at line 138 of file qdirectfbpaintdevice.cpp.

Referenced by QDirectFBPixmapData::fromFile().

139 {
140  return imageFormat;
141 }

◆ lockFlags()

DFBSurfaceLockFlags QDirectFBPaintDevice::lockFlags ( ) const
inline

Definition at line 74 of file qdirectfbpaintdevice.h.

Referenced by QDirectFBPixmapData::copy(), lockSurface(), and QDirectFBPixmapData::transformed().

74 { return lockFlgs; }
DFBSurfaceLockFlags lockFlgs

◆ lockSurface()

bool QDirectFBPaintDevice::lockSurface ( DFBSurfaceLockFlags  lockFlags)

Definition at line 79 of file qdirectfbpaintdevice.cpp.

Referenced by QDirectFBPixmapData::buffer(), and QDirectFBPaintEnginePrivate::lock().

80 {
81  if (lockFlgs && (lockFlags & ~lockFlgs))
82  unlockSurface();
83  if (!mem) {
85 #ifdef QT_DIRECTFB_SUBSURFACE
86  if (!subSurface) {
87  DFBResult result;
88  subSurface = screen->getSubSurface(dfbSurface, QRect(), QDirectFBScreen::TrackSurface, &result);
89  if (result != DFB_OK || !subSurface) {
90  DirectFBError("Couldn't create sub surface", result);
91  return false;
92  }
93  }
94  IDirectFBSurface *surface = subSurface;
95 #else
96  IDirectFBSurface *surface = dfbSurface;
97 #endif
98  Q_ASSERT(surface);
101  Q_ASSERT(mem);
102  Q_ASSERT(bpl > 0);
103  const QSize s = size();
104  lockedImage = QImage(mem, s.width(), s.height(), bpl,
106  return true;
107  }
108 #ifdef QT_DIRECTFB_SUBSURFACE
109  if (syncPending) {
110  syncPending = false;
111  screen->waitIdle();
112  }
113 #endif
114  return false;
115 }
DFBSurfaceLockFlags lockFlgs
QDirectFBScreen * screen
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
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 QImage::Format getImageFormat(IDirectFBSurface *surface)
IDirectFBSurface * dfbSurface
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
static uchar * lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl=0)
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ memory()

void * QDirectFBPaintDevice::memory ( ) const
virtual

Returns a pointer to the paint device's memory buffer, or 0 if no such buffer exists.

Reimplemented from QCustomRasterPaintDevice.

Definition at line 133 of file qdirectfbpaintdevice.cpp.

134 {
135  return mem;
136 }

◆ metric()

int QDirectFBPaintDevice::metric ( QPaintDevice::PaintDeviceMetric  m) const
virtual

Reimplemented Function

Reimplemented from QCustomRasterPaintDevice.

Reimplemented in QDirectFBPixmapData.

Definition at line 156 of file qdirectfbpaintdevice.cpp.

Referenced by QDirectFBPixmapData::metric().

157 {
158  if (!dfbSurface)
159  return 0;
160 
161  switch (metric) {
164  return (metric == PdmWidth ? size().width() : size().height());
166  return (size().width() * 1000) / dotsPerMeterX();
168  return (size().height() * 1000) / dotsPerMeterY();
171  return (dotsPerMeterX() * 254) / 10000; // 0.0254 meters-per-inch
174  return (dotsPerMeterY() * 254) / 10000; // 0.0254 meters-per-inch
178  if (!lockedImage.isNull())
179  return lockedImage.colorCount();
180 
181  DFBResult result;
182  IDirectFBPalette *palette = 0;
183  unsigned int numColors = 0;
184 
185  result = dfbSurface->GetPalette(dfbSurface, &palette);
186  if ((result != DFB_OK) || !palette)
187  return 0;
188 
189  result = palette->GetSize(palette, &numColors);
190  palette->Release(palette);
191  if (result != DFB_OK)
192  return 0;
193 
194  return numColors;
195  }
196  default:
197  qCritical("QDirectFBPaintDevice::metric(): Unhandled metric!");
198  return 0;
199  }
200 }
bool isNull() const
Returns true if it is a null image, otherwise returns false.
Definition: qimage.cpp:1542
int height() const
Definition: qpaintdevice.h:92
int width() const
Definition: qpaintdevice.h:91
int metric(QPaintDevice::PaintDeviceMetric metric) const
Reimplemented Function
IDirectFBSurface * dfbSurface
QT_DEPRECATED int numColors() const
Definition: qpaintdevice.h:100
int colorCount() const
Returns the size of the color table for the image.
Definition: qimage.cpp:1656
Q_CORE_EXPORT void qCritical(const char *,...)
int depth() const
Returns the depth of the framebuffer, in bits per pixel.
Definition: qscreen_qws.h:229

◆ paintEngine()

QPaintEngine * QDirectFBPaintDevice::paintEngine ( ) const
virtual

Implements QPaintDevice.

Reimplemented in QDirectFBPixmapData.

Definition at line 202 of file qdirectfbpaintdevice.cpp.

Referenced by lockFlags().

203 {
204  return engine;
205 }
QDirectFBPaintEngine * engine

◆ size()

QSize QDirectFBPaintDevice::size ( ) const
virtual
Warning
This function is not part of the public interface.

Reimplemented from QCustomRasterPaintDevice.

Definition at line 149 of file qdirectfbpaintdevice.cpp.

Referenced by QDirectFBPixmapData::fill(), lockSurface(), metric(), and QDirectFBPixmapData::transformed().

150 {
151  int w, h;
152  dfbSurface->GetSize(dfbSurface, &w, &h);
153  return QSize(w, h);
154 }
IDirectFBSurface * dfbSurface
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ unlockSurface()

void QDirectFBPaintDevice::unlockSurface ( )

Definition at line 117 of file qdirectfbpaintdevice.cpp.

Referenced by QDirectFBPixmapData::copy(), QDirectFBWindowSurface::endPaint(), lockSurface(), paintEngine(), QDirectFBWindowSurface::releaseSurface(), QDirectFBPixmapData::scroll(), QDirectFBPixmapData::transformed(), QDirectFBPaintEnginePrivate::unlock(), and ~QDirectFBPaintDevice().

118 {
120 #ifdef QT_DIRECTFB_SUBSURFACE
121  IDirectFBSurface *surface = subSurface;
122 #else
123  IDirectFBSurface *surface = dfbSurface;
124 #endif
125  if (surface) {
126  surface->Unlock(surface);
127  lockFlgs = static_cast<DFBSurfaceLockFlags>(0);
128  mem = 0;
129  }
130  }
131 }
DFBSurfaceLockFlags lockFlgs
IDirectFBSurface * dfbSurface
static QDirectFBScreen * instance()

Properties

◆ bpl

int QDirectFBPaintDevice::bpl
protected

Definition at line 96 of file qdirectfbpaintdevice.h.

Referenced by bytesPerLine(), and lockSurface().

◆ dfbSurface

IDirectFBSurface* QDirectFBPaintDevice::dfbSurface
protected

◆ engine

QDirectFBPaintEngine* QDirectFBPaintDevice::engine
protected

◆ imageFormat

QImage::Format QDirectFBPaintDevice::imageFormat
protected

◆ lockedImage

QImage QDirectFBPaintDevice::lockedImage
protected

Definition at line 94 of file qdirectfbpaintdevice.h.

Referenced by QDirectFBPixmapData::buffer(), lockSurface(), and metric().

◆ lockFlgs

DFBSurfaceLockFlags QDirectFBPaintDevice::lockFlgs
protected

◆ mem

uchar* QDirectFBPaintDevice::mem
protected

Definition at line 98 of file qdirectfbpaintdevice.h.

Referenced by bytesPerLine(), lockSurface(), memory(), and unlockSurface().

◆ screen

QDirectFBScreen* QDirectFBPaintDevice::screen
protected

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