Qt 4.8
Public Types | Public Functions | Properties | Friends | List of all members
QTransformedScreen Class Reference

The QTransformedScreen class implements a screen driver for a transformed screen. More...

#include <qscreentransformed_qws.h>

Inheritance diagram for QTransformedScreen:
QProxyScreen QScreen

Public Types

enum  Transformation { None, Rot90, Rot180, Rot270 }
 This enum describes the various rotations a transformed screen can have. More...
 
- 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...
 

Public Functions

void blit (const QImage &img, const QPoint &topLeft, const QRegion &region)
 Reimplemented Function More...
 
bool connect (const QString &displaySpec)
 Reimplemented Function More...
 
void exposeRegion (QRegion region, int changing)
 Reimplemented Function More...
 
bool isTransformed () const
 Reimplemented Function More...
 
QSize mapFromDevice (const QSize &s) const
 Reimplemented Function More...
 
QPoint mapFromDevice (const QPoint &, const QSize &) const
 Reimplemented Function More...
 
QRect mapFromDevice (const QRect &, const QSize &) const
 Reimplemented Function More...
 
QRegion mapFromDevice (const QRegion &, const QSize &) const
 Reimplemented Function More...
 
QSize mapToDevice (const QSize &s) const
 Reimplemented Function More...
 
QPoint mapToDevice (const QPoint &, const QSize &) const
 Reimplemented Function More...
 
QRect mapToDevice (const QRect &, const QSize &) const
 Reimplemented Function More...
 
QRegion mapToDevice (const QRegion &, const QSize &) const
 Reimplemented Function More...
 
 QTransformedScreen (int display_id)
 Constructs a QTransformedScreen object. More...
 
QRegion region () const
 Reimplemented Function More...
 
void setDirty (const QRect &)
 Reimplemented Function More...
 
void setTransformation (Transformation t)
 Rotates this screen object according to the specified transformation. More...
 
void solidFill (const QColor &color, const QRegion &region)
 Reimplemented Function More...
 
Transformation transformation () const
 Returns the currently set rotation. More...
 
int transformOrientation () const
 Reimplemented Function More...
 
 ~QTransformedScreen ()
 Destroys the QTransformedScreen object. More...
 
- Public Functions inherited from QProxyScreen
void blank (bool on)
 Reimplemented Function More...
 
QWSWindowSurfacecreateSurface (QWidget *widget) const
 Reimplemented Function More...
 
QWSWindowSurfacecreateSurface (const QString &key) const
 Reimplemented Function More...
 
void disconnect ()
 Reimplemented Function More...
 
void haltUpdates ()
 
bool initDevice ()
 This function is called by the Qt for Embedded Linux server to initialize the framebuffer. More...
 
bool isInterlaced () const
 Reimplemented Function More...
 
int memoryNeeded (const QString &)
 
bool onCard (const unsigned char *) const
 Reimplemented Function More...
 
bool onCard (const unsigned char *, ulong &out_offset) const
 Reimplemented Function More...
 
 QProxyScreen (int display_id, ClassId=ProxyClass)
 Constructs a proxy screen with the given displayId and classId. More...
 
void restore ()
 Reimplemented Function More...
 
void resumeUpdates ()
 
void save ()
 Reimplemented Function More...
 
QScreenscreen () const
 Returns the real screen used by the proxy screen. More...
 
void setMode (int width, int height, int depth)
 Reimplemented Function More...
 
void setScreen (QScreen *screen)
 Sets the real screen to be used by the proxy screen. More...
 
int sharedRamSize (void *)
 
void shutdownDevice ()
 Reimplemented Function More...
 
QList< QScreen * > subScreens () const
 Reimplemented Function More...
 
bool supportsDepth (int) const
 Reimplemented Function More...
 
 ~QProxyScreen ()
 Destroys the proxy screen. More...
 
- 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...
 
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...
 
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...
 
QGraphicsSystemgraphicsSystem () const
 
int height () const
 Returns the logical height of the framebuffer in pixels. More...
 
int linestep () const
 Returns the length of each scanline of the framebuffer in bytes. 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 QImage mapToDevice (const QImage &) const
 Maps the given image from the coordinate space used by the application to the framebuffer coordinate system. More...
 
QT_DEPRECATED int numCols ()
 
QPoint offset () const
 Returns the logical offset of the screen, i. 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...
 
int screenSize () const
 Returns the size of the screen in bytes. More...
 
virtual void set (unsigned int, unsigned int, unsigned int, unsigned int)
 
void setOffset (const QPoint &p)
 
int subScreenIndexAt (const QPoint &p) const
 Returns the index of the subscreen at the given position; returns -1 if no screen is found. More...
 
int totalSize () const
 Returns the size of the available graphics card memory (including the screen) in bytes. 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...
 

Properties

QTransformedScreenPrivated_ptr
 

Friends

class QTransformedScreenPrivate
 

Additional Inherited Members

- 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

The QTransformedScreen class implements a screen driver for a transformed screen.

Warning
This function is not part of the public interface.

Note that this class is only available in Qt for Embedded Linux. Custom screen drivers can be added by subclassing the QScreenDriverPlugin class, using the QScreenDriverFactory class to dynamically load the driver into the application, but there should only be one screen object per application.

Use the QScreen::isTransformed() function to determine if a screen is transformed. The QTransformedScreen class itself provides means of rotating the screen with its setTransformation() function; the transformation() function returns the currently set rotation in terms of the Transformation enum (which describes the various available rotation settings). Alternatively, QTransformedScreen provides an implementation of the QScreen::transformOrientation() function, returning the current rotation as an integer value.

See also
QScreen, QScreenDriverPlugin, {Running Applications}

Definition at line 57 of file qscreentransformed_qws.h.

Enumerations

◆ Transformation

This enum describes the various rotations a transformed screen can have.

  • None No rotation
  • Rot90 90 degrees rotation
  • Rot180 180 degrees rotation
  • Rot270 270 degrees rotation
Enumerator
None 
Rot90 
Rot180 
Rot270 

Definition at line 63 of file qscreentransformed_qws.h.

Constructors and Destructors

◆ QTransformedScreen()

QTransformedScreen::QTransformedScreen ( int  displayId)
explicit

Constructs a QTransformedScreen object.

The displayId argument identifies the Qt for Embedded Linux server to connect to.

Definition at line 161 of file qscreentransformed_qws.cpp.

163 {
164  d_ptr = new QTransformedScreenPrivate(this);
166 
167 #ifdef QT_REGION_DEBUG
168  qDebug() << "QTransformedScreen::QTransformedScreen";
169 #endif
170 }
QProxyScreen(int display_id, ClassId=ProxyClass)
Constructs a proxy screen with the given displayId and classId.
QTransformedScreenPrivate * d_ptr
Q_CORE_EXPORT void qDebug(const char *,...)
int displayId
Definition: qscreen_qws.h:337
QTransformedScreen::Transformation transformation
friend class QTransformedScreenPrivate

◆ ~QTransformedScreen()

QTransformedScreen::~QTransformedScreen ( )

Destroys the QTransformedScreen object.

Definition at line 181 of file qscreentransformed_qws.cpp.

182 {
183  delete d_ptr;
184 }
QTransformedScreenPrivate * d_ptr

Functions

◆ blit()

void QTransformedScreen::blit ( const QImage img,
const QPoint topLeft,
const QRegion region 
)
virtual

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 368 of file qscreentransformed_qws.cpp.

370 {
371  const Transformation trans = d_ptr->transformation;
372  if (trans == None) {
373  QProxyScreen::blit(image, topLeft, region);
374  return;
375  }
376 
377  const QVector<QRect> rects = region.rects();
378  const QRect bound = QRect(0, 0, QScreen::w, QScreen::h)
379  & QRect(topLeft, image.size());
380 
381  BlitFunc func = 0;
382 #ifdef QT_QWS_DEPTH_GENERIC
383  if (d_ptr->doGenericColors && depth() == 16) {
384  if (image.depth() == 16)
385  SET_BLIT_FUNC(qrgb_generic16, quint16, trans, func);
386  else
387  SET_BLIT_FUNC(qrgb_generic16, quint32, trans, func);
388  } else
389 #endif
390  switch (depth()) {
391 #ifdef QT_QWS_DEPTH_32
392  case 32:
393 #ifdef QT_QWS_DEPTH_16
394  if (image.depth() == 16)
395  SET_BLIT_FUNC(quint32, quint16, trans, func);
396  else
397 #endif
398  SET_BLIT_FUNC(quint32, quint32, trans, func);
399  break;
400 #endif
401 #if defined(QT_QWS_DEPTH_24) || defined(QT_QWS_DEPTH18)
402  case 24:
403  case 18:
404  SET_BLIT_FUNC(quint24, quint24, trans, func);
405  break;
406 #endif
407 #if defined(QT_QWS_DEPTH_16) || defined(QT_QWS_DEPTH_15) || defined(QT_QWS_DEPTH_12)
408  case 16:
409 #if defined QT_QWS_ROTATE_BGR
410  if (pixelType() == BGRPixel && image.depth() == 16) {
411  SET_BLIT_FUNC(qbgr565, quint16, trans, func);
412  break;
413  } //fall-through here!!!
414 #endif
415  case 15:
416 #if defined QT_QWS_ROTATE_BGR
417  if (pixelType() == BGRPixel && image.format() == QImage::Format_RGB555) {
418  SET_BLIT_FUNC(qbgr555, qrgb555, trans, func);
419  break;
420  } //fall-through here!!!
421 #endif
422  case 12:
423  if (image.depth() == 16)
424  SET_BLIT_FUNC(quint16, quint16, trans, func);
425  else
426  SET_BLIT_FUNC(quint16, quint32, trans, func);
427  break;
428 #endif
429 #ifdef QT_QWS_DEPTH_8
430  case 8:
431  if (image.format() == QImage::Format_RGB444)
432  SET_BLIT_FUNC(quint8, qrgb444, trans, func);
433  else if (image.depth() == 16)
434  SET_BLIT_FUNC(quint8, quint16, trans, func);
435  else
436  SET_BLIT_FUNC(quint8, quint32, trans, func);
437  break;
438 #endif
439  default:
440  return;
441  }
442  if (!func)
443  return;
444 
446  for (int i = 0; i < rects.size(); ++i) {
447  const QRect r = rects.at(i) & bound;
448 
449  QPoint dst;
450  switch (trans) {
451  case Rot90:
452  dst = mapToDevice(r.topRight(), QSize(w, h));
453  break;
454  case Rot180:
455  dst = mapToDevice(r.bottomRight(), QSize(w, h));
456  break;
457  case Rot270:
458  dst = mapToDevice(r.bottomLeft(), QSize(w, h));
459  break;
460  default:
461  break;
462  }
463  func(this, image, r.translated(-topLeft), dst);
464  }
466 
467 }
Transformation
This enum describes the various rotations a transformed screen can have.
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
Definition: qrect.h:328
unsigned char quint8
Definition: qglobal.h:934
QTransformedScreenPrivate * d_ptr
PixelType pixelType() const
Returns the pixel storage format of the screen.
Definition: qscreen_qws.h:231
QPoint bottomRight() const
Returns the position of the rectangle&#39;s bottom-right corner.
Definition: qrect.h:291
int w
the logical width of the screen.
Definition: qscreen_qws.h:324
unsigned short quint16
Definition: qglobal.h:936
QSize mapToDevice(const QSize &s) const
Reimplemented Function
static void grab()
const T & at(int i) const
Returns the item at index position i in the vector.
Definition: qvector.h:350
QPoint topRight() const
Returns the position of the rectangle&#39;s top-right corner.
Definition: qrect.h:294
void blit(const QImage &img, const QPoint &topLeft, const QRegion &region)
Reimplemented Function
QPoint bottomLeft() const
Returns the position of the rectangle&#39;s bottom-left corner.
Definition: qrect.h:297
QTransformedScreen::Transformation transformation
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Definition: qregion.cpp:4412
unsigned int quint32
Definition: qglobal.h:938
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
int h
the logical height of the screen.
Definition: qscreen_qws.h:326
static void ungrab()
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137
int depth() const
Returns the depth of the framebuffer, in bits per pixel.
Definition: qscreen_qws.h:229
void(* BlitFunc)(QScreen *, const QImage &, const QRect &, const QPoint &)
#define SET_BLIT_FUNC(dst, src, rotation, func)

◆ connect()

bool QTransformedScreen::connect ( const QString displaySpec)
virtual

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 211 of file qscreentransformed_qws.cpp.

212 {
213  QString dspec = displaySpec.trimmed();
214  if (dspec.startsWith(QLatin1String("Transformed:"), Qt::CaseInsensitive))
215  dspec = dspec.mid(QString::fromLatin1("Transformed:").size());
216  else if (!dspec.compare(QLatin1String("Transformed"), Qt::CaseInsensitive))
217  dspec = QString();
218 
219  const QString displayIdSpec = QString::fromLatin1(" :%1").arg(displayId);
220  if (dspec.endsWith(displayIdSpec))
221  dspec = dspec.left(dspec.size() - displayIdSpec.size());
222 
224 
225  QString driver = dspec;
226  int colon = driver.indexOf(QLatin1Char(':'));
227  if (colon >= 0)
228  driver.truncate(colon);
229 
230  if (!QScreenDriverFactory::keys().contains(driver, Qt::CaseInsensitive))
231  if (!dspec.isEmpty())
232  dspec.prepend(QLatin1Char(':'));
233 
234  const int id = getDisplayId(dspec);
235  QScreen *s = qt_get_screen(id, dspec.toLatin1().constData());
236  setScreen(s);
237 
238 #ifdef QT_QWS_DEPTH_GENERIC
239  d_ptr->doGenericColors = dspec.contains(QLatin1String("genericcolors"));
240 #endif
241 
242  d_ptr->configure();
243 
244  // XXX
245  qt_screen = this;
246 
247  return true;
248 }
Q_GUI_EXPORT QScreen * qt_screen
Definition: qscreen_qws.cpp:69
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.h:904
void setScreen(QScreen *screen)
Sets the real screen to be used by the proxy screen.
QString & prepend(QChar c)
Definition: qstring.h:261
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
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Q_GUI_EXPORT QScreen * qt_get_screen(int display_id, const char *spec)
The QString class provides a Unicode character string.
Definition: qstring.h:83
QTransformedScreenPrivate * d_ptr
void truncate(int pos)
Truncates the string at the given position index.
Definition: qstring.cpp:4603
QString left(int n) const Q_REQUIRED_RESULT
Returns a substring that contains the n leftmost characters of the string.
Definition: qstring.cpp:3664
QString trimmed() const Q_REQUIRED_RESULT
Returns a string that has whitespace removed from the start and the end.
Definition: qstring.cpp:4506
int size() const
Returns the number of characters in this string.
Definition: qstring.h:102
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
Definition: qstring.h:704
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
The QLatin1String class provides a thin wrapper around an US-ASCII/Latin-1 encoded string literal...
Definition: qstring.h:654
QByteArray toLatin1() const Q_REQUIRED_RESULT
Returns a Latin-1 representation of the string as a QByteArray.
Definition: qstring.cpp:3993
int displayId
Definition: qscreen_qws.h:337
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
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706
QString arg(qlonglong a, int fieldwidth=0, int base=10, const QChar &fillChar=QLatin1Char(' ')) const Q_REQUIRED_RESULT
Definition: qstring.cpp:7186
int compare(const QString &s) const
Definition: qstring.cpp:5037
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
QTransformedScreen::Transformation transformation
static int getDisplayId(const QString &spec)
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
bool endsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string ends with s; otherwise returns false.
Definition: qstring.cpp:3796
static QTransformedScreen::Transformation filterTransformation(QString &spec)
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ exposeRegion()

void QTransformedScreen::exposeRegion ( QRegion  region,
int  changing 
)
virtual

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 271 of file qscreentransformed_qws.cpp.

272 {
273  if (!data || d_ptr->transformation == None) {
274  QProxyScreen::exposeRegion(region, changing);
275  return;
276  }
277  QScreen::exposeRegion(region, changing);
278 }
QTransformedScreenPrivate * d_ptr
uchar * data
points to the first visible pixel in the frame buffer.
Definition: qscreen_qws.h:311
void exposeRegion(QRegion r, int changing)
Reimplemented Function
QTransformedScreen::Transformation transformation
virtual void exposeRegion(QRegion r, int changing)
This function is called by the Qt for Embedded Linux server whenever a screen update is required...

◆ isTransformed()

bool QTransformedScreen::isTransformed ( ) const
inlinevirtual

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 83 of file qscreentransformed_qws.h.

83 { return transformation() != None; }
Transformation transformation() const
Returns the currently set rotation.

◆ mapFromDevice() [1/4]

QSize QTransformedScreen::mapFromDevice ( const QSize s) const
virtual

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 504 of file qscreentransformed_qws.cpp.

Referenced by region(), and setTransformation().

505 {
506  switch (d_ptr->transformation) {
507  case None:
508  case Rot180:
509  break;
510  case Rot90:
511  case Rot270:
512  return QSize(s.height(), s.width());
513  break;
514  }
515  return s;
516 }
QTransformedScreenPrivate * d_ptr
int width() const
Returns the width.
Definition: qsize.h:126
QTransformedScreen::Transformation transformation
int height() const
Returns the height.
Definition: qsize.h:129
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ mapFromDevice() [2/4]

QPoint QTransformedScreen::mapFromDevice ( const QPoint p,
const QSize s 
) const
virtual

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 548 of file qscreentransformed_qws.cpp.

549 {
550  QPoint rp(p);
551 
552  switch (d_ptr->transformation) {
553  case None:
554  break;
555  case Rot90:
556  rp.setX(s.height() - p.y() - 1);
557  rp.setY(p.x());
558  break;
559  case Rot180:
560  rp.setX(s.width() - p.x() - 1);
561  rp.setY(s.height() - p.y() - 1);
562  break;
563  case Rot270:
564  rp.setX(p.y());
565  rp.setY(s.width() - p.x() - 1);
566  break;
567  }
568 
569  return rp;
570 }
QTransformedScreenPrivate * d_ptr
int width() const
Returns the width.
Definition: qsize.h:126
QTransformedScreen::Transformation transformation
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int height() const
Returns the height.
Definition: qsize.h:129
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

◆ mapFromDevice() [3/4]

QRect QTransformedScreen::mapFromDevice ( const QRect r,
const QSize s 
) const
virtual

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 605 of file qscreentransformed_qws.cpp.

606 {
607  if (r.isNull())
608  return QRect();
609 
610  QRect tr;
611  switch (d_ptr->transformation) {
612  case None:
613  tr = r;
614  break;
615  case Rot90:
616  tr.setCoords(s.height() - r.y() - 1, r.x(),
617  s.height() - r.bottom() - 1, r.right());
618  break;
619  case Rot180:
620  tr.setCoords(s.width() - r.x() - 1, s.height() - r.y() - 1,
621  s.width() - r.right() - 1, s.height() - r.bottom() - 1);
622  break;
623  case Rot270:
624  tr.setCoords(r.y(), s.width() - r.x() - 1,
625  r.bottom(), s.width() - r.right() - 1);
626  break;
627  }
628 
629  return correctNormalized(tr);
630 }
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition: qrect.h:231
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
static QRect correctNormalized(const QRect &r)
QTransformedScreenPrivate * d_ptr
int width() const
Returns the width.
Definition: qsize.h:126
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle&#39;s top-left corner to (x1, y1), and the coordinates of its botto...
Definition: qrect.h:416
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
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
QTransformedScreen::Transformation transformation
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

◆ mapFromDevice() [4/4]

QRegion QTransformedScreen::mapFromDevice ( const QRegion rgn,
const QSize s 
) const
virtual

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 686 of file qscreentransformed_qws.cpp.

687 {
688  if (d_ptr->transformation == None)
689  return QProxyScreen::mapFromDevice(rgn, s);
690 
691 #ifdef QT_REGION_DEBUG
692  qDebug() << "fromDevice: realRegion count: " << rgn.rects().size() << " isEmpty? " << rgn.isEmpty() << " bounds:" << rgn.boundingRect();
693 #endif
694  QRect tr;
695  QRegion trgn;
696  QVector<QRect> a = rgn.rects();
697  const QRect *r = a.data();
698 
699  int w = s.width();
700  int h = s.height();
701  int size = a.size();
702 
703  switch (d_ptr->transformation) {
704  case None:
705  break;
706  case Rot90:
707  for (int i = 0; i < size; i++, r++) {
708  tr.setCoords(h - r->y() - 1, r->x(),
709  h - r->bottom() - 1, r->right());
710  trgn |= correctNormalized(tr);
711  }
712  break;
713  case Rot180:
714  for (int i = 0; i < size; i++, r++) {
715  tr.setCoords(w - r->x() - 1, h - r->y() - 1,
716  w - r->right() - 1, h - r->bottom() - 1);
717  trgn |= correctNormalized(tr);
718  }
719  break;
720  case Rot270:
721  for (int i = 0; i < size; i++, r++) {
722  tr.setCoords(r->y(), w - r->x() - 1,
723  r->bottom(), w - r->right() - 1);
724  trgn |= correctNormalized(tr);
725  }
726  break;
727  }
728 #ifdef QT_REGION_DEBUG
729  qDebug() << "fromDevice: transRegion count: " << trgn.rects().size() << " isEmpty? " << trgn.isEmpty() << " bounds:" << trgn.boundingRect();
730 #endif
731  return trgn;
732 }
long ASN1_INTEGER_get ASN1_INTEGER * a
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
static QRect correctNormalized(const QRect &r)
int size
the number of bytes in the visible region of the frame buffer
Definition: qscreen_qws.h:334
QTransformedScreenPrivate * d_ptr
Q_CORE_EXPORT void qDebug(const char *,...)
int width() const
Returns the width.
Definition: qsize.h:126
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
Definition: qregion.cpp:4098
int w
the logical width of the screen.
Definition: qscreen_qws.h:324
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle&#39;s top-left corner to (x1, y1), and the coordinates of its botto...
Definition: qrect.h:416
QSize mapFromDevice(const QSize &s) const
Reimplemented Function
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
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
QTransformedScreen::Transformation transformation
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
Definition: qregion.cpp:4412
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
T * data()
Returns a pointer to the data stored in the vector.
Definition: qvector.h:152
int h
the logical height of the screen.
Definition: qscreen_qws.h:326
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137

◆ mapToDevice() [1/4]

QSize QTransformedScreen::mapToDevice ( const QSize s) const
virtual

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 487 of file qscreentransformed_qws.cpp.

Referenced by blit(), setDirty(), and solidFill().

488 {
489  switch (d_ptr->transformation) {
490  case None:
491  case Rot180:
492  break;
493  case Rot90:
494  case Rot270:
495  return QSize(s.height(), s.width());
496  break;
497  }
498  return s;
499 }
QTransformedScreenPrivate * d_ptr
int width() const
Returns the width.
Definition: qsize.h:126
QTransformedScreen::Transformation transformation
int height() const
Returns the height.
Definition: qsize.h:129
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53

◆ mapToDevice() [2/4]

QPoint QTransformedScreen::mapToDevice ( const QPoint p,
const QSize s 
) const
virtual

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 521 of file qscreentransformed_qws.cpp.

522 {
523  QPoint rp(p);
524 
525  switch (d_ptr->transformation) {
526  case None:
527  break;
528  case Rot90:
529  rp.setX(p.y());
530  rp.setY(s.width() - p.x() - 1);
531  break;
532  case Rot180:
533  rp.setX(s.width() - p.x() - 1);
534  rp.setY(s.height() - p.y() - 1);
535  break;
536  case Rot270:
537  rp.setX(s.height() - p.y() - 1);
538  rp.setY(p.x());
539  break;
540  }
541 
542  return rp;
543 }
QTransformedScreenPrivate * d_ptr
int width() const
Returns the width.
Definition: qsize.h:126
QTransformedScreen::Transformation transformation
The QPoint class defines a point in the plane using integer precision.
Definition: qpoint.h:53
int height() const
Returns the height.
Definition: qsize.h:129
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

◆ mapToDevice() [3/4]

QRect QTransformedScreen::mapToDevice ( const QRect r,
const QSize s 
) const
virtual

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 575 of file qscreentransformed_qws.cpp.

576 {
577  if (r.isNull())
578  return QRect();
579 
580  QRect tr;
581  switch (d_ptr->transformation) {
582  case None:
583  tr = r;
584  break;
585  case Rot90:
586  tr.setCoords(r.y(), s.width() - r.x() - 1,
587  r.bottom(), s.width() - r.right() - 1);
588  break;
589  case Rot180:
590  tr.setCoords(s.width() - r.x() - 1, s.height() - r.y() - 1,
591  s.width() - r.right() - 1, s.height() - r.bottom() - 1);
592  break;
593  case Rot270:
594  tr.setCoords(s.height() - r.y() - 1, r.x(),
595  s.height() - r.bottom() - 1, r.right());
596  break;
597  }
598 
599  return correctNormalized(tr);
600 }
bool isNull() const
Returns true if the rectangle is a null rectangle, otherwise returns false.
Definition: qrect.h:231
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
static QRect correctNormalized(const QRect &r)
QTransformedScreenPrivate * d_ptr
int width() const
Returns the width.
Definition: qsize.h:126
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle&#39;s top-left corner to (x1, y1), and the coordinates of its botto...
Definition: qrect.h:416
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
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
QTransformedScreen::Transformation transformation
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

◆ mapToDevice() [4/4]

QRegion QTransformedScreen::mapToDevice ( const QRegion rgn,
const QSize s 
) const
virtual

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 635 of file qscreentransformed_qws.cpp.

636 {
637  if (d_ptr->transformation == None)
638  return QProxyScreen::mapToDevice(rgn, s);
639 
640 #ifdef QT_REGION_DEBUG
641  qDebug() << "mapToDevice size" << s << "rgn: " << rgn;
642 #endif
643  QRect tr;
644  QRegion trgn;
645  QVector<QRect> a = rgn.rects();
646  const QRect *r = a.data();
647 
648  int w = s.width();
649  int h = s.height();
650  int size = a.size();
651 
652  switch (d_ptr->transformation) {
653  case None:
654  break;
655  case Rot90:
656  for (int i = 0; i < size; i++, r++) {
657  tr.setCoords(r->y(), w - r->x() - 1,
658  r->bottom(), w - r->right() - 1);
659  trgn |= correctNormalized(tr);
660  }
661  break;
662  case Rot180:
663  for (int i = 0; i < size; i++, r++) {
664  tr.setCoords(w - r->x() - 1, h - r->y() - 1,
665  w - r->right() - 1, h - r->bottom() - 1);
666  trgn |= correctNormalized(tr);
667  }
668  break;
669  case Rot270:
670  for (int i = 0; i < size; i++, r++) {
671  tr.setCoords(h - r->y() - 1, r->x(),
672  h - r->bottom() - 1, r->right());
673  trgn |= correctNormalized(tr);
674  }
675  break;
676  }
677 #ifdef QT_REGION_DEBUG
678  qDebug() << "mapToDevice trgn: " << trgn;
679 #endif
680  return trgn;
681 }
long ASN1_INTEGER_get ASN1_INTEGER * a
int bottom() const
Returns the y-coordinate of the rectangle&#39;s bottom edge.
Definition: qrect.h:249
static QRect correctNormalized(const QRect &r)
int size
the number of bytes in the visible region of the frame buffer
Definition: qscreen_qws.h:334
QTransformedScreenPrivate * d_ptr
Q_CORE_EXPORT void qDebug(const char *,...)
int width() const
Returns the width.
Definition: qsize.h:126
int w
the logical width of the screen.
Definition: qscreen_qws.h:324
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
void setCoords(int x1, int y1, int x2, int y2)
Sets the coordinates of the rectangle&#39;s top-left corner to (x1, y1), and the coordinates of its botto...
Definition: qrect.h:416
int right() const
Returns the x-coordinate of the rectangle&#39;s right edge.
Definition: qrect.h:246
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
QTransformedScreen::Transformation transformation
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
QSize mapToDevice(const QSize &s) const
Reimplemented Function
T * data()
Returns a pointer to the data stored in the vector.
Definition: qvector.h:152
int h
the logical height of the screen.
Definition: qscreen_qws.h:326
int size() const
Returns the number of items in the vector.
Definition: qvector.h:137

◆ region()

QRegion QTransformedScreen::region ( ) const
virtual

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 746 of file qscreentransformed_qws.cpp.

747 {
748  QRegion deviceRegion = QProxyScreen::region();
749  return mapFromDevice(deviceRegion, QSize(deviceWidth(), deviceHeight()));
750 }
QRegion region() const
Reimplemented Function
int deviceWidth() const
Returns the physical width of the framebuffer device in pixels.
Definition: qscreen_qws.h:233
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
int deviceHeight() const
Returns the full height of the framebuffer device in pixels.
Definition: qscreen_qws.h:234
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
QSize mapFromDevice(const QSize &s) const
Reimplemented Function

◆ setDirty()

void QTransformedScreen::setDirty ( const QRect rect)
virtual

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 737 of file qscreentransformed_qws.cpp.

738 {
739  const QRect r = mapToDevice(rect, QSize(width(), height()));
741 }
int height() const
Returns the logical height of the framebuffer in pixels.
Definition: qscreen_qws.h:228
int width() const
Returns the logical width of the framebuffer in pixels.
Definition: qscreen_qws.h:227
void setDirty(const QRect &)
Reimplemented Function
QSize mapToDevice(const QSize &s) const
Reimplemented Function
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

◆ setTransformation()

void QTransformedScreen::setTransformation ( Transformation  transformation)

Rotates this screen object according to the specified transformation.

See also
transformation()

Definition at line 285 of file qscreentransformed_qws.cpp.

Referenced by qws_setScreenTransformation().

286 {
289  w = size.width();
290  h = size.height();
291 
292  const QScreen *s = screen();
293  size = mapFromDevice(QSize(s->physicalWidth(), s->physicalHeight()));
294  physWidth = size.width();
295  physHeight = size.height();
296 
297 #ifdef QT_REGION_DEBUG
298  qDebug() << "QTransformedScreen::setTransformation" << transformation
299  << "size" << w << h << "dev size" << dw << dh;
300 #endif
301 
302 }
int physicalHeight() const
Returns the physical height of the screen in millimeters.
Definition: qscreen_qws.h:291
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
QTransformedScreenPrivate * d_ptr
int physWidth
the physical width of the screen in millimeters.
Definition: qscreen_qws.h:339
Q_CORE_EXPORT void qDebug(const char *,...)
int width() const
Returns the width.
Definition: qsize.h:126
int w
the logical width of the screen.
Definition: qscreen_qws.h:324
int dw
the device width
Definition: qscreen_qws.h:331
int dh
the device height
Definition: qscreen_qws.h:332
QTransformedScreen::Transformation transformation
int height() const
Returns the height.
Definition: qsize.h:129
The QScreen class is a base class for screen drivers in Qt for Embedded Linux.
Definition: qscreen_qws.h:191
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
int h
the logical height of the screen.
Definition: qscreen_qws.h:326
QScreen * screen() const
Returns the real screen used by the proxy screen.
int physicalWidth() const
Returns the physical width of the screen in millimeters.
Definition: qscreen_qws.h:290
QSize mapFromDevice(const QSize &s) const
Reimplemented Function
Transformation transformation() const
Returns the currently set rotation.

◆ solidFill()

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

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 472 of file qscreentransformed_qws.cpp.

473 {
474  const QRegion tr = mapToDevice(region, QSize(w,h));
475 
476  Q_ASSERT(tr.boundingRect() == mapToDevice(region.boundingRect(), QSize(w,h)));
477 
478 #ifdef QT_REGION_DEBUG
479  qDebug() << "QTransformedScreen::solidFill region" << region << "transformed" << tr;
480 #endif
481  QProxyScreen::solidFill(color, tr);
482 }
QRect boundingRect() const
Returns the bounding rectangle of this region.
Definition: qregion.cpp:4363
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
Q_CORE_EXPORT void qDebug(const char *,...)
int w
the logical width of the screen.
Definition: qscreen_qws.h:324
QSize mapToDevice(const QSize &s) const
Reimplemented Function
The QRegion class specifies a clip region for a painter.
Definition: qregion.h:68
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
int h
the logical height of the screen.
Definition: qscreen_qws.h:326
void solidFill(const QColor &color, const QRegion &region)
Reimplemented Function

◆ transformation()

QTransformedScreen::Transformation QTransformedScreen::transformation ( ) const

Returns the currently set rotation.

See also
setTransformation(), QScreen::transformOrientation()

Definition at line 255 of file qscreentransformed_qws.cpp.

Referenced by QTransformedScreenPrivate::configure(), and setTransformation().

256 {
257  return d_ptr->transformation;
258 }
QTransformedScreenPrivate * d_ptr
QTransformedScreen::Transformation transformation

◆ transformOrientation()

int QTransformedScreen::transformOrientation ( ) const
virtual

Reimplemented Function

Reimplemented from QProxyScreen.

Definition at line 263 of file qscreentransformed_qws.cpp.

264 {
265  return (int)d_ptr->transformation;
266 }
QTransformedScreenPrivate * d_ptr
QTransformedScreen::Transformation transformation

Friends and Related Functions

◆ QTransformedScreenPrivate

Definition at line 93 of file qscreentransformed_qws.h.

Referenced by QTransformedScreen().

Properties

◆ d_ptr

QTransformedScreenPrivate* QTransformedScreen::d_ptr
private

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