Qt 4.8
Public Functions | List of all members
EGLNullWSScreen Class Reference

#include <eglnullwsscreen.h>

Inheritance diagram for EGLNullWSScreen:
QGLScreen QScreen

Public Functions

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

Additional Inherited Members

- Public Types inherited from QGLScreen
enum  Option {
  NoOptions = 0, NativeWindows = 1, NativePixmaps = 2, NativeImages = 4,
  Overlays = 8
}
 This enum defines options that can be set on QGLScreen instances. 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...
 
- Static Public Functions inherited from QScreen
static QScreeninstance ()
 Returns a pointer to the application's QScreen instance. More...
 
- Protected Functions inherited from QGLScreen
void setOptions (QGLScreen::Options value)
 Sets the options associated with this QGLScreen to value. More...
 
void setSurfaceFunctions (QGLScreenSurfaceFunctions *functions)
 Sets the surface functions object for this QGLScreen to functions. More...
 
- Protected Functions inherited from QScreen
void setGraphicsSystem (QGraphicsSystem *system)
 
void setPixelFormat (QImage::Format format)
 Sets the screen's pixel format to format. More...
 
void setPixmapDataFactory (QPixmapDataFactory *factory)
 
- Protected Variables inherited from QScreen
int d
 the pixel depth More...
 
uchardata
 points to the first visible pixel in the frame buffer. More...
 
int dh
 the device height More...
 
int displayId
 
int dw
 the device width More...
 
QPoolEntryentries
 
int * entryp
 
bool grayscale
 the gray scale screen mode flag More...
 
int h
 the logical height of the screen. More...
 
unsigned int * lowest
 
int lstep
 the number of bytes representing a line in the frame buffer. More...
 
int mapsize
 the total number of bytes in the frame buffer More...
 
int physHeight
 the physical height of the screen in millimeters. More...
 
int physWidth
 the physical width of the screen in millimeters. More...
 
PixelType pixeltype
 set to BGRPixel More...
 
QRgb screenclut [256]
 the color table More...
 
int screencols
 the number of entries in the color table More...
 
int size
 the number of bytes in the visible region of the frame buffer More...
 
int w
 the logical width of the screen. More...
 
- Static Protected Variables inherited from QScreen
static ClearCacheFunc clearCacheFunc = 0
 

Detailed Description

Definition at line 47 of file eglnullwsscreen.h.

Constructors and Destructors

◆ EGLNullWSScreen()

EGLNullWSScreen::EGLNullWSScreen ( int  displayId)

Definition at line 59 of file eglnullwsscreen.cpp.

59 : QGLScreen(displayId) {}
QGLScreen(int displayId)
int displayId
Definition: qscreen_qws.h:337

◆ ~EGLNullWSScreen()

EGLNullWSScreen::~EGLNullWSScreen ( )

Definition at line 61 of file eglnullwsscreen.cpp.

61 {}

Functions

◆ blank()

void EGLNullWSScreen::blank ( bool  on)
virtual

Prevents the screen driver form displaying any content on the screen.

Note that the default implementation does nothing.

Reimplement this function to prevent the screen driver from displaying any contents on the screen if on is true; otherwise the contents is expected to be shown.

See also
blit()

Reimplemented from QScreen.

Definition at line 159 of file eglnullwsscreen.cpp.

159 {}

◆ connect()

bool EGLNullWSScreen::connect ( const QString displaySpec)
virtual

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

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

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

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

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

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

Mach64:/dev/fb1:2

See Qt for Embedded Linux Display Management for more details.

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

Implements QScreen.

Definition at line 111 of file eglnullwsscreen.cpp.

112 {
113  const QStringList args = displaySpec.section(':', 1).split(':', QString::SkipEmptyParts);
115  Q_FOREACH(const QString arg, args) {
116  const QString optionName = arg.section('=', 0, 0);
117  const QString optionArg = arg.section('=', 1);
118  if (optionName == QLatin1String("size")) {
119  w = optionArg.section('x', 0, 0).toInt();
120  h = optionArg.section('x', 1, 1).toInt();
121  } else if (optionName == QLatin1String("format")) {
122  if (formatDict.contains(optionArg))
123  setPixelFormat(formatDict.value(optionArg));
124  else
125  printHelp(formatDict);
126  } else {
127  printHelp(formatDict);
128  }
129  }
130 
131  if (w == 0 || h == 0) {
132  w = 640;
133  h = 480;
134  qWarning("%s: Using default screen size %dx%d", PluginName, w, h);
135  }
136  dw = w;
137  dh = h;
138 
140  qWarning("%s: Using default screen format argb32", PluginName);
142  }
144 
145  static const int Dpi = 120;
146  static const qreal ScalingFactor = static_cast<qreal>(25.4) / Dpi;
147  physWidth = qRound(dw * ScalingFactor);
148  physHeight = qRound(dh * ScalingFactor);
149 
150  return true;
151 }
QString section(QChar sep, int start, int end=-1, SectionFlags flags=SectionDefault) const
This function returns a section of the string.
Definition: qstring.h:781
double qreal
Definition: qglobal.h:1193
int d
the pixel depth
Definition: qscreen_qws.h:327
int toInt(bool *ok=0, int base=10) const
Returns the string converted to an int using base base, which is 10 by default and must be between 2 ...
Definition: qstring.cpp:6090
const char *const PluginName
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
int physHeight
the physical height of the screen in millimeters.
Definition: qscreen_qws.h:340
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QHash class is a template class that provides a hash-table-based dictionary.
Definition: qdatastream.h:66
static void printHelp(const QHash< QString, QImage::Format > &formatDictionary)
bool contains(const Key &key) const
Returns true if the hash contains an item with the key; otherwise returns false.
Definition: qhash.h:872
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
int physWidth
the physical width of the screen in millimeters.
Definition: qscreen_qws.h:339
void setPixelFormat(QImage::Format format)
Sets the screen&#39;s pixel format to format.
The QStringList class provides a list of strings.
Definition: qstringlist.h:66
int w
the logical width of the screen.
Definition: qscreen_qws.h:324
Q_CORE_EXPORT void qWarning(const char *,...)
static int depthForFormat(QImage::Format format)
int dw
the device width
Definition: qscreen_qws.h:331
int dh
the device height
Definition: qscreen_qws.h:332
QImage::Format pixelFormat() const
Returns the pixel format of the screen, or QImage::Format_Invalid if the pixel format is not a suppor...
#define Q_FOREACH(variable, container)
Same as foreach(variable, container).
Definition: qglobal.h:2435
QStringList split(const QString &sep, SplitBehavior behavior=KeepEmptyParts, Qt::CaseSensitivity cs=Qt::CaseSensitive) const Q_REQUIRED_RESULT
Splits the string into substrings wherever sep occurs, and returns the list of those strings...
Definition: qstring.cpp:6526
int h
the logical height of the screen.
Definition: qscreen_qws.h:326
static const QHash< QString, QImage::Format > formatDictionary()
Q_DECL_CONSTEXPR int qRound(qreal d)
Definition: qglobal.h:1203

◆ createSurface() [1/2]

QWSWindowSurface * EGLNullWSScreen::createSurface ( QWidget widget) const
virtual

Creates and returns a new window surface for the given widget.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Reimplemented from QScreen.

Definition at line 163 of file eglnullwsscreen.cpp.

164 {
165  if (qobject_cast<QGLWidget*>(widget)) {
166  return new EGLNullWSWindowSurface(widget);
167  } else {
168  qWarning("%s: Creating non-GL surface", PluginName);
169  return QScreen::createSurface(widget);
170  }
171 }
const char *const PluginName
Q_CORE_EXPORT void qWarning(const char *,...)
virtual QWSWindowSurface * createSurface(QWidget *widget) const
Creates and returns a new window surface for the given widget.

◆ createSurface() [2/2]

QWSWindowSurface * EGLNullWSScreen::createSurface ( const QString key) const
virtual

Creates and returns a new window surface matching the given key.

Since
4.2

The server application will call this function whenever it needs to create a server side representation of a window, e.g. when copying the content of memory to the screen using the screen driver.

Note that this function must be reimplemented when adding an accelerated graphics driver. See the Adding an Accelerated Graphics Driver to Qt for Embedded Linux {Adding an Accelerated Graphics Driver} documentation for details.

See also
{Qt for Embedded Linux Architecture}

Reimplemented from QScreen.

Definition at line 173 of file eglnullwsscreen.cpp.

174 {
175  if (key == QLatin1String("eglnullws")) {
176  return new EGLNullWSWindowSurface;
177  } else {
178  qWarning("%s: Creating non-GL surface", PluginName);
179  return QScreen::createSurface(key);
180  }
181 }
const char *const PluginName
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
Q_CORE_EXPORT void qWarning(const char *,...)
virtual QWSWindowSurface * createSurface(QWidget *widget) const
Creates and returns a new window surface for the given widget.

◆ disconnect()

void EGLNullWSScreen::disconnect ( )
virtual

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

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

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

Implements QScreen.

Definition at line 153 of file eglnullwsscreen.cpp.

153 {}

◆ exposeRegion()

void EGLNullWSScreen::exposeRegion ( QRegion  region,
int  windowIndex 
)
virtual

This function is called by the Qt for Embedded Linux server whenever a screen update is required.

region is the area on the screen that must be updated, and windowIndex is the index into QWSServer::clientWindows() of the window that required the update. QWSWindow::state() gives more information about the cause.

The default implementation composes the affected windows and paints the given region on screen by calling the blit() and solidFill() functions

This function can be reimplemented to perform composition in hardware, or to perform transition effects. For simpler hardware acceleration, or to interface with this is typically done by reimplementing the blit() and solidFill() functions instead.

Note that there is no need to call this function explicitly.

See also
blit(), solidFill(), blank()

Reimplemented from QScreen.

Definition at line 161 of file eglnullwsscreen.cpp.

161 {}

◆ hasOpenGL()

bool EGLNullWSScreen::hasOpenGL ( )
inlinevirtual

Implements QGLScreen.

Definition at line 66 of file eglnullwsscreen.h.

66 { return true; }

◆ initDevice()

bool EGLNullWSScreen::initDevice ( )
virtual

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

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

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

See also
shutdownDevice(), connect()

Implements QScreen.

Definition at line 63 of file eglnullwsscreen.cpp.

64 {
65  setSurfaceFunctions(new EGLNullWSScreenSurfaceFunctions);
66  return true;
67 }
void setSurfaceFunctions(QGLScreenSurfaceFunctions *functions)
Sets the surface functions object for this QGLScreen to functions.

◆ setMode()

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

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

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

Implements QScreen.

Definition at line 157 of file eglnullwsscreen.cpp.

157 {}

◆ shutdownDevice()

void EGLNullWSScreen::shutdownDevice ( )
virtual

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

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

See also
initDevice(), disconnect()

Reimplemented from QScreen.

Definition at line 155 of file eglnullwsscreen.cpp.

155 {}

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