Sophie

Sophie

distrib > * > 2009.0 > i586 > by-pkgid > a6711891ce757817bba854bf3f25205a > files > 2406

qtjambi-doc-4.3.3-3mdv2008.1.i586.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /home/gvatteka/dev/qt-4.3/doc/src/emb-accel.qdoc -->
<head>
  <title>Adding an Accelerated Graphics Driver in Qtopia Core</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<h1 align="center">Adding an Accelerated Graphics Driver in Qtopia Core<br /><small></small></h1>
<a name="add-your-graphics-driver-to-qtopia-core"></a><p>In Qtopia Core</tt>, painting is a pure software implementation normally performed in two steps. First, each window is rendered onto a QWSWindowSurface using <a href="gui/QPaintEngine.html"><tt>QPaintEngine</tt></a>. Second, the server composes the surface images and copies the composition to the screen (see <a href="qtopiacore-architecture.html">Qtopia Core Architecture</tt></a> for details). Qtopia Core</tt> uses QRasterPaintEngine (a raster-based implementation of <a href="gui/QPaintEngine.html"><tt>QPaintEngine</tt></a>) to implement painting operations, and uses QScreen to implement window composition.</p>
<p>Starting with Qtopia Core</tt> 4.2, it is possible to add an accelerated graphics driver to take advantage of available hardware resources. This is described in detail in the Accelerated Graphics Driver Example</tt> which uses the following approach:</p>
<ul><li><a href="#step-1-create-a-custom-screen">Step 1: Create a Custom Screen</a></li>
<li><a href="#step-2-implement-a-custom-raster-paint-engine">Step 2: Implement a Custom Raster Paint Engine</a></li>
<li><a href="#step-3-make-the-paint-device-aware-of-your-paint-engine">Step 3: Make the Paint Device Aware of Your Paint Engine</a></li>
<li><a href="#step-4-make-the-window-surface-aware-of-your-paint-device">Step 4: Make the Window Surface Aware of Your Paint Device</a></li>
<li><a href="#step-5-enable-creation-of-an-instance-of-your-window-surface">Step 5: Enable Creation of an Instance of Your Window Surface</a></li>
</ul>
<p><b>Warning:</b> This feature is under development and is subject to change.</p>
<a name="step-1-create-a-custom-screen"></a>
<h2>Step 1: Create a Custom Screen</h2>
<p>Create a custom screen by deriving from the QScreen class.</p>
<p>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.</p>
<p>You might want to accelerate the final copying to the screen by reimplementing the blit() and solidFill() functions.</p>
<a name="step-2-implement-a-custom-raster-paint-engine"></a>
<h2>Step 2: Implement a Custom Raster Paint Engine</h2>
<p>Implement the painting operations by subclassing the QRasterPaintEngine class.</p>
<p>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.</p>
<a name="step-3-make-the-paint-device-aware-of-your-paint-engine"></a>
<h2>Step 3: Make the Paint Device Aware of Your Paint Engine</h2>
<p>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.</p>
<p><table align="center" cellpadding="2" cellspacing="1" border="0">
<thead><tr valign="top" class="qt-style"><th>Acceleration Without a Framebuffer</th></tr></thead>
<tr valign="top" class="odd"><td>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.<p>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.</p>
</td></tr>
</table></p>
<a name="step-4-make-the-window-surface-aware-of-your-paint-device"></a>
<h2>Step 4: Make the Window Surface Aware of Your Paint Device</h2>
<p>Derive from the QWSWindowSurface class and reimplement its paintDevice() function. Make this function return a pointer to your custom raster paint device.</p>
<a name="step-5-enable-creation-of-an-instance-of-your-window-surface"></a>
<h2>Step 5: Enable Creation of an Instance of Your Window Surface</h2>
<p>Finally, reimplement QScreen's createSurface() function and make this function able to create an instance of your QWSWindowSurface subclass.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2007 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt Jambi </div></td>
</tr></table></div></address></body>
</html>