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

#include <qscreenahi_qws.h>

Inheritance diagram for QAhiScreen:
QScreen

Public Functions

void blit (const QImage &image, const QPoint &topLeft, const QRegion &region)
 Copies the given region in the given image to the point specified by topLeft using device coordinates. More...
 
bool connect (const QString &displaySpec)
 This function is called by every Qt for Embedded Linux application on startup, and must be implemented to map in the framebuffer and the accelerated drivers that the graphics card control registers. More...
 
void disconnect ()
 This function is called by every Qt for Embedded Linux application before exiting, and must be implemented to unmap the framebuffer. More...
 
bool initDevice ()
 This function is called by the Qt for Embedded Linux server to initialize the framebuffer. More...
 
 QAhiScreen (int displayId)
 
void setMode (int width, int height, int depth)
 Implement this function to reset the framebuffer's resolution (width and height) and bit depth. More...
 
void shutdownDevice ()
 This function is called by the Qt for Embedded Linux server before it calls the disconnect() function when exiting. More...
 
void solidFill (const QColor &color, const QRegion &region)
 Fills the given region of the screen with the specified color. More...
 
 ~QAhiScreen ()
 
- Public Functions inherited from QScreen
virtual int alloc (unsigned int, unsigned int, unsigned int)
 Returns the index in the screen's palette which is the closest match to the given RGB value (red, green, blue). More...
 
ucharbase () const
 Returns a pointer to the beginning of the framebuffer. More...
 
virtual void blank (bool on)
 Prevents the screen driver form displaying any content on the screen. More...
 
void blit (QWSWindow *bs, const QRegion &clip)
 
virtual ucharcache (int)
 
ClassId classId () const
 Returns the class identifier for the screen object. More...
 
QRgbclut ()
 Returns a pointer to the screen's color lookup table (i. More...
 
int colorCount ()
 Returns the number of entries in the screen's color lookup table (i. More...
 
virtual QWSWindowSurfacecreateSurface (QWidget *widget) const
 Creates and returns a new window surface for the given widget. More...
 
virtual QWSWindowSurfacecreateSurface (const QString &key) const
 Creates and returns a new window surface matching the given key. More...
 
int depth () const
 Returns the depth of the framebuffer, in bits per pixel. More...
 
int deviceHeight () const
 Returns the full height of the framebuffer device in pixels. More...
 
int deviceWidth () const
 Returns the physical width of the framebuffer device in pixels. More...
 
virtual void exposeRegion (QRegion r, int changing)
 This function is called by the Qt for Embedded Linux server whenever a screen update is required. More...
 
QGraphicsSystemgraphicsSystem () const
 
virtual void haltUpdates ()
 
int height () const
 Returns the logical height of the framebuffer in pixels. More...
 
virtual bool isInterlaced () const
 Returns true if the display is interlaced (i. More...
 
virtual bool isTransformed () const
 Returns true if the screen is transformed (for instance, rotated 90 degrees); otherwise returns false. More...
 
int linestep () const
 Returns the length of each scanline of the framebuffer in bytes. More...
 
virtual QSize mapFromDevice (const QSize &) const
 Maps the given size from the framebuffer coordinate system to the coordinate space used by the application. More...
 
virtual QPoint mapFromDevice (const QPoint &, const QSize &) const
 Maps the given point from the framebuffer coordinate system to the coordinate space used by the application, passing the device's screenSize as argument. More...
 
virtual QRect mapFromDevice (const QRect &, const QSize &) const
 Maps the given rectangle from the framebuffer coordinate system to the coordinate space used by the application, passing the device's screenSize as argument. More...
 
virtual QImage mapFromDevice (const QImage &) const
 Maps the given image from the framebuffer coordinate system to the coordinate space used by the application. More...
 
virtual QRegion mapFromDevice (const QRegion &, const QSize &) const
 Maps the given region from the framebuffer coordinate system to the coordinate space used by the application, passing the device's screenSize as argument. More...
 
virtual QSize mapToDevice (const QSize &) const
 Maps the given size from the coordinate space used by the application to the framebuffer coordinate system. More...
 
virtual QPoint mapToDevice (const QPoint &, const QSize &) const
 Maps the given point from the coordinate space used by the application to the framebuffer coordinate system, passing the device's screenSize as argument. More...
 
virtual QRect mapToDevice (const QRect &, const QSize &) const
 Maps the given rectangle from the coordinate space used by the application to the framebuffer coordinate system, passing the device's screenSize as argument. More...
 
virtual QImage mapToDevice (const QImage &) const
 Maps the given image from the coordinate space used by the application to the framebuffer coordinate system. More...
 
virtual QRegion mapToDevice (const QRegion &, const QSize &) const
 Maps the given region from the coordinate space used by the application to the framebuffer coordinate system, passing the device's screenSize as argument. More...
 
virtual int memoryNeeded (const QString &)
 
QT_DEPRECATED int numCols ()
 
QPoint offset () const
 Returns the logical offset of the screen, i. More...
 
virtual bool onCard (const unsigned char *) const
 Returns true if the specified buffer is within the graphics card's memory; otherwise returns false (i.e. More...
 
virtual bool onCard (const unsigned char *, ulong &out_offset) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.If the specified buffer is within the graphics card's memory, this function stores the offset from the start of graphics card memory (in bytes), in the location specified by the offset parameter. More...
 
int physicalHeight () const
 Returns the physical height of the screen in millimeters. More...
 
int physicalWidth () const
 Returns the physical width of the screen in millimeters. More...
 
QImage::Format pixelFormat () const
 Returns the pixel format of the screen, or QImage::Format_Invalid if the pixel format is not a supported image format. More...
 
PixelType pixelType () const
 Returns the pixel storage format of the screen. More...
 
QPixmapDataFactorypixmapDataFactory () const
 
virtual int pixmapDepth () const
 Returns the preferred depth for pixmaps, in bits per pixel. More...
 
virtual int pixmapLinestepAlignment ()
 Returns the value (in bits) to which individual scanlines of pixmaps held in the graphics card's memory, should be aligned. More...
 
virtual int pixmapOffsetAlignment ()
 Returns the value (in bits) to which the start address of pixmaps held in the graphics card's memory, should be aligned. More...
 
 QScreen (int display_id, ClassId classId)
 Constructs a new screen driver. More...
 
 QScreen (int display_id)
 Constructs a new screen driver. More...
 
virtual QRegion region () const
 Returns the region covered by this screen driver. More...
 
virtual void restore ()
 Restores the previously saved state of the graphics card. More...
 
virtual void resumeUpdates ()
 
virtual void save ()
 Saves the current state of the graphics card. More...
 
int screenSize () const
 Returns the size of the screen in bytes. More...
 
virtual void set (unsigned int, unsigned int, unsigned int, unsigned int)
 
virtual void setDirty (const QRect &)
 Marks the given rectangle as dirty. More...
 
void setOffset (const QPoint &p)
 
virtual int sharedRamSize (void *)
 
int subScreenIndexAt (const QPoint &p) const
 Returns the index of the subscreen at the given position; returns -1 if no screen is found. More...
 
virtual QList< QScreen * > subScreens () const
 
virtual bool supportsDepth (int) const
 Returns true if the screen supports the specified color depth; otherwise returns false. More...
 
int totalSize () const
 Returns the size of the available graphics card memory (including the screen) in bytes. More...
 
virtual int transformOrientation () const
 Returns the current rotation as an integer value. More...
 
virtual void uncache (uchar *)
 
int width () const
 Returns the logical width of the framebuffer in pixels. More...
 
virtual ~QScreen ()
 Destroys this screen driver. More...
 

Private Functions

bool configure ()
 

Properties

QAhiScreenPrivated_ptr
 

Additional Inherited Members

- Public Types inherited from QScreen
enum  ClassId {
  LinuxFBClass, TransformedClass, VNCClass, MultiClass,
  VFbClass, DirectFBClass, SvgalibClass, ProxyClass,
  GLClass, IntfbClass, CustomClass = 1024
}
 This enum defines the class identifiers for the known screen subclasses. More...
 
enum  PixelType { NormalPixel, BGRPixel }
 This enum describes the pixel storage format of the screen, i. More...
 
- Static Public Functions inherited from QScreen
static QScreeninstance ()
 Returns a pointer to the application's QScreen instance. More...
 
- Protected Functions inherited from QScreen
void setGraphicsSystem (QGraphicsSystem *system)
 
void setPixelFormat (QImage::Format format)
 Sets the screen's pixel format to format. More...
 
void setPixmapDataFactory (QPixmapDataFactory *factory)
 
- Protected Variables inherited from QScreen
int d
 the pixel depth More...
 
uchardata
 points to the first visible pixel in the frame buffer. More...
 
int dh
 the device height More...
 
int displayId
 
int dw
 the device width More...
 
QPoolEntryentries
 
int * entryp
 
bool grayscale
 the gray scale screen mode flag More...
 
int h
 the logical height of the screen. More...
 
unsigned int * lowest
 
int lstep
 the number of bytes representing a line in the frame buffer. More...
 
int mapsize
 the total number of bytes in the frame buffer More...
 
int physHeight
 the physical height of the screen in millimeters. More...
 
int physWidth
 the physical width of the screen in millimeters. More...
 
PixelType pixeltype
 set to BGRPixel More...
 
QRgb screenclut [256]
 the color table More...
 
int screencols
 the number of entries in the color table More...
 
int size
 the number of bytes in the visible region of the frame buffer More...
 
int w
 the logical width of the screen. More...
 
- Static Protected Variables inherited from QScreen
static ClearCacheFunc clearCacheFunc = 0
 

Detailed Description

Definition at line 57 of file qscreenahi_qws.h.

Constructors and Destructors

◆ QAhiScreen()

QAhiScreen::QAhiScreen ( int  displayId)

Definition at line 266 of file qscreenahi_qws.cpp.

268 {
269 }
QAhiScreenPrivate * d_ptr
int displayId
Definition: qscreen_qws.h:337
QScreen(int display_id, ClassId classId)
Constructs a new screen driver.

◆ ~QAhiScreen()

QAhiScreen::~QAhiScreen ( )

Definition at line 271 of file qscreenahi_qws.cpp.

272 {
273  delete d_ptr;
274 }
QAhiScreenPrivate * d_ptr

Functions

◆ blit()

void QAhiScreen::blit ( const QImage image,
const QPoint topLeft,
const QRegion region 
)
virtual

Copies the given region in the given image to the point specified by topLeft using device coordinates.

This function is called from the exposeRegion() function; it is not intended to be called explicitly.

Reimplement this function to make use of Adding an Accelerated Graphics Driver to Qt for Embedded Linux{accelerated hardware}. Note that this function must be reimplemented if the framebuffer format is not supported by Qt for Embedded Linux (See the Qt for Embedded Linux Display Management{Display Management} documentation for more details).

See also
exposeRegion(), solidFill(), blank()

Reimplemented from QScreen.

Definition at line 477 of file qscreenahi_qws.cpp.

479 {
480  AhiPixelFormat_t pixFmt = pixelFormatForImageFormat(image.format());
481 
482  if (pixFmt >= AhiPixelFormatMax) { // generic fallback
483  QImage::Format toFormat = pixelFormat();
484  if (toFormat == QImage::Format_Invalid)
485  toFormat = QImage::Format_ARGB32;
486  blit(image.convertToFormat(toFormat), topLeft, reg);
487  return;
488  }
489 
490  AhiSts_t status;
491 
492  status = AhiDrawSurfDstSet(d_ptr->context, d_ptr->surface, 0);
493  if (status != AhiStsOk) {
494  qWarning("QAhiScreen::blit(): AhiDrawSurfDstSet failed: %x", status);
495  return;
496  }
497 
498  const QVector<QRect> rects = (reg & region()).rects();
499  const int numRects = rects.size();
500  QVarLengthArray<AhiPoint_t, 8> src(numRects);
501  QVarLengthArray<AhiRect_t, 8> dest(numRects);
502 
503  for (int i = 0; i < numRects; ++i) {
504  const QRect rect = rects.at(i);
505 
506  src[i].x = rect.x() - topLeft.x();
507  src[i].y = rect.y() - topLeft.y();
508  dest[i].left = rect.left();
509  dest[i].top = rect.top();
510  dest[i].right = rect.x() + rect.width();
511  dest[i].bottom = rect.y() + rect.height();
512  }
513 
514  AhiSize_t bitmapSize = { image.width(), image.height() };
515  AhiBitmap_t bitmap = { bitmapSize, (void*)(image.bits()),
516  image.bytesPerLine(), pixFmt };
517 
518  status = AhiDrawRopSet(d_ptr->context, AHIMAKEROP3(AHIROPSRCCOPY));
519  if (status != AhiStsOk) {
520  qWarning("QAhiScreen::blit(): AhiDrawRopSet failed: %x", status);
521  return;
522  }
523 
524  for (int i = 0; i < numRects; ++i) {
525  status = AhiDrawBitmapBlt(d_ptr->context, &dest[i], &src[i],
526  &bitmap, 0, 0);
527  if (status != AhiStsOk) {
528  qWarning("QAhiScreen::blit(): AhiDrawBitmapBlt failed: %x",
529  status);
530  break;
531  }
532  }
533 }
Format
The following image formats are available in Qt.
Definition: qimage.h:91
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
static LibLoadStatus status
Definition: qlocale_icu.cpp:69
int bytesPerLine() const
Returns the number of bytes per image scanline.
Definition: qimage.cpp:1812
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
Format format() const
Returns the format of the image.
Definition: qimage.cpp:2305
virtual QRegion region() const
Returns the region covered by this screen driver.
Definition: qscreen_qws.h:284
static AhiPixelFormat_t pixelFormatForImageFormat(const QImage::Format format)
Q_CORE_EXPORT void qWarning(const char *,...)
QAhiScreenPrivate * d_ptr
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
uchar * bits()
Returns a pointer to the first pixel data.
Definition: qimage.cpp:1946
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
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 y() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:255
void blit(const QImage &image, const QPoint &topLeft, const QRegion &region)
Copies the given region in the given image to the point specified by topLeft using device coordinates...
int x() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:252
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
int height() const
Returns the height of the image.
Definition: qimage.cpp:1572
int y() const
Returns the y coordinate of this point.
Definition: qpoint.h:131
int x() const
Returns the x coordinate of this point.
Definition: qpoint.h:128
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137

◆ configure()

bool QAhiScreen::configure ( )
private

Definition at line 276 of file qscreenahi_qws.cpp.

Referenced by connect(), and setMode().

277 {
278  AhiSurfInfo_t surfaceInfo;
279  AhiSts_t status;
280 
281  status = AhiSurfInfo(d_ptr->context, d_ptr->surface, &surfaceInfo);
282  if (status != AhiStsOk) {
283  qCritical("QAhiScreen::configure(): AhiSurfInfo failed: %x", status);
284  return false;
285  }
286 
287  QScreen::data = 0;
288  QScreen::w = QScreen::dw = surfaceInfo.size.cx;
289  QScreen::h = QScreen::dh = surfaceInfo.size.cy;
290  QScreen::lstep = surfaceInfo.stride;
291  QScreen::size = surfaceInfo.sizeInBytes;
292 
293  switch (surfaceInfo.pixFmt) {
294  case AhiPix1bpp:
296  QScreen::d = 1;
297  break;
298  case AhiPix4bpp:
299  QScreen::d = 4;
300  break;
301  case AhiPix8bpp_332RGB:
302  case AhiPix8bpp:
303  QScreen::d = 8;
304  break;
305  case AhiPix16bpp_444RGB:
307  QScreen::d = 12;
308  break;
309  case AhiPix16bpp_555RGB:
311  QScreen::d = 15;
312  break;
313  case AhiPix16bpp_565RGB:
315  QScreen::d = 16;
316  break;
317  case AhiPix2bpp:
318  QScreen::d = 2;
319  break;
320  case AhiPix32bpp_8888ARGB:
322  // fallthrough
323  case AhiPix32bpp_8888BGRA:
324  QScreen::d = 32;
325  break;
326  default:
327  qCritical("QAhiScreen::configure(): Unknown pixel format: %x",
328  surfaceInfo.pixFmt);
329  return false;
330  }
331 
332  const int dpi = 72;
333  QScreen::physWidth = qRound(QScreen::dw * 25.4 / dpi);
334  QScreen::physHeight = qRound(QScreen::dh * 25.4 / dpi);
335 
336  return true;
337 }
int d
the pixel depth
Definition: qscreen_qws.h:327
static LibLoadStatus status
Definition: qlocale_icu.cpp:69
int physHeight
the physical height of the screen in millimeters.
Definition: qscreen_qws.h:340
int size
the number of bytes in the visible region of the frame buffer
Definition: qscreen_qws.h:334
int physWidth
the physical width of the screen in millimeters.
Definition: qscreen_qws.h:339
void setPixelFormat(QImage::Format format)
Sets the screen&#39;s pixel format to format.
uchar * data
points to the first visible pixel in the frame buffer.
Definition: qscreen_qws.h:311
int w
the logical width of the screen.
Definition: qscreen_qws.h:324
QAhiScreenPrivate * d_ptr
int dw
the device width
Definition: qscreen_qws.h:331
int dh
the device height
Definition: qscreen_qws.h:332
int lstep
the number of bytes representing a line in the frame buffer.
Definition: qscreen_qws.h:325
int h
the logical height of the screen.
Definition: qscreen_qws.h:326
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203
Q_CORE_EXPORT void qCritical(const char *,...)

◆ connect()

bool QAhiScreen::connect ( const QString displaySpec)
virtual

This function is called by every Qt for Embedded Linux application on startup, and must be implemented to map in the framebuffer and the accelerated drivers that the graphics card control registers.

Note that connect must be called before the initDevice() function.

Ensure that true is returned if a connection to the screen device is made. Otherwise, return false. Upon making the connection, the function should read out the parameters of the framebuffer and use them as required to set this class's protected variables.

The displaySpec argument is passed by the QWS_DISPLAY environment variable or the -display command line parameter, and has the following syntax:

[screen driver][:driver specific options][:display number]

For example, to use the mach64 driver on fb1 as display 2:

Mach64:/dev/fb1:2

See Qt for Embedded Linux Display Management for more details.

See also
disconnect(), initDevice(), {Running Qt for Embedded Linux Applications}

Implements QScreen.

Definition at line 339 of file qscreenahi_qws.cpp.

340 {
341  Q_UNUSED(displaySpec);
342 
343  AhiSts_t status;
344 
345  status = AhiInit(0);
346  if (status != AhiStsOk) {
347  qCritical("QAhiScreen::connect(): AhiInit failed: %x", status);
348  return false;
349  }
350 
351  AhiDev_t device;
352  AhiDevInfo_t info;
353 
354  status = AhiDevEnum(&device, &info, 0);
355  if (status != AhiStsOk) {
356  qCritical("QAhiScreen::connect(): AhiDevEnum failed: %x", status);
357  return false;
358  }
359 #ifdef QAHISCREEN_DEBUG
360  {
361  int displayNo = 0;
362  AhiDevInfo_t dispInfo = info;
363  qDebug("AHI supported devices:");
364  do {
365  qDebug(" %2i: %s, sw version: %s (rev %u)\n"
366  " chip: 0x%x (rev %u), mem: %i (%i/%i), bus: 0x%x",
367  displayNo, dispInfo.name,
368  dispInfo.swVersion, uint(dispInfo.swRevision),
369  uint(dispInfo.chipId), uint(dispInfo.revisionId),
370  uint(dispInfo.totalMemory),
371  uint(dispInfo.internalMemSize),
372  uint(dispInfo.externalMemSize),
373  uint(dispInfo.cpuBusInterfaceMode));
374  status = AhiDevEnum(&device, &info, ++displayNo);
375  } while (status == AhiStsOk);
376  }
377 #endif
378 
379  status = AhiDevOpen(&d_ptr->context, device, "qscreenahi",
380  AHIFLAG_USERLEVEL);
381  if (status != AhiStsOk) {
382  qCritical("QAhiScreen::connect(): AhiDevOpen failed: %x", status);
383  return false;
384  }
385 
386  AhiDispMode_t mode;
387 
388  status = AhiDispModeEnum(d_ptr->context, &mode, 0);
389  if (status != AhiStsOk) {
390  qCritical("QAhiScreen::connect(): AhiDispModeEnum failed: %x", status);
391  return false;
392  }
393 
394 #ifdef QAHISCREEN_DEBUG
395  {
396  int modeNo = 0;
397  AhiDispMode_t modeInfo = mode;
398  qDebug("AHI supported modes:");
399  do {
400  qDebug(" %2i: %ux%u, fmt: %i, %u Hz, rot: %i, mirror: %i",
401  modeNo, uint(modeInfo.size.cx), uint(modeInfo.size.cy),
402  modeInfo.pixFmt, uint(modeInfo.frequency),
403  modeInfo.rotation, modeInfo.mirror);
404  status = AhiDispModeEnum(d_ptr->context, &modeInfo, ++modeNo);
405  } while (status == AhiStsOk);
406  }
407 #endif
408 
410  if (!d_ptr->setMode(mode))
411  return false;
412  } else {
413  status = AhiDispSurfGet(d_ptr->context, &d_ptr->surface);
414  if (status != AhiStsOk) {
415  qCritical("QAhiScreen::connect(): AhiDispSurfGet failed: %x",
416  status);
417  return false;
418  }
419 
420  status = AhiDispModeGet(d_ptr->context, &mode);
421  if (status != AhiStsOk) {
422  qCritical("QAhiScreen::context(): AhiDispModeGet failed: %x",
423  status);
424  return false;
425  }
426  }
427 
428  return configure();
429 }
static mach_timebase_info_data_t info
bool setMode(AhiDispMode_t mode)
static LibLoadStatus status
Definition: qlocale_icu.cpp:69
Q_CORE_EXPORT void qDebug(const char *,...)
QAhiScreenPrivate * d_ptr
unsigned int uint
Definition: qglobal.h:996
static Type type()
Returns the type of application (Tty , GuiClient, or GuiServer).
#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
Q_CORE_EXPORT void qCritical(const char *,...)

◆ disconnect()

void QAhiScreen::disconnect ( )
virtual

This function is called by every Qt for Embedded Linux application before exiting, and must be implemented to unmap the framebuffer.

Note that a server application will call the shutdownDevice() function prior to this function.

See also
connect(), shutdownDevice(), {Running Qt for Embedded Linux Applications}

Implements QScreen.

Definition at line 431 of file qscreenahi_qws.cpp.

432 {
433  AhiSurfFree(d_ptr->context, d_ptr->surface);
434  d_ptr->surface = 0;
435  AhiDevClose(d_ptr->context);
436  d_ptr->context = 0;
437  AhiTerm();
438 }
QAhiScreenPrivate * d_ptr

◆ initDevice()

bool QAhiScreen::initDevice ( )
virtual

This function is called by the Qt for Embedded Linux server to initialize the framebuffer.

Note that a server application will call the connect() function prior to this function.

Implement this function to make accelerated drivers set up the graphics card. Return true to indicate success and false to indicate failure.

See also
shutdownDevice(), connect()

Implements QScreen.

Definition at line 440 of file qscreenahi_qws.cpp.

441 {
443 
444  AhiSts_t status = AhiDispState(d_ptr->context, AhiDispStateOn, 0);
445  if (status != AhiStsOk) {
446  qCritical("QAhiScreen::connect(): AhiDispState failed: %x", status);
447  return false;
448  }
449 
450  return true;
451 }
static LibLoadStatus status
Definition: qlocale_icu.cpp:69
static void initSoftwareCursor()
Initializes the screen cursor.
QAhiScreenPrivate * d_ptr
Q_CORE_EXPORT void qCritical(const char *,...)

◆ setMode()

void QAhiScreen::setMode ( int  width,
int  height,
int  depth 
)
virtual

Implement this function to reset the framebuffer's resolution (width and height) and bit depth.

After the resolution has been set, existing paint engines will be invalid and the framebuffer should be completely redrawn. In a multiple-process situation, all other applications must be notified to reset their mode and update themselves accordingly.

Implements QScreen.

Definition at line 458 of file qscreenahi_qws.cpp.

459 {
460  int modeNo = 0;
461  AhiDispMode_t mode;
462  AhiSts_t status = AhiStsOk;
463 
464  while (status == AhiStsOk) {
465  status = AhiDispModeEnum(d_ptr->context, &mode, modeNo);
466  if (mode.size.cx == uint(width) &&
467  mode.size.cy == uint(height) &&
468  depthForPixelFormat(mode.pixFmt) == depth)
469  {
470  d_ptr->setMode(mode);
471  configure();
472  return;
473  }
474  }
475 }
static int depthForPixelFormat(const AhiPixelFormat_t format)
int height() const
Returns the logical height of the framebuffer in pixels.
Definition: qscreen_qws.h:228
bool setMode(AhiDispMode_t mode)
static LibLoadStatus status
Definition: qlocale_icu.cpp:69
int width() const
Returns the logical width of the framebuffer in pixels.
Definition: qscreen_qws.h:227
QAhiScreenPrivate * d_ptr
unsigned int uint
Definition: qglobal.h:996
int depth() const
Returns the depth of the framebuffer, in bits per pixel.
Definition: qscreen_qws.h:229

◆ shutdownDevice()

void QAhiScreen::shutdownDevice ( )
virtual

This function is called by the Qt for Embedded Linux server before it calls the disconnect() function when exiting.

Note that the default implementation only hides the mouse cursor; reimplement this function to do the necessary graphics card specific cleanup.

See also
initDevice(), disconnect()

Reimplemented from QScreen.

Definition at line 453 of file qscreenahi_qws.cpp.

454 {
455  AhiDispState(d_ptr->context, AhiDispStateOff, 0);
456 }
QAhiScreenPrivate * d_ptr

◆ solidFill()

void QAhiScreen::solidFill ( const QColor color,
const QRegion region 
)
virtual

Fills the given region of the screen with the specified color.

This function is called from the exposeRegion() function; it is not intended to be called explicitly.

Reimplement this function to make use of Adding an Accelerated Graphics Driver to Qt for Embedded Linux{accelerated hardware}. Note that this function must be reimplemented if the framebuffer format is not supported by Qt for Embedded Linux (See the Qt for Embedded Linux Display Management{Display Management} documentation for more details).

See also
exposeRegion(), blit(), blank()

Reimplemented from QScreen.

Definition at line 535 of file qscreenahi_qws.cpp.

536 {
537  AhiSts_t status = AhiStsOk;
538 
539  switch (pixelFormat()) {
543  status = AhiDrawBrushFgColorSet(d_ptr->context, color.rgba());
544  break;
546  status = AhiDrawBrushFgColorSet(d_ptr->context, qt_convRgbTo16(color.rgb()));
547  break;
548  default:
549  qFatal("QAhiScreen::solidFill(): Not implemented for pixel format %d",
550  int(pixelFormat()));
551  break;
552  }
553 
554  if (status != AhiStsOk) {
555  qWarning("QAhiScreen::solidFill(): AhiDrawBrushFgColorSet failed: %x",
556  status);
557  return;
558  }
559 
560  status = AhiDrawBrushSet(d_ptr->context, 0, 0, 0, AHIFLAG_BRUSHSOLID);
561  if (status != AhiStsOk) {
562  qWarning("QAhiScreen::solidFill(): AhiDrawBrushSet failed: %x",
563  status);
564  return;
565  }
566 
567  status = AhiDrawRopSet(d_ptr->context, AHIMAKEROP3(AHIROPPATCOPY));
568  if (status != AhiStsOk) {
569  qWarning("QAhiScreen::solidFill(): AhiDrawRopSet failed: %x", status);
570  return;
571  }
572 
573  status = AhiDrawSurfDstSet(d_ptr->context, d_ptr->surface, 0);
574  if (status != AhiStsOk) {
575  qWarning("QAhiScreen::solidFill(): AhiDrawSurfDst failed: %x", status);
576  return;
577  }
578 
579  const QVector<QRect> rects = (reg & region()).rects();
580  QVarLengthArray<AhiRect_t> ahiRects(rects.size());
581 
582  for (int i = 0; i < rects.size(); ++i) {
583  const QRect rect = rects.at(i);
584  ahiRects[i].left = rect.left();
585  ahiRects[i].top = rect.top();
586  ahiRects[i].right = rect.x() + rect.width();
587  ahiRects[i].bottom = rect.y() + rect.height();
588  }
589 
590  status = AhiDrawBitBltMulti(d_ptr->context, ahiRects.data(),
591  0, ahiRects.size());
592  if (status != AhiStsOk)
593  qWarning("QAhiScreen::solidFill(): AhiDrawBitBlt failed: %x", status);
594 }
int left() const
Returns the x-coordinate of the rectangle&#39;s left edge.
Definition: qrect.h:240
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
static LibLoadStatus status
Definition: qlocale_icu.cpp:69
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
ushort qt_convRgbTo16(const int r, const int g, const int b)
Definition: qscreen_qws.h:86
virtual QRegion region() const
Returns the region covered by this screen driver.
Definition: qscreen_qws.h:284
Q_CORE_EXPORT void qWarning(const char *,...)
QAhiScreenPrivate * d_ptr
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
Q_CORE_EXPORT void qFatal(const char *,...)
int top() const
Returns the y-coordinate of the rectangle&#39;s top edge.
Definition: qrect.h:243
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
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
Definition: qcolor.cpp:1019
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
QRgb rgb() const
Returns the RGB value of the color.
Definition: qcolor.cpp:1051

Properties

◆ d_ptr

QAhiScreenPrivate* QAhiScreen::d_ptr
private

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