51 #include <private/qapplication_p.h> 52 #include <private/qwsdisplay_qws_p.h> 53 #include <private/qwidget_p.h> 54 #include <private/qwsmanager_p.h> 55 #include <private/qwslock_p.h> 56 #include <private/qbackingstore_p.h> 61 #ifdef Q_BACKINGSTORE_SUBSURFACES 68 return winIdToSurfaceMap()->value(winId);
74 winIdToSurfaceMap()->remove(winId);
76 winIdToSurfaceMap()->insert(winId, surface);
79 #endif // Q_BACKINGSTORE_SUBSURFACES 105 qFatal(
"QWSWindowSurface: Invalid backingstore format: %i",
127 qFatal(
"QWSWindowSurface: Invalid backingstore format: %i",
136 return ((n + 3) & 0xfffffffc);
154 win->d_func()->invalidateBuffer(win->
rect());
155 #ifndef QT_NO_QWS_MANAGER 156 QTLWExtra *topextra = win->d_func()->extra->topextra;
157 QWSManager *manager = topextra->qwsManager;
167 #ifdef QT_QWS_CLIENTBLIT
187 #ifdef Q_BACKINGSTORE_SUBSURFACES 191 const int id = display->
takeId();
192 qt_insertWindowSurface(
id, that);
451 #ifdef Q_BACKINGSTORE_SUBSURFACES 513 #ifdef QT_QWS_CLIENTBLIT 515 const QRegion QWSWindowSurface::directRegion()
const 517 return d_ptr->direct;
521 int QWSWindowSurface::directRegionId()
const 523 return d_ptr->directId;
527 void QWSWindowSurface::setDirectRegion(
const QRegion &r,
int id)
530 d_ptr->directId = id;
567 win->d_func()->syncBackingStore(expose);
571 #ifndef QT_NO_QWS_MANAGER 574 QTLWExtra *topextra = win->d_func()->extra->topextra;
575 if (QWSManager *manager = topextra->qwsManager) {
576 QRegion decorationExpose(manager->region());
578 decorationExpose &= expose;
579 if (!decorationExpose.isEmpty()) {
580 expose -= decorationExpose;
588 win->d_func()->invalidateBuffer(expose);
618 #ifndef QT_NO_QWS_MANAGER 620 QTLWExtra *topextra = win->d_func()->extra->topextra;
621 QWSManager *manager = topextra->qwsManager;
626 mask &= (manager->region() + win->
geometry());
645 const bool needsRepaint = isResize || !
isBuffered();
655 if (requestQWSRegion)
661 if (!requestQWSRegion) {
673 #ifdef QT_NO_PAINT_DEBUG 678 static int delay = -1;
688 surface.
flush(widget, region, offset);
689 #endif // QT_NO_PAINT_DEBUG 699 #ifndef QT_NO_GRAPHICSVIEW 700 QWExtra *extra = win->d_func()->extra;
703 #endif //QT_NO_GRAPHICSVIEW 708 #ifdef QT_QWS_DISABLE_FLUSHCLIPPING 719 #ifdef QT_QWS_CLIENTBLIT 720 bool needRepaint =
true;
723 if (widgetScreen->supportsBlitInClients()) {
726 if(directRegion().intersected(toFlush) == toFlush) {
782 return oldGeometry + newClip;
792 #ifndef QT_NO_QWS_MULTIPROCESS 807 #ifndef QT_NO_QWS_MULTIPROCESS 830 #ifndef QT_NO_QWS_MULTIPROCESS 837 #ifndef QT_NO_QWS_MULTIPROCESS 848 const int depth = screen->
depth();
854 else if (depth <= 15)
856 else if (depth <= 16)
858 else if (depth <= 18)
870 else if (depth <= 15)
872 else if (depth <= 16)
874 else if (depth <= 18)
876 else if (depth <= 24)
882 #ifndef QT_NO_QWS_MULTIPROCESS 891 #endif // QT_NO_QWS_MULTIPROCESS 918 #ifdef Q_BACKINGSTORE_SUBSURFACES 933 for (
int i = 0; i < rects.
size(); ++i)
980 uchar *deleteLater = 0;
982 if (img.
size() != size) {
995 const int imagesize = bpl * size.
height();
1008 delete[] deleteLater;
1018 ptr +=
sizeof(
uchar*);
1020 reinterpret_cast<int*
>(
ptr)[0] = img.
width();
1021 reinterpret_cast<int*
>(
ptr)[1] = img.
height();
1022 ptr += 2 *
sizeof(int);
1024 *
reinterpret_cast<int *
>(
ptr) = img.
format();
1047 ptr +=
sizeof(
uchar*);
1049 width =
reinterpret_cast<const int*
>(
ptr)[0];
1050 height =
reinterpret_cast<const int*
>(
ptr)[1];
1051 ptr += 2 *
sizeof(int);
1056 flags = *
reinterpret_cast<const SurfaceFlags*
>(
ptr);
1073 #ifndef QT_NO_QWS_MULTIPROCESS 1092 if (
mem.
id() == memId)
1097 if (memId != -1 && !
mem.
attach(memId)) {
1099 perror(
"QWSSharedMemSurface: attaching to shared memory");
1100 qCritical(
"QWSSharedMemSurface: Error attaching to shared memory 0x%x", memId);
1108 #ifdef QT_QWS_CLIENTBLIT 1109 void QWSSharedMemSurface::setDirectRegion(
const QRegion &r,
int id)
1111 QWSMemorySurface::setDirectRegion(r,
id);
1116 const QRegion QWSSharedMemSurface::directRegion()
const 1119 return QWSMemorySurface::directRegion();
1133 const int *
ptr =
reinterpret_cast<const int*
>(data.
constData());
1140 flags = SurfaceFlags(ptr[5]);
1146 #ifdef QT_QWS_CLIENTBLIT 1158 if (img.
size() != size) {
1166 #ifdef QT_QWS_CLIENTBLIT 1167 const int imagesize = bpl * size.
height() +
sizeof(
uint);
1169 const int imagesize = bpl * size.
height();
1174 perror(
"QWSSharedMemSurface::setGeometry allocating shared memory");
1175 qFatal(
"Error creating shared memory of size %d", imagesize);
1178 #ifdef QT_QWS_CLIENTBLIT 1196 int *
ptr =
reinterpret_cast<int*
>(array.
data());
1199 ptr[1] = img.
width();
1202 ptr[4] = int(img.
format());
1214 #endif // QT_NO_QWS_MULTIPROCESS 1216 #ifndef QT_NO_PAINTONSCREEN 1239 qFatal(
"QWSOnScreenSurface::attachToScreen(): screen depth %d " 1270 int *
ptr =
reinterpret_cast<int*
>(array.
data());
1277 const int *
ptr =
reinterpret_cast<const int*
>(data.
constData());
1278 const int screenNo = ptr[0];
1286 #endif // QT_NO_PAINTONSCREEN 1288 #ifndef QT_NO_PAINT_DEBUG 1311 int *
ptr =
reinterpret_cast<int*
>(array.
data());
1320 const int *
ptr =
reinterpret_cast<const int*
>(data.
constData());
1322 const int width = ptr[0];
1323 const int height = ptr[1];
1342 const int id =
winId();
1347 ::usleep(500 *
delay);
1349 ::usleep(500 *
delay);
1352 #endif // QT_NO_PAINT_DEBUG 1354 #ifndef QT_NO_DIRECTPAINTER 1359 if (!screen->
base()) {
1361 if (subScreens.
size() < 1)
1363 screen = subScreens.
at(0);
1386 if (subScreens.
size() < 1)
1401 const int id =
winId();
1403 #ifndef QT_NO_QWS_MULTIPROCESS 1424 if (ba.
size() > 0 && ba.
at(0) ==
'r')
1432 #ifndef QT_NO_QWS_MULTIPROCESS 1443 #ifndef QT_NO_QWS_MULTIPROCESS 1455 #ifndef QT_NO_THREAD 1468 #ifndef QT_NO_THREAD 1473 #endif // QT_NO_DIRECTPAINTER Q_GUI_EXPORT QScreen * qt_screen
The QPainter class performs low-level painting on widgets and other paint devices.
The QColor class provides colors based on RGB, HSV or CMYK values.
void nameRegion(int winId, const QString &n, const QString &c)
QRect geometry() const
Returns the currently allocated area on the screen.
The QWSWindowSurface class provides the drawing area for top-level windows in Qt for Embedded Linux...
The QWSDisplay class provides a display for QWS; it is an internal class.
Format
The following image formats are available in Qt.
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
int height() const
Returns the logical height of the framebuffer in pixels.
bool isWidgetOpaque(const QWidget *w)
#define QT_END_NAMESPACE
This macro expands to.
void lock()
Locks the mutex.
const QRegion clipRegion() const
Returns the region currently visible on the screen.
QPointer< QWidget > widget
void beginPaint(const QRegion &)
This function is called before painting onto the surface begins, with the region in which the paintin...
char * data()
Returns a pointer to the data stored in the byte array.
void setAltitude(int winId, int altitude, bool fixed=false)
int physicalHeight() const
Returns the physical height of the screen in millimeters.
static QWSDisplay * qwsDisplay()
QWSYellowSurface(bool isClient=false)
QRect rect(const QWidget *widget) const
Returns the rectangle for widget in the coordinates of this window surface.
#define it(className, varName)
void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
void repaintRegion(int winId, int windowFlags, bool opaque, QRegion)
QByteArray & append(char c)
Appends the character ch to this byte array.
static QScreen * getScreen(const QWidget *w)
bool isNull() const
Returns true if it is a null image, otherwise returns false.
void fill(uint pixel)
Fills the entire image with the given pixelValue.
bool isValid() const
Implement this function to return true if the surface is a valid surface for the given top-level wind...
The QByteArray class provides an array of bytes.
bool hasPendingRegionEvents() const
~QWSDirectPainterSurface()
virtual QByteArray permanentState() const
Implement this function to return the data required for creating a server-side representation of the ...
QString key() const
Implement this function to return a string that uniquely identifies the class of this surface...
static int bytesPerPixel(QImage::Format format)
void setPermanentState(const QByteArray &data)
Implement this function to attach a server-side surface instance to the corresponding client side ins...
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...
virtual void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
virtual QPoint offset(const QWidget *widget) const
Returns the offset of widget in the coordinates of this window surface.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QByteArray permanentState() const
Implement this function to return the data required for creating a server-side representation of the ...
bool lock(int timeout=-1)
void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset)
Flushes the given region from the specified widget onto the screen.
virtual void beginPaint(const QRegion &)
This function is called before painting onto the surface begins, with the region in which the paintin...
QRect boundingRect() const
Returns the bounding rectangle of this region.
void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
void attachToScreen(const QScreen *screen)
bool isBuffered() const
Returns true if the QWSWindowSurface::Buffered is set; otherwise returns false.
void setSurfaceFlags(SurfaceFlags type)
Sets the surface flags describing the contents of this surface, to be the given flags.
static int nextMulOf4(int n)
The QString class provides a Unicode character string.
QWSWindowSurface::SurfaceFlags flags
void setPermanentState(const QByteArray &data)
Implement this function to attach a server-side surface instance to the corresponding client side ins...
virtual bool lock(int timeout=-1)
virtual void setDirty(const QRect &)
Marks the given rectangle as dirty.
virtual void setTransientState(const QByteArray &state)
Format format() const
Returns the format of the image.
QWSWindowSurfacePrivate * d_ptr
void destroyRegion(int winId)
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
virtual void releaseSurface()
iterator end()
Returns an STL-style iterator pointing to the imaginary item after the last item in the vector...
virtual void releaseSurface()
virtual void blit(const QImage &img, const QPoint &topLeft, const QRegion ®ion)
Copies the given region in the given image to the point specified by topLeft using device coordinates...
QByteArray permanentState() const
Implement this function to return the data required for creating a server-side representation of the ...
bool isValid() const
Implement this function to return true if the surface is a valid surface for the given top-level wind...
void waitForRegionAck(int winId)
int width() const
Returns the logical width of the framebuffer in pixels.
int width() const
Returns the width.
void requestRegion(int winId, const QString &surfacekey, const QByteArray &surfaceData, const QRegion ®ion)
#define QT_BEGIN_NAMESPACE
This macro expands to.
QString key() const
Implement this function to return a string that uniquely identifies the class of this surface...
void setPermanentState(const QByteArray &)
Implement this function to attach a server-side surface instance to the corresponding client side ins...
virtual void releaseSurface()
Q_GUI_EXPORT_INLINE QRgb qRgba(int r, int g, int b, int a)
int linestep() const
Returns the length of each scanline of the framebuffer in bytes.
Q_GUI_EXPORT EGLDisplay display()
void setPermanentState(const QByteArray &data)
Implement this function to attach a server-side surface instance to the corresponding client side ins...
void setRegion(const QRegion ®ion)
QByteArray permanentState() const
Implement this function to return the data required for creating a server-side representation of the ...
virtual bool move(const QPoint &offset)
Move the surface with the given offset.
bool scroll(const QRegion &area, int dx, int dy)
Scrolls the given area dx pixels to the right and dy downward; both dx and dy may be negative...
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
QPoint painterOffset() const
Returns the offset to be used when painting.
#define Q_GLOBAL_STATIC(TYPE, NAME)
Declares a global static variable with the given type and name.
QSize size() const
Returns the size of the rectangle.
const T & at(int i) const
Returns the item at index position i in the list.
void waitForRegionEvents(int winId, bool ungrabDisplay)
The QImage class provides a hardware-independent image representation that allows direct access to th...
static const char * data(const QByteArray &arr)
static QScreen * instance()
Returns a pointer to the application's QScreen instance.
bool hasPendingRegionEvents() const
The QRegion class specifies a clip region for a painter.
const T * ptr(const T &t)
void setDotsPerMeterY(int)
Sets the number of pixels that fit vertically in a physical meter, to y.
QImage::Format preferredImageFormat(const QWidget *widget) const
static QWSLock * getClientLock()
QByteArray permanentState() const
Implement this function to return the data required for creating a server-side representation of the ...
bool lock(int timeout=-1)
QPoint painterOffset() const
Returns the offset to be used when painting.
void unlock()
Unlocks the mutex.
The QWindowSurface class provides the drawing area for top-level windows.
const T & at(int i) const
Returns the item at index position i in the vector.
virtual void endPaint(const QRegion &)
This function is called after painting onto the surface has ended, with the region in which the paint...
QSize size() const
Returns the size of the image, i.
static QDesktopWidget * desktop()
Returns the desktop widget (also called the root window).
SurfaceFlags surfaceFlags() const
Returns the surface flags describing the contents of this surface.
const char * constData() const
Returns a pointer to the data stored in the byte array.
uchar * base() const
Returns a pointer to the beginning of the framebuffer.
Q_CORE_EXPORT void qFatal(const char *,...)
virtual QPoint painterOffset() const
Returns the offset to be used when painting.
int width() const
Returns the width of the image.
virtual QString key() const =0
Implement this function to return a string that uniquely identifies the class of this surface...
static void setImageMetrics(QImage &img, QWidget *window)
QImage::Format pixelFormat() const
Returns the pixel format of the screen, or QImage::Format_Invalid if the pixel format is not a suppor...
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
void setDotsPerMeterX(int)
Sets the number of pixels that fit horizontally in a physical meter, to x.
iterator begin()
Returns an STL-style iterator pointing to the first item in the vector.
void setClipRegion(const QRegion &)
Sets the region currently visible on the screen to be the given clip region.
bool isOpaque() const
Returns true if the QWSWindowSurface::Opaque is set; otherwise returns false.
bool flushingRegionEvents
int toInt(bool *ok=0, int base=10) const
Returns the byte array converted to an int using base base, which is 10 by default and must be betwee...
void flush(QWidget *, const QRegion &, const QPoint &)
Flushes the given region from the specified widget onto the screen.
virtual QList< QScreen * > subScreens() const
The QPoint class defines a point in the plane using integer precision.
bool isRegionReserved() const
Returns true if the QWSWindowSurface::RegionReserved is set; otherwise returns false.
QVector< QRect > rects() const
Returns an array of non-overlapping rectangles that make up the region.
int size() const
Returns the number of items in the list.
QString objectName() const
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
QByteArray permanentState() const
Implement this function to return the data required for creating a server-side representation of the ...
SurfaceFlag
This enum describes the behavior of the region reserved by this QDirectPainter object.
static QScreen * getPrimaryScreen()
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 size() const
Returns the number of bytes in this byte array.
virtual void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset)
Flushes the given region from the specified widget onto the screen.
void translate(int dx, int dy)
Translates (moves) the region dx along the X axis and dy along the Y axis.
The QSize class defines the size of a two-dimensional object using integer point precision.
QRegion translated(int dx, int dy) const
Returns a copy of the region that is translated dx along the x axis and dy along the y axis...
virtual void setPermanentState(const QByteArray &state)
Implement this function to attach a server-side surface instance to the corresponding client side ins...
static QWSDisplay * instance()
QWSWindowSurfacePrivate()
static void flushUpdate(QWidget *widget, const QRegion ®ion, const QPoint &offset)
bool setMemory(int memId)
void beginPaint(const QRegion &rgn)
This function is called before painting onto the surface begins, with the region in which the paintin...
void setPermanentState(const QByteArray &data)
Implement this function to attach a server-side surface instance to the corresponding client side ins...
bool isEmpty() const
Returns true if either of the width and height is less than or equal to 0; otherwise returns false...
void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset)
#define QT_NO_QWS_MULTIPROCESS
char at(int i) const
Returns the character at index position i in the byte array.
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
static bool isWidgetPaintOnScreen(const QWidget *w)
virtual QImage image() const =0
Implement this function to return an image of the top-level window.
int physicalWidth() const
Returns the physical width of the screen in millimeters.
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
QWSDirectPainterSurface(bool isClient=false, QDirectPainter::SurfaceFlag flags=QDirectPainter::NonReserved)
QWSWindowSurface()
Constructs an empty surface.
int size() const
Returns the number of items in the vector.
QWidget * window() const
Returns a pointer to the top-level window associated with this surface.
virtual void setGeometry(const QRect &rect)
Sets the currently allocated area to be the given rect.
The QMap class is a template class that provides a skip-list-based dictionary.
Q_CORE_EXPORT void qCritical(const char *,...)
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
int depth() const
Returns the depth of the framebuffer, in bits per pixel.
The QList class is a template class that provides lists.
static int area(const QSize &s)
QPoint topLeft() const
Returns the position of the rectangle's top-left corner.
virtual QByteArray transientState() const