Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

Adding an Accelerated Graphics Driver in Qtopia Core

In Qtopia Core, painting is a pure software implementation and is normally performed in two steps: Each window is rendered onto a QWSWindowSurface using QPaintEngine, and then the server composes the surface images and copies them to the screen (see the Qtopia Core Architecture documentation for details). Qtopia Core uses QRasterPaintEngine (a raster-based implementation of QPaintEngine) to implement painting operations and QScreen to implement window composition.

Starting with Qtopia Core 4.2, it is possible to add an accelerated graphics driver to take advantage of available hardware resources, using the following approach:

Warning: This feature is under development and is subject to change.

Step 1: Create a Custom Screen

Create a custom screen by deriving from the QScreen class.

The connect(), disconnect(), initDevice() and shutdownDevice() functions are declared as pure virtual functions in QScreen and must be implemented. These functions are used to configure the hardware, or query its configuration. The connect() and disconnect() are called by both the server and client processes, while the initDevice() and shutdownDevice() functions are only called by the server process.

You might want to accelerate the final copying to the screen by reimplementing the blit() and solidFill() functions.

Step 2: Implement a Custom Raster Paint Engine

Implement the painting operations by subclassing the QRasterPaintEngine class.

To accelerate a graphics primitive, simply reimplement the corresponding function in your custom paint engine. If there is functionality you do not want to reimplement (such as certain pens, brushes, modes, etc.), you can just call the corresponding base class implementation.

Step 3: Make the Paint Device Aware of Your Paint Engine

To activate your paint engine you must create a subclass of the QCustomRasterPaintDevice class and reimplement its paintEngine() function. Let this function return a pointer to your paint engine. In addition, the QCustomRasterPaintDevice::memory() function must be reimplemented to return a pointer to the buffer where the painting should be done.

Acceleration Without a Framebuffer
If you are writing a driver for a device with a graphic I/O controller but no framebuffer support, the QCustomRasterPaintDevice::memory() function must return 0 (meaning no buffer available). Then, whenever a color or buffer should be written into memory, the paint engine will call the QRasterPaintEngine::drawColorSpans() and QRasterPaintEngine::drawBufferSpan() functions instead.

Note that the default implementations of these functions only calls qFatal() with an error message; reimplement the functions and let them do the appropriate communication with the I/O controller.

Step 4: Make the Window Surface Aware of Your Paint Device

Derive from the QWSWindowSurface class and reimplement its paintDevice() function. Make this function return a pointer to your custom raster paint device.

Step 5: Enable the Screen to Create an Instance of Your Window Surface

Finally, reimplement QScreen's createSurface() function and make this function able to create an instance of your QWSWindowSurface subclass.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 64
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le Qt Developer Network au hasard

Logo

Comment fermer une application

Le Qt Developer Network est un réseau de développeurs Qt anglophone, où ils peuvent partager leur expérience sur le framework. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.2
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web