Qt 4.8
Classes | Functions | Variables
qscreen_qws.cpp File Reference
#include "qplatformdefs.h"
#include "qscreen_qws.h"
#include "qcolormap.h"
#include "qscreendriverfactory_qws.h"
#include "qwindowsystem_qws.h"
#include "qwidget.h"
#include "qcolor.h"
#include "qpixmap.h"
#include "qvarlengtharray.h"
#include "qwsdisplay_qws.h"
#include "qpainter.h"
#include <private/qdrawhelper_p.h>
#include <private/qpaintengine_raster_p.h>
#include <private/qpixmap_raster_p.h>
#include <private/qwindowsurface_qws_p.h>
#include <private/qpainter_p.h>
#include <private/qwidget_p.h>
#include <private/qgraphicssystem_qws_p.h>

Go to the source code of this file.

Classes

struct  fill_data
 
class  QScreenPrivate
 

Functions

static void blendCursor (QImage *dest, const QImage &cursor, const QPoint &offset)
 
template<typename DST , typename SRC >
static void blit_template (QScreen *screen, const QImage &image, const QPoint &topLeft, const QRegion &region)
 
void qt_blit_setup (QScreen *screen, const QImage &image, const QPoint &topLeft, const QRegion &region)
 
Q_GUI_EXPORT QScreenqt_get_screen (int display_id, const char *spec)
 
void qt_solidFill_setup (QScreen *screen, const QColor &color, const QRegion &region)
 
template<typename T >
static void solidFill_template (QScreen *screen, const QColor &color, const QRegion &region)
 

Variables

Q_GUI_EXPORT QScreenqt_screen = 0
 
Q_GUI_EXPORT QScreenCursorqt_screencursor = 0
 
bool qws_accel
 

Function Documentation

◆ blendCursor()

static void blendCursor ( QImage dest,
const QImage cursor,
const QPoint offset 
)
static

Definition at line 2499 of file qscreen_qws.cpp.

Referenced by buttonChange(), QScreen::exposeRegion(), and QVNCDirtyMap::QVNCDirtyMap().

2500 {
2501  QRasterBuffer rb;
2502  rb.prepare(dest);
2503 
2504  QSpanData spanData;
2505  spanData.init(&rb, 0);
2506  spanData.type = QSpanData::Texture;
2507  spanData.initTexture(&cursor, 256);
2508  spanData.dx = -offset.x();
2509  spanData.dy = -offset.y();
2510  if (!spanData.blend)
2511  return;
2512 
2513  const QRect rect = QRect(offset, cursor.size())
2514  & QRect(QPoint(0, 0), dest->size());
2515  const int w = rect.width();
2516  const int h = rect.height();
2517 
2519  for (int i = 0; i < h; ++i) {
2520  spans[i].x = rect.x();
2521  spans[i].len = w;
2522  spans[i].y = rect.y() + i;
2523  spans[i].coverage = 255;
2524  }
2525  spanData.blend(h, spans.constData(), &spanData);
2526 }
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
ProcessSpans blend
void initTexture(const QImage *image, int alpha, QTextureData::Type=QTextureData::Plain, const QRect &sourceRect=QRect())
QImage::Format prepare(QImage *image)
QSize size() const
Returns the size of the image, i.
Definition: qimage.cpp:1587
void init(QRasterBuffer *rb, const QRasterPaintEngine *pe)
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 QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
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
enum QSpanData::Type type

◆ blit_template()

template<typename DST , typename SRC >
static void blit_template ( QScreen screen,
const QImage image,
const QPoint topLeft,
const QRegion region 
)
static

Definition at line 615 of file qscreen_qws.cpp.

617 {
618  DST *dest = reinterpret_cast<DST*>(screen->base());
619  const int screenStride = screen->linestep();
620  const int imageStride = image.bytesPerLine();
621 
622  if (region.rectCount() == 1) {
623  const QRect r = region.boundingRect();
624  const SRC *src = reinterpret_cast<const SRC*>(image.scanLine(r.y()))
625  + r.x();
626  qt_rectconvert<DST, SRC>(dest, src,
627  r.x() + topLeft.x(), r.y() + topLeft.y(),
628  r.width(), r.height(),
629  screenStride, imageStride);
630  } else {
631  const QVector<QRect> rects = region.rects();
632 
633  for (int i = 0; i < rects.size(); ++i) {
634  const QRect r = rects.at(i);
635  const SRC *src = reinterpret_cast<const SRC*>(image.scanLine(r.y()))
636  + r.x();
637  qt_rectconvert<DST, SRC>(dest, src,
638  r.x() + topLeft.x(), r.y() + topLeft.y(),
639  r.width(), r.height(),
640  screenStride, imageStride);
641  }
642  }
643 }
int width() const
Returns the width of the rectangle.
Definition: qrect.h:303
int bytesPerLine() const
Returns the number of bytes per image scanline.
Definition: qimage.cpp:1812
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
int height() const
Returns the height of the rectangle.
Definition: qrect.h:306
int rectCount() const
Returns the number of rectangles that will be returned in rects().
Definition: qregion.cpp:4461
int linestep() const
Returns the length of each scanline of the framebuffer in bytes.
Definition: qscreen_qws.h:232
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
uchar * base() const
Returns a pointer to the beginning of the framebuffer.
Definition: qscreen_qws.h:235
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
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Definition: qregion.cpp:4412
The QRect class defines a rectangle in the plane using integer precision.
Definition: qrect.h:58
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
uchar * scanLine(int)
Returns a pointer to the pixel data at the scanline with index i.
Definition: qimage.cpp:1886

◆ qt_blit_setup()

void qt_blit_setup ( QScreen screen,
const QImage image,
const QPoint topLeft,
const QRegion region 
)

Definition at line 1217 of file qscreen_qws.cpp.

Referenced by QScreenPrivate::QScreenPrivate().

1219 {
1220  switch (screen->depth()) {
1221 #ifdef QT_QWS_DEPTH_32
1222  case 32:
1223  if (screen->pixelType() == QScreen::NormalPixel)
1224  screen->d_ptr->blit = blit_32;
1225  else
1226  screen->d_ptr->blit = blit_template<qabgr8888, quint32>;
1227  break;
1228 #endif
1229 #ifdef QT_QWS_DEPTH_24
1230  case 24:
1231  if (screen->pixelType() == QScreen::NormalPixel)
1232  screen->d_ptr->blit = blit_qrgb888;
1233  else
1234  screen->d_ptr->blit = blit_24;
1235  break;
1236 #endif
1237 #ifdef QT_QWS_DEPTH_18
1238  case 18:
1239  screen->d_ptr->blit = blit_18;
1240  break;
1241 #endif
1242 #ifdef QT_QWS_DEPTH_16
1243  case 16:
1244 #if Q_BYTE_ORDER == Q_BIG_ENDIAN
1245  if (screen->d_ptr->fb_is_littleEndian)
1246  screen->d_ptr->blit = blit_16_bigToLittleEndian;
1247  else
1248 #endif
1249  if (screen->pixelType() == QScreen::NormalPixel)
1250  screen->d_ptr->blit = blit_16;
1251  else
1252  screen->d_ptr->blit = blit_template<qbgr565, quint16>;
1253  break;
1254 #endif
1255 #ifdef QT_QWS_DEPTH_15
1256  case 15:
1257 #if Q_BYTE_ORDER == Q_BIG_ENDIAN
1258  if (screen->d_ptr->fb_is_littleEndian)
1259  screen->d_ptr->blit = blit_15_bigToLittleEndian;
1260  else
1261 #endif // Q_BIG_ENDIAN
1262  if (screen->pixelType() == QScreen::NormalPixel)
1263  screen->d_ptr->blit = blit_15;
1264  else
1265  screen->d_ptr->blit = blit_template<qbgr555, qrgb555>;
1266  break;
1267 #endif
1268 #ifdef QT_QWS_DEPTH_12
1269  case 12:
1270  screen->d_ptr->blit = blit_12;
1271  break;
1272 #endif
1273 #ifdef QT_QWS_DEPTH_8
1274  case 8:
1275  screen->d_ptr->blit = blit_8;
1276  break;
1277 #endif
1278 #ifdef QT_QWS_DEPTH_4
1279  case 4:
1280  screen->d_ptr->blit = blit_4;
1281  break;
1282 #endif
1283 #ifdef QT_QWS_DEPTH_1
1284  case 1:
1285  screen->d_ptr->blit = blit_1;
1286  break;
1287 #endif
1288  default:
1289  qFatal("blit_setup(): Screen depth %d not supported!",
1290  screen->depth());
1291  screen->d_ptr->blit = 0;
1292  break;
1293  }
1294  screen->d_ptr->blit(screen, image, topLeft, region);
1295 }
QScreenPrivate * d_ptr
Definition: qscreen_qws.h:374
PixelType pixelType() const
Returns the pixel storage format of the screen.
Definition: qscreen_qws.h:231
Q_CORE_EXPORT void qFatal(const char *,...)
if(void) toggleToolbarShown
int depth() const
Returns the depth of the framebuffer, in bits per pixel.
Definition: qscreen_qws.h:229

◆ qt_get_screen()

Q_GUI_EXPORT QScreen* qt_get_screen ( int  display_id,
const char *  spec 
)

Definition at line 2456 of file qscreen_qws.cpp.

Referenced by QVNCScreen::connect(), QMultiScreen::connect(), QTransformedScreen::connect(), QProxyScreen::connect(), QWSDisplay::Data::init(), and QWSDisplay::Data::reinit().

2457 {
2458  QString displaySpec = QString::fromAscii(spec);
2459  QString driver = displaySpec;
2460  int colon = displaySpec.indexOf(QLatin1Char(':'));
2461  if (colon >= 0)
2462  driver.truncate(colon);
2463  driver = driver.trimmed();
2464 
2465  bool foundDriver = false;
2466  QString driverName = driver;
2467 
2468  QStringList driverList;
2469  if (!driver.isEmpty())
2470  driverList << driver;
2471  else
2472  driverList = QScreenDriverFactory::keys();
2473 
2474  for (int i = 0; i < driverList.size(); ++i) {
2475  const QString driverName = driverList.at(i);
2476  qt_screen = QScreenDriverFactory::create(driverName, display_id);
2477  if (qt_screen) {
2478  foundDriver = true;
2479  if (qt_screen->connect(displaySpec)) {
2480  return qt_screen;
2481  } else {
2482  delete qt_screen;
2483  qt_screen = 0;
2484  }
2485  }
2486  }
2487 
2488  if (driver.isNull())
2489  qFatal("No suitable driver found");
2490  else if (foundDriver)
2491  qFatal("%s: driver cannot connect", driver.toLatin1().constData());
2492  else
2493  qFatal("%s: driver not found", driver.toLatin1().constData());
2494 
2495  return 0;
2496 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
Definition: qstring.cpp:4276
virtual bool connect(const QString &displaySpec)=0
This function is called by every Qt for Embedded Linux application on startup, and must be implemente...
The QString class provides a Unicode character string.
Definition: qstring.h:83
void truncate(int pos)
Truncates the string at the given position index.
Definition: qstring.cpp:4603
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
Definition: qstring.cpp:4506
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
static QScreen * create(const QString &, int)
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
static QStringList keys()
Returns the list of valid keys, i.e.
const char * constData() const
Returns a pointer to the data stored in the byte array.
Definition: qbytearray.h:433
bool isNull() const
Returns true if this string is null; otherwise returns false.
Definition: qstring.h:505
Q_CORE_EXPORT void qFatal(const char *,...)
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ qt_solidFill_setup()

void qt_solidFill_setup ( QScreen screen,
const QColor color,
const QRegion region 
)

Definition at line 544 of file qscreen_qws.cpp.

Referenced by QScreenPrivate::QScreenPrivate().

546 {
547  switch (screen->depth()) {
548 #ifdef QT_QWS_DEPTH_32
549  case 32:
550  if (screen->pixelType() == QScreen::NormalPixel)
551  screen->d_ptr->solidFill = solidFill_template<quint32>;
552  else
553  screen->d_ptr->solidFill = solidFill_template<qabgr8888>;
554  break;
555 #endif
556 #ifdef QT_QWS_DEPTH_24
557  case 24:
558  if (screen->pixelType() == QScreen::NormalPixel)
559  screen->d_ptr->solidFill = solidFill_template<qrgb888>;
560  else
561  screen->d_ptr->solidFill = solidFill_template<quint24>;
562  break;
563 #endif
564 #ifdef QT_QWS_DEPTH_18
565  case 18:
566  screen->d_ptr->solidFill = solidFill_template<quint18>;
567  break;
568 #endif
569 #ifdef QT_QWS_DEPTH_16
570  case 16:
571  if (screen->pixelType() == QScreen::NormalPixel)
572  screen->d_ptr->solidFill = solidFill_template<quint16>;
573  else
574  screen->d_ptr->solidFill = solidFill_template<qbgr565>;
575  break;
576 #endif
577 #ifdef QT_QWS_DEPTH_15
578  case 15:
579  if (screen->pixelType() == QScreen::NormalPixel)
580  screen->d_ptr->solidFill = solidFill_template<qrgb555>;
581  else
582  screen->d_ptr->solidFill = solidFill_template<qbgr555>;
583  break;
584 #endif
585 #ifdef QT_QWS_DEPTH_12
586  case 12:
587  screen->d_ptr->solidFill = solidFill_template<qrgb444>;
588  break;
589 #endif
590 #ifdef QT_QWS_DEPTH_8
591  case 8:
592  screen->d_ptr->solidFill = solidFill_template<quint8>;
593  break;
594 #endif
595 #ifdef QT_QWS_DEPTH_4
596  case 4:
597  screen->d_ptr->solidFill = solidFill_gray4;
598  break;
599 #endif
600 #ifdef QT_QWS_DEPTH_1
601  case 1:
602  screen->d_ptr->solidFill = solidFill_mono;
603  break;
604 #endif
605  default:
606  qFatal("solidFill_setup(): Screen depth %d not supported!",
607  screen->depth());
608  screen->d_ptr->solidFill = 0;
609  break;
610  }
611  screen->d_ptr->solidFill(screen, color, region);
612 }
QScreenPrivate * d_ptr
Definition: qscreen_qws.h:374
PixelType pixelType() const
Returns the pixel storage format of the screen.
Definition: qscreen_qws.h:231
SolidFillFunc solidFill
Q_CORE_EXPORT void qFatal(const char *,...)
if(void) toggleToolbarShown
int depth() const
Returns the depth of the framebuffer, in bits per pixel.
Definition: qscreen_qws.h:229

◆ solidFill_template()

template<typename T >
static void solidFill_template ( QScreen screen,
const QColor color,
const QRegion region 
)
static

Definition at line 405 of file qscreen_qws.cpp.

407 {
408  T *dest = reinterpret_cast<T*>(screen->base());
409  const T c = qt_colorConvert<T, quint32>(color.rgba(), 0);
410  const int stride = screen->linestep();
411  const QVector<QRect> rects = region.rects();
412 
413  for (int i = 0; i < rects.size(); ++i) {
414  const QRect r = rects.at(i);
415  qt_rectfill(dest, c, r.x(), r.y(), r.width(), r.height(), stride);
416  }
417 }
unsigned char c[8]
Definition: qnumeric_p.h:62
void qt_rectfill(T *dest, T value, int x, int y, int width, int height, int stride)
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
int linestep() const
Returns the length of each scanline of the framebuffer in bytes.
Definition: qscreen_qws.h:232
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
uchar * base() const
Returns a pointer to the beginning of the framebuffer.
Definition: qscreen_qws.h:235
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
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Definition: qregion.cpp:4412
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

Variable Documentation

◆ qt_screen

Q_GUI_EXPORT QScreen* qt_screen = 0

Definition at line 69 of file qscreen_qws.cpp.

Referenced by QWSServerPrivate::_q_clientClosed(), QWSServerPrivate::_q_newConnection(), QWSServerPrivate::_q_screenSaverSleep(), QWSServerPrivate::_q_screenSaverWake(), QWSServer::beginDisplayReconfigure(), QWSServerPrivate::closeDisplay(), QVNCScreen::connect(), QMultiScreen::connect(), QTransformedScreen::connect(), QWSWindow::createSurface(), QWSDisplay::depth(), effectiveState(), QWSServer::endDisplayReconfigure(), QQnxScreen::exposeRegion(), QWSServerPrivate::exposeRegion(), QWSDisplay::Data::fillQueue(), QWSDisplay::frameBuffer(), getScreen(), glScreenForDevice(), QWSTtyKbPrivate::handleConsoleSwitch(), QWSDisplay::height(), QScreenCursor::hide(), QWSDisplay::Data::init(), QScreen::instance(), isServerProcess(), QMultiScreenCursor::move(), QScreenCursor::move(), QWSServerPrivate::newMouseHandler(), QWSServerPrivate::openDisplay(), QWSDisplay::pixmapDepth(), QDirectFBKeyboardHandlerPrivate::QDirectFBKeyboardHandlerPrivate(), QQnxMouseHandler::QQnxMouseHandler(), QScreenCursor::QScreenCursor(), qt_conv16ToRgb(), qt_defaultDpiX(), qt_defaultDpiY(), qt_get_screen(), QApplication::qwsSetCustomColors(), QDirectFBKeyboardHandlerPrivate::readKeyboardData(), QWSLinuxInputMousePrivate::readMouseData(), QWSTslibMouseHandlerPrivate::readMouseData(), QWSLinuxTPMouseHandlerPrivate::readMouseData(), screenForDevice(), QWSPcMouseHandlerPrivate::sendEvent(), QWSServer::sendMouseEvent(), QScreenCursor::set(), QWSServer::setBackground(), QQnxScreen::setDirty(), setMaxWindowRect(), QWSServer::setMaxWindowRect(), QWSOnScreenSurface::setPermanentState(), QWSMouseHandler::setScreen(), QWSServer::setScreenSaverIntervals(), QScreenCursor::show(), QWSDisplay::supportsDepth(), PvrEglScreen::transformation(), QWSKeyboardHandler::transformDirKey(), QETWidget::translateMouseEvent(), QWSServerPrivate::update_regions(), QWSDisplay::width(), and QWSDisplay::Data::~Data().

◆ qt_screencursor

Q_GUI_EXPORT QScreenCursor* qt_screencursor = 0

◆ qws_accel

bool qws_accel

Definition at line 133 of file qapplication_qws.cpp.

Referenced by QScreen::shutdownDevice(), and QScreen::subScreenIndexAt().