46 #include <QtGui/qcolor.h> 47 #include <QtGui/qapplication.h> 48 #include <QtCore/qvector.h> 49 #include <QtCore/qvarlengtharray.h> 50 #include <private/qwssignalhandler_p.h> 65 case AhiPix8bpp_332RGB:
68 case AhiPix16bpp_444RGB:
70 case AhiPix16bpp_555RGB:
72 case AhiPix16bpp_565RGB:
74 case AhiPix32bpp_8888ARGB:
75 case AhiPix32bpp_8888BGRA:
93 return AhiPix32bpp_8888ARGB;
95 return AhiPix16bpp_565RGB;
97 return AhiPix16bpp_555RGB;
100 return AhiPix16bpp_444RGB;
102 return AhiPixelFormatMax;
112 void move(
int x,
int y);
147 if (pixFmt >= AhiPixelFormatMax) {
155 AhiPoint_t hotSpot = { hotx, hoty };
156 AhiSize_t bitmapSize = { image.
width(), image.
height() };
157 AhiBitmap_t bitmap = { bitmapSize, (
void*)(image.
bits()),
161 status = AhiDispCursorSet(
context, AhiCursor1, &bitmap, &hotSpot,
163 if (status != AhiStsOk)
164 qWarning(
"QAhiScreenCursor::set(): AhiDispCursorSet failed: %x",
172 AhiPoint_t
pos = { x, y };
173 AhiSts_t
status = AhiDispCursorPos(
context, AhiCursor1, &pos, 0);
174 if (status != AhiStsOk)
175 qWarning(
"QAhiScreenCursor::move(): error setting mouse position: %x",
183 status = AhiDispCursorState(
context, AhiCursor1, AhiCursorStateOn, 0);
184 if (status != AhiStsOk)
185 qWarning(
"QAhiScreenCursor::show(): error setting state: %x", status);
191 AhiDispCursorState(
context, AhiCursor1, AhiCursorStateOff, 0);
201 bool setMode(AhiDispMode_t mode);
213 #ifndef QT_NO_QWS_SIGNALHANDLER 237 status = AhiDispModeSet(
context, &mode, 0);
238 if (status != AhiStsOk) {
239 qCritical(
"QAhiScreenPrivate::setMode(): AhiDispModeSet failed: %x",
250 if (status != AhiStsOk) {
251 qCritical(
"QAhiScreenPrivate::setMode(): AhisurfAlloc failed: %x",
257 if (status != AhiStsOk) {
258 qCritical(
"QAhiScreenPrivate::setMode(): AhiDispSurfSet failed: %x",
278 AhiSurfInfo_t surfaceInfo;
282 if (status != AhiStsOk) {
283 qCritical(
"QAhiScreen::configure(): AhiSurfInfo failed: %x", status);
293 switch (surfaceInfo.pixFmt) {
301 case AhiPix8bpp_332RGB:
305 case AhiPix16bpp_444RGB:
309 case AhiPix16bpp_555RGB:
313 case AhiPix16bpp_565RGB:
320 case AhiPix32bpp_8888ARGB:
323 case AhiPix32bpp_8888BGRA:
327 qCritical(
"QAhiScreen::configure(): Unknown pixel format: %x",
346 if (status != AhiStsOk) {
347 qCritical(
"QAhiScreen::connect(): AhiInit failed: %x", status);
354 status = AhiDevEnum(&device, &info, 0);
355 if (status != AhiStsOk) {
356 qCritical(
"QAhiScreen::connect(): AhiDevEnum failed: %x", status);
359 #ifdef QAHISCREEN_DEBUG 362 AhiDevInfo_t dispInfo =
info;
363 qDebug(
"AHI supported devices:");
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);
379 status = AhiDevOpen(&
d_ptr->
context, device,
"qscreenahi",
381 if (status != AhiStsOk) {
382 qCritical(
"QAhiScreen::connect(): AhiDevOpen failed: %x", status);
389 if (status != AhiStsOk) {
390 qCritical(
"QAhiScreen::connect(): AhiDispModeEnum failed: %x", status);
394 #ifdef QAHISCREEN_DEBUG 397 AhiDispMode_t modeInfo = mode;
398 qDebug(
"AHI supported modes:");
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);
414 if (status != AhiStsOk) {
415 qCritical(
"QAhiScreen::connect(): AhiDispSurfGet failed: %x",
421 if (status != AhiStsOk) {
422 qCritical(
"QAhiScreen::context(): AhiDispModeGet failed: %x",
445 if (status != AhiStsOk) {
446 qCritical(
"QAhiScreen::connect(): AhiDispState failed: %x", status);
462 AhiSts_t
status = AhiStsOk;
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) &&
482 if (pixFmt >= AhiPixelFormatMax) {
493 if (status != AhiStsOk) {
494 qWarning(
"QAhiScreen::blit(): AhiDrawSurfDstSet failed: %x", status);
499 const int numRects = rects.
size();
503 for (
int i = 0; i < numRects; ++i) {
504 const QRect rect = rects.
at(i);
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();
514 AhiSize_t bitmapSize = { image.
width(), image.
height() };
515 AhiBitmap_t bitmap = { bitmapSize, (
void*)(image.
bits()),
518 status = AhiDrawRopSet(
d_ptr->
context, AHIMAKEROP3(AHIROPSRCCOPY));
519 if (status != AhiStsOk) {
520 qWarning(
"QAhiScreen::blit(): AhiDrawRopSet failed: %x", status);
524 for (
int i = 0; i < numRects; ++i) {
525 status = AhiDrawBitmapBlt(
d_ptr->
context, &dest[i], &src[i],
527 if (status != AhiStsOk) {
528 qWarning(
"QAhiScreen::blit(): AhiDrawBitmapBlt failed: %x",
537 AhiSts_t
status = AhiStsOk;
549 qFatal(
"QAhiScreen::solidFill(): Not implemented for pixel format %d",
554 if (status != AhiStsOk) {
555 qWarning(
"QAhiScreen::solidFill(): AhiDrawBrushFgColorSet failed: %x",
560 status = AhiDrawBrushSet(
d_ptr->
context, 0, 0, 0, AHIFLAG_BRUSHSOLID);
561 if (status != AhiStsOk) {
562 qWarning(
"QAhiScreen::solidFill(): AhiDrawBrushSet failed: %x",
567 status = AhiDrawRopSet(
d_ptr->
context, AHIMAKEROP3(AHIROPPATCOPY));
568 if (status != AhiStsOk) {
569 qWarning(
"QAhiScreen::solidFill(): AhiDrawRopSet failed: %x", status);
574 if (status != AhiStsOk) {
575 qWarning(
"QAhiScreen::solidFill(): AhiDrawSurfDst failed: %x", status);
582 for (
int i = 0; i < rects.
size(); ++i) {
583 const QRect rect = rects.
at(i);
585 ahiRects[i].top = rect.
top();
586 ahiRects[i].right = rect.
x() + rect.
width();
587 ahiRects[i].bottom = rect.
y() + rect.
height();
590 status = AhiDrawBitBltMulti(
d_ptr->
context, ahiRects.data(),
592 if (status != AhiStsOk)
593 qWarning(
"QAhiScreen::solidFill(): AhiDrawBitBlt failed: %x", status);
598 #endif // QT_NO_QWS_AHI The QColor class provides colors based on RGB, HSV or CMYK values.
The QScreenCursor class is a base class for screen cursors in Qt for Embedded Linux.
static int depthForPixelFormat(const AhiPixelFormat_t format)
virtual void move(int x, int y)
Moves the mouse cursor to the given position, i.e., (x, y).
Format
The following image formats are available in Qt.
void set(const QImage &image, int hotx, int hoty)
Sets the cursor's image to be the given image.
int height() const
Returns the logical height of the framebuffer in pixels.
static mach_timebase_info_data_t info
#define QT_END_NAMESPACE
This macro expands to.
void move(int x, int y)
Moves the mouse cursor to the given position, i.e., (x, y).
void shutdownDevice()
This function is called by the Qt for Embedded Linux server before it calls the disconnect() function...
QAhiScreenCursor(QScreen *screen, AhiDevCtx_t context)
bool isNull() const
Returns true if it is a null image, otherwise returns false.
bool setMode(AhiDispMode_t mode)
bool connect(const QString &displaySpec)
This function is called by every Qt for Embedded Linux application on startup, and must be implemente...
int left() const
Returns the x-coordinate of the rectangle's left edge.
int width() const
Returns the width of the rectangle.
static LibLoadStatus status
int bytesPerLine() const
Returns the number of bytes per image scanline.
int physHeight
the physical height of the screen in millimeters.
int height() const
Returns the height of the rectangle.
ushort qt_convRgbTo16(const int r, const int g, const int b)
The QString class provides a Unicode character string.
int size
the number of bytes in the visible region of the frame buffer
void setMode(int width, int height, int depth)
Implement this function to reset the framebuffer's resolution (width and height) and bit depth...
void hide()
Hides the cursor from the screen.
The QObject class is the base class of all Qt objects.
static void initSoftwareCursor()
Initializes the screen cursor.
Format format() const
Returns the format of the image.
int physWidth
the physical width of the screen in millimeters.
void addObject(QObject *object)
QImage image() const
Returns the cursor's image.
void setPixelFormat(QImage::Format format)
Sets the screen's pixel format to format.
static QWSSignalHandler * instance()
Q_CORE_EXPORT void qDebug(const char *,...)
virtual QRegion region() const
Returns the region covered by this screen driver.
int width() const
Returns the logical width of the framebuffer in pixels.
uchar * data
points to the first visible pixel in the frame buffer.
#define QT_BEGIN_NAMESPACE
This macro expands to.
static AhiPixelFormat_t pixelFormatForImageFormat(const QImage::Format format)
void show()
Shows the mouse cursor.
int w
the logical width of the screen.
Q_CORE_EXPORT void qWarning(const char *,...)
The QImage class provides a hardware-independent image representation that allows direct access to th...
QAhiScreenPrivate * d_ptr
The QRegion class specifies a clip region for a painter.
const T & at(int i) const
Returns the item at index position i in the vector.
virtual void hide()
Hides the cursor from the screen.
uchar * bits()
Returns a pointer to the first pixel data.
Q_CORE_EXPORT void qFatal(const char *,...)
int serialNumber() const
Returns a number that identifies the contents of this QImage object.
int top() const
Returns the y-coordinate of the rectangle's top edge.
int width() const
Returns the width of the image.
QImage convertToFormat(Format f, Qt::ImageConversionFlags flags=Qt::AutoColor) const Q_REQUIRED_RESULT
Returns a copy of the image in the given format.
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's top edge.
void blit(const QImage &image, const QPoint &topLeft, const QRegion ®ion)
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's left edge.
void solidFill(const QColor &color, const QRegion ®ion)
Fills the given region of the screen with the specified color.
The QPoint class defines a point in the plane using integer precision.
The QRect class defines a rectangle in the plane using integer precision.
void disconnect()
This function is called by every Qt for Embedded Linux application before exiting, and must be implemented to unmap the framebuffer.
int height() const
Returns the height of the image.
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
int y() const
Returns the y coordinate of this point.
bool initDevice()
This function is called by the Qt for Embedded Linux server to initialize the framebuffer.
QScopedPointer< QObjectData > d_ptr
int lstep
the number of bytes representing a line in the frame buffer.
int x() const
Returns the x coordinate of this point.
int h
the logical height of the screen.
QAhiScreen(int displayId)
QRgb rgba() const
Returns the RGB value of the color, including its alpha.
QAhiScreenCursor * cursor
virtual void show()
Shows the mouse cursor.
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...
int size() const
Returns the number of items in the vector.
QRgb rgb() const
Returns the RGB value of the color.
Q_DECL_CONSTEXPR int qRound(qreal d)
virtual void set(const QImage &image, int hotx, int hoty)
Sets the cursor's image to be the given image.
Q_CORE_EXPORT void qCritical(const char *,...)
int depth() const
Returns the depth of the framebuffer, in bits per pixel.