QX11PaintEngine Class Reference

#include <qpaintengine_x11_p.h>

Inheritance diagram for QX11PaintEngine:

Inheritance graph
[legend]
Collaboration diagram for QX11PaintEngine:

Collaboration graph
[legend]
List of all members.

Detailed Description

Definition at line 56 of file qpaintengine_x11_p.h.

Public Member Functions

 QX11PaintEngine ()
 ~QX11PaintEngine ()
bool begin (QPaintDevice *pdev)
bool end ()
void updateState (const QPaintEngineState &state)
void updatePen (const QPen &pen)
void updateBrush (const QBrush &brush, const QPointF &pt)
void updateRenderHints (QPainter::RenderHints hints)
void updateFont (const QFont &font)
void updateMatrix (const QMatrix &matrix)
void updateClipRegion_dev (const QRegion &region, Qt::ClipOperation op)
void drawLines (const QLine *lines, int lineCount)
void drawLines (const QLineF *lines, int lineCount)
void drawRects (const QRect *rects, int rectCount)
void drawRects (const QRectF *rects, int rectCount)
void drawPoints (const QPoint *points, int pointCount)
void drawPoints (const QPointF *points, int pointCount)
void drawEllipse (const QRect &r)
void drawEllipse (const QRectF &r)
virtual void drawPolygon (const QPointF *points, int pointCount, PolygonDrawMode mode)
void drawPolygon (const QPoint *points, int pointCount, PolygonDrawMode mode)
void drawPixmap (const QRectF &r, const QPixmap &pm, const QRectF &sr)
void drawTiledPixmap (const QRectF &r, const QPixmap &pixmap, const QPointF &s)
void drawPath (const QPainterPath &path)
void drawTextItem (const QPointF &p, const QTextItem &textItem)
void drawImage (const QRectF &r, const QImage &img, const QRectF &sr, Qt::ImageConversionFlags flags=Qt::AutoColor)
virtual Qt::HANDLE handle () const
Type type () const
QPainter::RenderHints supportedRenderHints () const

Protected Member Functions

 QX11PaintEngine (QX11PaintEnginePrivate &dptr)
void drawBox (const QPointF &p, const QTextItemInt &si)
void drawXLFD (const QPointF &p, const QTextItemInt &si)
void drawFreetype (const QPointF &p, const QTextItemInt &si)
void core_render_glyph (QFontEngineFT *fe, int xp, int yp, uint glyph)

Friends

class QPixmap
class QFontEngineBox
Q_GUI_EXPORT GC qt_x11_get_pen_gc (QPainter *)
Q_GUI_EXPORT GC qt_x11_get_brush_gc (QPainter *)


Constructor & Destructor Documentation

QX11PaintEngine::QX11PaintEngine (  ) 

Definition at line 689 of file qpaintengine_x11.cpp.

00690     : QPaintEngine(*(new QX11PaintEnginePrivate), qt_decide_features())
00691 {
00692     d_func()->init();
00693 }

QX11PaintEngine::~QX11PaintEngine (  ) 

Definition at line 701 of file qpaintengine_x11.cpp.

00702 {
00703 }

QX11PaintEngine::QX11PaintEngine ( QX11PaintEnginePrivate dptr  )  [protected]

Definition at line 695 of file qpaintengine_x11.cpp.

00696     : QPaintEngine(dptr, qt_decide_features())
00697 {
00698     d_func()->init();
00699 }


Member Function Documentation

bool QX11PaintEngine::begin ( QPaintDevice pdev  )  [virtual]

Reimplement this function to initialise your paint engine when painting is to start on the paint device pdev. Return true if the initialization was successful; otherwise return false.

See also:
end() isActive()

Implements QPaintEngine.

Definition at line 705 of file qpaintengine_x11.cpp.

References Qt::black, d, QPaintDevice::devType(), QPaintEngine::DirtyBackground, QPaintEngine::DirtyBrush, QPaintEngine::DirtyClipRegion, QPaintEngine::DirtyPen, QPaintDevice::height(), QPaintEngine::Picture, QInternal::Pixmap, qt_x11Handle(), qt_x11Info(), QPaintEngine::setDirty(), QPainterPrivate::TxNone, updateBrush(), updatePen(), w, Qt::WA_PaintUnclipped, Qt::white, QInternal::Widget, QPaintDevice::width(), and QPaintEngine::X11.

00706 {
00707     Q_D(QX11PaintEngine);
00708     d->xinfo = qt_x11Info(pdev);
00709 #ifndef QT_NO_XRENDER
00710     if (pdev->devType() == QInternal::Widget) {
00711         d->picture = (::Picture)static_cast<const QWidget *>(pdev)->x11PictureHandle();
00712     } else if (pdev->devType() == QInternal::Pixmap) {
00713         const QPixmap *pm = static_cast<const QPixmap *>(pdev);
00714         if (X11->use_xrender && pm->data->d != 32 && pm->data->x11_mask)
00715             pm->data->convertToARGB32();
00716         d->picture = (::Picture)static_cast<const QPixmap *>(pdev)->x11PictureHandle();
00717     }
00718 #else
00719     d->picture = 0;
00720 #endif
00721     d->hd = qt_x11Handle(pdev);
00722 
00723     Q_ASSERT(d->xinfo != 0);
00724     d->dpy = d->xinfo->display(); // get display variable
00725     d->scrn = d->xinfo->screen(); // get screen variable
00726 
00727     d->crgn = QRegion();
00728     d->gc = XCreateGC(d->dpy, d->hd, 0, 0);
00729     d->gc_brush = XCreateGC(d->dpy, d->hd, 0, 0);
00730     d->has_alpha_brush = false;
00731     d->has_alpha_pen = false;
00732     d->has_clipping = false;
00733     d->has_complex_xform = false;
00734     d->has_custom_pen = false;
00735     d->matrix = QMatrix();
00736     d->pdev_depth = d->pdev->depth();
00737     d->render_hints = 0;
00738     d->txop = QPainterPrivate::TxNone;
00739     d->use_path_fallback = false;
00740 #if !defined(QT_NO_XRENDER)
00741     d->composition_mode = PictOpOver;
00742 #endif
00743     d->xlibMaxLinePoints = 32762; // a safe number used to avoid, call to XMaxRequestSize(d->dpy) - 3;
00744     d->opacity = 1;
00745 
00746     // Set up the polygon clipper. Note: This will only work in
00747     // polyline mode as long as we have a buffer zone, since a
00748     // polyline may be clipped into several non-connected polylines.
00749     const int BUFFERZONE = 1000;
00750     QRect devClipRect(-BUFFERZONE, -BUFFERZONE,
00751                       pdev->width() + 2*BUFFERZONE, pdev->height() + 2*BUFFERZONE);
00752     d->polygonClipper.setBoundingRect(devClipRect);
00753 
00754     QPixmap::x11SetDefaultScreen(d->xinfo->screen());
00755 
00756     QWidget *w = d->pdev->devType() == QInternal::Widget ? static_cast<QWidget *>(d->pdev) : 0;
00757     if (w && w->testAttribute(Qt::WA_PaintUnclipped)) {  // paint direct on device
00758   updatePen(QPen(Qt::black));
00759   updateBrush(QBrush(Qt::white), QPoint());
00760         XSetSubwindowMode(d->dpy, d->gc, IncludeInferiors);
00761         XSetSubwindowMode(d->dpy, d->gc_brush, IncludeInferiors);
00762 #ifndef QT_NO_XRENDER
00763         XRenderPictureAttributes attrs;
00764         attrs.subwindow_mode = IncludeInferiors;
00765         XRenderChangePicture(d->dpy, d->picture, CPSubwindowMode, &attrs);
00766 #endif
00767     }
00768 
00769     setDirty(QPaintEngine::DirtyClipRegion);
00770     setDirty(QPaintEngine::DirtyPen);
00771     setDirty(QPaintEngine::DirtyBrush);
00772     setDirty(QPaintEngine::DirtyBackground);
00773 
00774     return true;
00775 }

Here is the call graph for this function:

bool QX11PaintEngine::end (  )  [virtual]

Reimplement this function to finish painting on the current paint device. Return true if painting was finished successfully; otherwise return false.

See also:
begin() isActive()

Implements QPaintEngine.

Definition at line 777 of file qpaintengine_x11.cpp.

References d, and XNone.

Referenced by drawImage(), and drawPoints().

00778 {
00779     Q_D(QX11PaintEngine);
00780 
00781 #if !defined(QT_NO_XRENDER)
00782     if (d->picture) {
00783         // reset clipping/subwindow mode on our render picture
00784   XRenderPictureAttributes attrs;
00785   attrs.subwindow_mode = ClipByChildren;
00786         attrs.clip_mask = XNone;
00787   XRenderChangePicture(d->dpy, d->picture, CPClipMask|CPSubwindowMode, &attrs);
00788     }
00789 #endif
00790 
00791     if (d->gc_brush && d->pdev->painters < 2) {
00792         XFreeGC(d->dpy, d->gc_brush);
00793         d->gc_brush = 0;
00794     }
00795 
00796     if (d->gc && d->pdev->painters < 2) {
00797         XFreeGC(d->dpy, d->gc);
00798         d->gc = 0;
00799     }
00800 
00801     return true;
00802 }

void QX11PaintEngine::updateState ( const QPaintEngineState state  )  [virtual]

Reimplement this function to update the state of a paint engine.

When implemented, this function is responsible for checking the paint engine's current state and update the properties that are changed. Use the QPaintEngineState::state() function to find out which properties that must be updated, then use the corresponding {GetFunction}{get function} to retrieve the current values for the given properties.

See also:
QPaintEngineState

Implements QPaintEngine.

Definition at line 1104 of file qpaintengine_x11.cpp.

References QPaintEngineState::brush(), QPaintEngineState::brushOrigin(), QPaintEngineState::clipOperation(), QPaintEngineState::clipPath(), QPaintEngineState::clipRegion(), QPaintEngineState::compositionMode(), d, QPaintEngine::DirtyBrush, QPaintEngine::DirtyBrushOrigin, QPaintEngine::DirtyClipEnabled, QPaintEngine::DirtyClipPath, QPaintEngine::DirtyClipRegion, QPaintEngine::DirtyCompositionMode, QPaintEngine::DirtyFont, QPaintEngine::DirtyHints, QPaintEngine::DirtyOpacity, QPaintEngine::DirtyPen, QPaintEngine::DirtyTransform, QPainterPath::fillRule(), flags, QPaintEngineState::font(), QPaintEngineState::isClipEnabled(), QPaintEngineState::matrix(), Qt::NoClip, QPaintEngineState::opacity(), QPaintEngine::painter(), QPaintEngineState::pen(), qpainterOpToXrender(), QPaintEngineState::renderHints(), Qt::ReplaceClip, QPaintEngineState::state(), QPaintEngine::state, QPainterPath::toFillPolygon(), QPolygonF::toPolygon(), updateBrush(), updateClipRegion_dev(), updateFont(), updateMatrix(), updatePen(), and updateRenderHints().

01105 {
01106     Q_D(QX11PaintEngine);
01107     QPaintEngine::DirtyFlags flags = state.state();
01108 
01109 
01110     if (flags & DirtyOpacity) {
01111         d->opacity = state.opacity();
01112         if (d->opacity > 1)
01113             d->opacity = 1;
01114         if (d->opacity < 0)
01115             d->opacity = 0;
01116         // Force update pen/brush as to get proper alpha colors propagated
01117         flags |= DirtyPen;
01118         flags |= DirtyBrush;
01119     }
01120 
01121     if (flags & DirtyTransform) updateMatrix(state.matrix());
01122     if (flags & DirtyPen) updatePen(state.pen());
01123     if (flags & (DirtyBrush | DirtyBrushOrigin)) updateBrush(state.brush(), state.brushOrigin());
01124     if (flags & DirtyFont) updateFont(state.font());
01125 
01126     if (state.state() & DirtyClipEnabled) {
01127         if (state.isClipEnabled()) {
01128             QPolygonF clip_poly_dev(d->matrix.map(painter()->clipPath().toFillPolygon()));
01129             QPolygonF clipped_poly_dev;
01130             d->clipPolygon_dev(clip_poly_dev, &clipped_poly_dev);
01131             updateClipRegion_dev(QRegion(clipped_poly_dev.toPolygon()), Qt::ReplaceClip);
01132         } else {
01133             updateClipRegion_dev(QRegion(), Qt::NoClip);
01134         }
01135     }
01136 
01137     if (flags & DirtyClipPath) {
01138         QPolygonF clip_poly_dev(d->matrix.map(state.clipPath().toFillPolygon()));
01139         QPolygonF clipped_poly_dev;
01140         d->clipPolygon_dev(clip_poly_dev, &clipped_poly_dev);
01141         updateClipRegion_dev(QRegion(clipped_poly_dev.toPolygon(), state.clipPath().fillRule()),
01142                              state.clipOperation());
01143     } else if (flags & DirtyClipRegion) {
01144         updateClipRegion_dev(d->matrix.map(state.clipRegion()), state.clipOperation());
01145     }
01146     if (flags & DirtyHints) updateRenderHints(state.renderHints());
01147 #if !defined(QT_NO_XRENDER)
01148     if (flags & DirtyCompositionMode) {
01149         d->composition_mode =
01150             qpainterOpToXrender(state.compositionMode());
01151     }
01152 #endif
01153     d->decidePathFallback();
01154 }

Here is the call graph for this function:

void QX11PaintEngine::updatePen ( const QPen pen  ) 

Definition at line 1175 of file qpaintengine_x11.cpp.

References QColor::alpha, Qt::BevelJoin, c, QPen::capStyle(), QPen::color(), Qt::CustomDashLine, d, Qt::DashDotDotLine, Qt::DashDotLine, Qt::DashLine, Qt::DotLine, Qt::FlatCap, QColormap::instance(), QRegion::isEmpty(), QPen::joinStyle(), mask, Qt::MiterJoin, Qt::NoPen, QColormap::pixel(), QInternal::Pixmap, qGray(), qRound(), rgb, QColor::rgb(), QColor::rgba(), Qt::RoundCap, Qt::RoundJoin, scale(), Qt::SolidLine, Qt::SquareCap, QPen::style(), QPaintEngine::systemClip(), Qt::transparent, QPen::widthF(), QPaintEngine::X11, x11ClearClipRegion(), and x11SetClipRegion().

Referenced by begin(), and updateState().

01176 {
01177     Q_D(QX11PaintEngine);
01178     d->cpen = pen;
01179     int cp = CapButt;
01180     int jn = JoinMiter;
01181     int ps = pen.style();
01182 
01183     if (d->opacity < 1.0) {
01184         QColor c = d->cpen.color();
01185         c.setAlpha(qRound(c.alpha()*d->opacity));
01186         d->cpen.setColor(c);
01187     }
01188 
01189     d->has_pen = (ps != Qt::NoPen);
01190     d->has_alpha_pen = (pen.color().alpha() != 255);
01191 
01192     switch (pen.capStyle()) {
01193     case Qt::SquareCap:
01194         cp = CapProjecting;
01195         break;
01196     case Qt::RoundCap:
01197         cp = CapRound;
01198         break;
01199     case Qt::FlatCap:
01200     default:
01201         cp = CapButt;
01202         break;
01203     }
01204     switch (pen.joinStyle()) {
01205     case Qt::BevelJoin:
01206         jn = JoinBevel;
01207         break;
01208     case Qt::RoundJoin:
01209         jn = JoinRound;
01210         break;
01211     case Qt::MiterJoin:
01212     default:
01213         jn = JoinMiter;
01214         break;
01215     }
01216 
01217     d->adapted_pen_origin = false;
01218 
01219     char dashes[10];                            // custom pen dashes
01220     int dash_len = 0;                           // length of dash list
01221     int xStyle = LineSolid;
01222 
01223     /*
01224       We are emulating Windows here.  Windows treats cpen.width() == 1
01225       (or 0) as a very special case.  The fudge variable unifies this
01226       case with the general case.
01227     */
01228     qreal pen_width = pen.widthF();
01229     int scale =  qRound(pen_width < 1 ? 1 : pen_width);
01230     int space = (pen_width < 1 ? 1 : (2 * scale));
01231     int dot = 1 * scale;
01232     int dash = 4 * scale;
01233 
01234     d->has_custom_pen = false;
01235 
01236     switch (ps) {
01237     case Qt::NoPen:
01238     case Qt::SolidLine:
01239         xStyle = LineSolid;
01240   break;
01241     case Qt::DashLine:
01242   dashes[0] = dash;
01243   dashes[1] = space;
01244   dash_len = 2;
01245         xStyle = LineOnOffDash;
01246   break;
01247     case Qt::DotLine:
01248   dashes[0] = dot;
01249   dashes[1] = space;
01250   dash_len = 2;
01251         xStyle = LineOnOffDash;
01252   break;
01253     case Qt::DashDotLine:
01254   dashes[0] = dash;
01255   dashes[1] = space;
01256   dashes[2] = dot;
01257   dashes[3] = space;
01258   dash_len = 4;
01259         xStyle = LineOnOffDash;
01260   break;
01261     case Qt::DashDotDotLine:
01262   dashes[0] = dash;
01263   dashes[1] = space;
01264   dashes[2] = dot;
01265   dashes[3] = space;
01266   dashes[4] = dot;
01267   dashes[5] = space;
01268   dash_len = 6;
01269         xStyle = LineOnOffDash;
01270         break;
01271     case Qt::CustomDashLine:
01272         d->has_custom_pen = true;
01273         break;
01274     }
01275 
01276     ulong mask = GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth
01277                  | GCCapStyle | GCJoinStyle | GCLineStyle;
01278     XGCValues vals;
01279     vals.graphics_exposures = false;
01280     if (d->pdev_depth == 1) {
01281         vals.foreground = qGray(pen.color().rgb()) > 127 ? 0 : 1;
01282         vals.background = qGray(QColor(Qt::transparent).rgb()) > 127 ? 0 : 1;
01283     } else if (d->pdev->devType() == QInternal::Pixmap && d->pdev_depth == 32
01284         && X11->use_xrender) {
01285         vals.foreground = pen.color().rgba();
01286         vals.background = QColor(Qt::transparent).rgba();
01287     } else {
01288         QColormap cmap = QColormap::instance(d->scrn);
01289         vals.foreground = cmap.pixel(pen.color());
01290         vals.background = cmap.pixel(QColor(Qt::transparent));
01291     }
01292 
01293 
01294     vals.line_width = qRound(pen.widthF());
01295     vals.cap_style = cp;
01296     vals.join_style = jn;
01297     vals.line_style = xStyle;
01298 
01299     XChangeGC(d->dpy, d->gc, mask, &vals);
01300 
01301     if (dash_len) { // make dash list
01302         XSetDashes(d->dpy, d->gc, 0, dashes, dash_len);
01303     }
01304 
01305     if (!d->has_clipping) { // if clipping is set the paintevent clip region is merged with the clip region
01306         QRegion sysClip = systemClip();
01307         if (!sysClip.isEmpty())
01308             x11SetClipRegion(d->dpy, d->gc, 0, d->picture, sysClip);
01309         else
01310             x11ClearClipRegion(d->dpy, d->gc, 0, d->picture);
01311     }
01312 }

Here is the call graph for this function:

void QX11PaintEngine::updateBrush ( const QBrush brush,
const QPointF pt 
)

Definition at line 1314 of file qpaintengine_x11.cpp.

References QColor::alpha, c, QBrush::color(), d, QPixmap::data, Qt::Dense1Pattern, QPixmap::depth(), Qt::DiagCrossPattern, QPixmap::height(), QColormap::instance(), QRegion::isEmpty(), QBrush::isOpaque(), mask, Qt::NoBrush, QPaintEngine::Picture, QColormap::pixel(), QInternal::Pixmap, qGray(), QPixmap, qRound(), qt_patternForAlpha(), qt_pixmapForBrush(), rgb, s, QPixmap::size(), QPaintEngine::systemClip(), Qt::TexturePattern, Qt::transparent, QPixmap::width(), QPointF::x(), QPaintEngine::X11, x11ClearClipRegion(), x11SetClipRegion(), and QPointF::y().

Referenced by begin(), and updateState().

01315 {
01316     Q_D(QX11PaintEngine);
01317     d->cbrush = brush;
01318     d->bg_origin = origin;
01319     d->adapted_brush_origin = false;
01320 #if !defined(QT_NO_XRENDER)
01321     d->current_brush = 0;
01322 #endif
01323     if (d->opacity < 1.0) {
01324         QColor c = d->cbrush.color();
01325         c.setAlpha(qRound(c.alpha()*d->opacity));
01326         d->cbrush.setColor(c);
01327     }
01328 
01329     int s  = FillSolid;
01330     int  bs = d->cbrush.style();
01331     d->has_brush = (bs != Qt::NoBrush);
01332     d->has_pattern = bs >= Qt::Dense1Pattern && bs <= Qt::DiagCrossPattern;
01333     d->has_texture = bs == Qt::TexturePattern;
01334     d->has_alpha_brush = brush.color().alpha() != 255;
01335 
01336     ulong mask = GCForeground | GCBackground | GCGraphicsExposures
01337                  | GCLineStyle | GCCapStyle | GCJoinStyle | GCFillStyle;
01338     XGCValues vals;
01339     vals.graphics_exposures = false;
01340     if (d->pdev_depth == 1) {
01341         vals.foreground = qGray(d->cbrush.color().rgb()) > 127 ? 0 : 1;
01342         vals.background = qGray(QColor(Qt::transparent).rgb()) > 127 ? 0 : 1;
01343     } else if (X11->use_xrender && d->pdev->devType() == QInternal::Pixmap
01344                && d->pdev_depth == 32) {
01345         vals.foreground = d->cbrush.color().rgba();
01346         vals.background = QColor(Qt::transparent).rgba();
01347     } else {
01348         QColormap cmap = QColormap::instance(d->scrn);
01349         vals.foreground = cmap.pixel(d->cbrush.color());
01350         vals.background = cmap.pixel(QColor(Qt::transparent));
01351 
01352         if (!X11->use_xrender && d->has_brush && !d->has_pattern && !brush.isOpaque()) {
01353             QPixmap pattern = qt_patternForAlpha(brush.color().alpha(), d->scrn);
01354             mask |= GCStipple;
01355             vals.stipple = pattern.handle();
01356             s = FillStippled;
01357             d->adapted_brush_origin = true;
01358         }
01359     }
01360     vals.cap_style = CapButt;
01361     vals.join_style = JoinMiter;
01362     vals.line_style = LineSolid;
01363 
01364     if (d->has_pattern || d->has_texture) {
01365         QPixmap pm;
01366         if (bs == Qt::TexturePattern) {
01367             pm = d->cbrush.texture();
01368 #if !defined(QT_NO_XRENDER)
01369             if (X11->use_xrender) {
01370                 XRenderPictureAttributes attrs;
01371                 attrs.repeat = true;
01372                 XRenderChangePicture(d->dpy, pm.x11PictureHandle(), CPRepeat, &attrs);
01373                 if (pm.data->mask_picture)
01374                     XRenderChangePicture(d->dpy, pm.data->mask_picture, CPRepeat, &attrs);
01375             }
01376 #endif
01377         } else {
01378             pm = qt_pixmapForBrush(bs, true);
01379         }
01380         pm.x11SetScreen(d->scrn);
01381         if (pm.depth() == 1) {
01382             mask |= GCStipple;
01383             vals.stipple = pm.handle();
01384             s = FillStippled;
01385 #if !defined(QT_NO_XRENDER)
01386             if (X11->use_xrender) {
01387                 d->bitmap_texture = QPixmap(pm.size());
01388                 d->bitmap_texture.fill(Qt::transparent);
01389 
01390                 ::Picture src  = X11->getSolidFill(d->scrn, d->cbrush.color());
01391                 XRenderComposite(d->dpy, PictOpSrc, src, pm.x11PictureHandle(),
01392                                  d->bitmap_texture.x11PictureHandle(),
01393                                  0, 0, pm.width(), pm.height(),
01394                                  0, 0, pm.width(), pm.height());
01395 
01396                 XRenderPictureAttributes attrs;
01397                 attrs.repeat = true;
01398                 XRenderChangePicture(d->dpy, d->bitmap_texture.x11PictureHandle(), CPRepeat, &attrs);
01399 
01400                 d->current_brush = d->bitmap_texture.x11PictureHandle();
01401             }
01402 #endif
01403         } else {
01404             mask |= GCTile;
01405 #ifndef QT_NO_XRENDER
01406             if (d->pdev_depth == 32 && pm.depth() != 32)
01407                 pm.data->convertToARGB32();
01408 #endif
01409             vals.tile = (pm.depth() == d->pdev_depth
01410                          ? pm.handle()
01411                          : pm.data->x11ConvertToDefaultDepth());
01412             s = FillTiled;
01413 #if !defined(QT_NO_XRENDER)
01414             d->current_brush = d->cbrush.texture().x11PictureHandle();
01415 #endif
01416         }
01417 
01418         mask |= GCTileStipXOrigin | GCTileStipYOrigin;
01419         vals.ts_x_origin = qRound(origin.x());
01420         vals.ts_y_origin = qRound(origin.y());
01421     }
01422 #if !defined(QT_NO_XRENDER)
01423     else if (d->has_alpha_brush) {
01424         d->current_brush = X11->getSolidFill(d->scrn, d->cbrush.color());
01425     }
01426 #endif
01427 
01428     vals.fill_style = s;
01429     XChangeGC(d->dpy, d->gc_brush, mask, &vals);
01430     if (!d->has_clipping) {
01431         QRegion sysClip = systemClip();
01432         if (!sysClip.isEmpty())
01433             x11SetClipRegion(d->dpy, d->gc_brush, 0, d->picture, sysClip);
01434         else
01435             x11ClearClipRegion(d->dpy, d->gc_brush, 0, d->picture);
01436     }
01437 }

Here is the call graph for this function:

void QX11PaintEngine::updateRenderHints ( QPainter::RenderHints  hints  ) 

Definition at line 1156 of file qpaintengine_x11.cpp.

References QPainter::Antialiasing, d, QPainterPrivate::TxTranslate, and QPaintEngine::X11.

Referenced by updateState().

01157 {
01158     Q_D(QX11PaintEngine);
01159     d->render_hints = hints;
01160     if ((d->txop > QPainterPrivate::TxTranslate)
01161         || (hints & QPainter::Antialiasing))
01162         d->use_path_fallback = true;
01163     else
01164         d->use_path_fallback = false;
01165 
01166 #if !defined(QT_NO_XRENDER)
01167     if (X11->use_xrender && d->picture) {
01168         XRenderPictureAttributes attrs;
01169         attrs.poly_edge = (hints & QPainter::Antialiasing) ? PolyEdgeSmooth : PolyEdgeSharp;
01170         XRenderChangePicture(d->dpy, d->picture, CPPolyEdge, &attrs);
01171     }
01172 #endif
01173 }

void QX11PaintEngine::updateFont ( const QFont font  ) 

Definition at line 2026 of file qpaintengine_x11.cpp.

Referenced by updateState().

02027 {
02028 }

void QX11PaintEngine::updateMatrix ( const QMatrix matrix  ) 

Definition at line 1967 of file qpaintengine_x11.cpp.

References d, QMatrix::dx(), QMatrix::dy(), QMatrix::m11(), QMatrix::m12(), QMatrix::m21(), QMatrix::m22(), QPainterPrivate::TxNone, QPainterPrivate::TxRotShear, QPainterPrivate::TxScale, and QPainterPrivate::TxTranslate.

Referenced by updateState().

01968 {
01969     Q_D(QX11PaintEngine);
01970     d->matrix = mtx;
01971     if (mtx.m12() != 0 || mtx.m21() != 0)
01972         d->txop = QPainterPrivate::TxRotShear;
01973     else if (mtx.m11() != 1 || mtx.m22() != 1)
01974         d->txop = QPainterPrivate::TxScale;
01975     else if (mtx.dx() != 0 || mtx.dy() != 0)
01976         d->txop = QPainterPrivate::TxTranslate;
01977     else
01978         d->txop = QPainterPrivate::TxNone;
01979 
01980     d->has_complex_xform = (d->txop > QPainterPrivate::TxTranslate);
01981 }

Here is the call graph for this function:

void QX11PaintEngine::updateClipRegion_dev ( const QRegion region,
Qt::ClipOperation  op 
)

Definition at line 1986 of file qpaintengine_x11.cpp.

References d, Qt::IntersectClip, QRegion::intersected(), QRegion::isEmpty(), Qt::NoClip, Qt::ReplaceClip, QPaintEngine::systemClip(), Qt::UniteClip, x11ClearClipRegion(), and x11SetClipRegion().

Referenced by updateState().

01987 {
01988     Q_D(QX11PaintEngine);
01989     QRegion sysClip = systemClip();
01990     if (op == Qt::NoClip) {
01991         d->has_clipping = false;
01992         d->crgn = sysClip;
01993         if (!sysClip.isEmpty()) {
01994             x11SetClipRegion(d->dpy, d->gc, d->gc_brush, d->picture, sysClip);
01995         } else {
01996             x11ClearClipRegion(d->dpy, d->gc, d->gc_brush, d->picture);
01997         }
01998         return;
01999     }
02000 
02001     switch (op) {
02002     case Qt::IntersectClip:
02003         if (d->has_clipping) {
02004             d->crgn &= clipRegion;
02005             break;
02006         }
02007         // fall through
02008     case Qt::ReplaceClip:
02009         if (!sysClip.isEmpty())
02010             d->crgn = clipRegion.intersected(sysClip);
02011         else
02012             d->crgn = clipRegion;
02013         break;
02014     case Qt::UniteClip:
02015         d->crgn |= clipRegion;
02016         if (!sysClip.isEmpty())
02017             d->crgn = d->crgn.intersected(sysClip);
02018         break;
02019     default:
02020         break;
02021     }
02022     d->has_clipping = true;
02023     x11SetClipRegion(d->dpy, d->gc, d->gc_brush, d->picture, d->crgn);
02024 }

Here is the call graph for this function:

void QX11PaintEngine::drawLines ( const QLine lines,
int  lineCount 
) [virtual]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The default implementation converts the first lineCount lines in lines to a QLineF and calls the floating point version of this function.

Reimplemented from QPaintEngine.

Definition at line 876 of file qpaintengine_x11.cpp.

References QPainter::Antialiasing, clipLine(), d, drawPath(), i, QLine::p1(), QLine::p2(), path, qFloor(), and QPainterPrivate::TxNone.

00877 {
00878     Q_ASSERT(lines);
00879     Q_ASSERT(lineCount);
00880     Q_D(QX11PaintEngine);
00881     if (d->has_alpha_brush
00882         || d->has_alpha_pen
00883         || d->has_custom_pen
00884         || (d->cpen.widthF() > 0 && d->has_complex_xform)
00885         || (d->render_hints & QPainter::Antialiasing)) {
00886         for (int i = 0; i < lineCount; ++i) {
00887             QPainterPath path(lines[i].p1());
00888             path.lineTo(lines[i].p2());
00889             drawPath(path);
00890         }
00891         return;
00892     }
00893 
00894     if (d->has_pen) {
00895         for (int i = 0; i < lineCount; ++i) {
00896             QLineF linef;
00897             if (d->txop == QPainterPrivate::TxNone) {
00898                 linef = lines[i];
00899             } else {
00900                 linef = QLineF(d->matrix.map(lines[i].p1()), d->matrix.map(lines[i].p2()));
00901             }
00902             if (clipLine(&linef, d->polygonClipper.boundingRect())) {
00903                 XDrawLine(d->dpy, d->hd, d->gc,
00904                           qFloor(linef.x1()), qFloor(linef.y1()),
00905                           qFloor(linef.x2()), qFloor(linef.y2()));
00906             }
00907         }
00908     }
00909 }

Here is the call graph for this function:

void QX11PaintEngine::drawLines ( const QLineF lines,
int  lineCount 
) [inline, virtual]

The default implementation splits the list of lines in lines into lineCount separate calls to drawPath() or drawPolygon() depending on the feature set of the paint engine.

Reimplemented from QPaintEngine.

Definition at line 76 of file qpaintengine_x11_p.h.

References QPaintEngine::drawLines().

00076 { QPaintEngine::drawLines(lines, lineCount); }

Here is the call graph for this function:

void QX11PaintEngine::drawRects ( const QRect rects,
int  rectCount 
) [virtual]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. The default implementation converts the first rectCount rectangles in the buffer rects to a QRectF and calls the floating point version of this function.

Reimplemented from QPaintEngine.

Definition at line 911 of file qpaintengine_x11.cpp.

References d, QVarLengthArray< T, Prealloc >::data(), drawPath(), i, path, QPaintEngine::Picture, qRound(), QPainterPrivate::TxTranslate, and QPaintEngine::X11.

00912 {
00913     Q_D(QX11PaintEngine);
00914     Q_ASSERT(rects);
00915     Q_ASSERT(rectCount);
00916 
00917     if (d->use_path_fallback) {
00918         for (int i = 0; i < rectCount; ++i) {
00919             QPainterPath path;
00920             path.addRect(rects[i]);
00921             drawPath(path);
00922         }
00923         return;
00924     }
00925 
00926     QRect clip(d->polygonClipper.boundingRect());
00927     QPoint offset(qRound(d->matrix.dx()), qRound(d->matrix.dy()));
00928 #if !defined(QT_NO_XRENDER)
00929     ::Picture pict = d->picture;
00930 
00931     if (X11->use_xrender && pict && d->has_brush && d->pdev_depth != 1
00932         && (d->has_texture || d->has_alpha_brush))
00933     {
00934         XRenderColor xc;
00935         if (!d->has_texture && !d->has_pattern)
00936             xc = X11->preMultiply(d->cbrush.color());
00937 
00938         for (int i = 0; i < rectCount; ++i) {
00939             QRect r(rects[i]);
00940             if (d->txop == QPainterPrivate::TxTranslate)
00941                 r.translate(offset);
00942             r = r.intersected(clip);
00943             if (r.isEmpty())
00944                 continue;
00945             if (d->has_texture || d->has_pattern) {
00946                 XRenderComposite(d->dpy, d->composition_mode, d->current_brush, 0, pict,
00947                                  qRound(r.x() - d->bg_origin.x()), qRound(r.y() - d->bg_origin.y()),
00948                                  0, 0, r.x(), r.y(), r.width(), r.height());
00949             } else {
00950                 XRenderFillRectangle(d->dpy, d->composition_mode, pict, &xc, r.x(), r.y(), r.width(), r.height());
00951             }
00952             if (d->has_pen)
00953                 XDrawRectangle(d->dpy, d->hd, d->gc, r.x(), r.y(), r.width(), r.height());
00954         }
00955     } else
00956 #endif // !QT_NO_XRENDER
00957     {
00958         if (d->has_brush && d->has_pen) {
00959             for (int i = 0; i < rectCount; ++i) {
00960                 QRect r(rects[i]);
00961                 if (d->txop == QPainterPrivate::TxTranslate)
00962                     r.translate(offset);
00963                 r = r.intersected(clip);
00964                 if (r.isEmpty())
00965                     continue;
00966                 d->setupAdaptedOrigin(r.topLeft());
00967                 XFillRectangle(d->dpy, d->hd, d->gc_brush, r.x(), r.y(), r.width(), r.height());
00968                 XDrawRectangle(d->dpy, d->hd, d->gc, r.x(), r.y(), r.width(), r.height());
00969             }
00970             d->resetAdaptedOrigin();
00971         } else {
00972             QVarLengthArray<XRectangle> xrects(rectCount);
00973             int numClipped = rectCount;
00974             for (int i = 0; i < rectCount; ++i) {
00975                 QRect r(rects[i]);
00976                 if (d->txop == QPainterPrivate::TxTranslate)
00977                     r.translate(offset);
00978                 r = r.intersected(clip);
00979                 if (r.isEmpty()) {
00980                     --numClipped;
00981                     continue;
00982                 }
00983                 xrects[i].x = short(r.x());
00984                 xrects[i].y = short(r.y());
00985                 xrects[i].width = ushort(r.width());
00986                 xrects[i].height = ushort(r.height());
00987 
00988             }
00989             if (numClipped) {
00990                 d->setupAdaptedOrigin(rects[0].topLeft());
00991                 if (d->has_brush && !d->has_pen)
00992                     XFillRectangles(d->dpy, d->hd, d->gc_brush, xrects.data(), numClipped);
00993                 else if (d->has_pen && !d->has_brush)
00994                     XDrawRectangles(d->dpy, d->hd, d->gc, xrects.data(), numClipped);
00995                 d->resetAdaptedOrigin();
00996             }
00997         }
00998     }
00999 }

Here is the call graph for this function:

void QX11PaintEngine::drawRects ( const QRectF rects,
int  rectCount 
) [inline, virtual]

Draws the first rectCount rectangles in the buffer rects. The default implementation of this function calls drawPath() or drawPolygon() depending on the feature set of the paint engine.

Reimplemented from QPaintEngine.

Definition at line 79 of file qpaintengine_x11_p.h.

References QPaintEngine::drawRects().

00079 { QPaintEngine::drawRects(rects, rectCount); }

Here is the call graph for this function:

void QX11PaintEngine::drawPoints ( const QPoint points,
int  pointCount 
) [virtual]

Draws the first pointCount points in the buffer points

The default implementation converts the first pointCount QPoints in points to QPointFs and calls the floating point version of drawPoints.

Reimplemented from QPaintEngine.

Definition at line 1001 of file qpaintengine_x11.cpp.

References QPainter::Antialiasing, d, drawPath(), end(), i, j, path, QPoint::x(), x, QPoint::y(), and y.

01002 {
01003     Q_ASSERT(points);
01004     Q_ASSERT(pointCount);
01005     Q_D(QX11PaintEngine);
01006 
01007     if (!d->has_pen)
01008         return;
01009 
01010     if (d->cpen.widthF() > .0f
01011         || d->has_alpha_brush
01012         || d->has_alpha_pen
01013         || d->has_custom_pen
01014         || (d->render_hints & QPainter::Antialiasing)) {
01015         const QPoint *end = points + pointCount;
01016         while (points < end) {
01017             QPainterPath path;
01018             path.moveTo(*points);
01019             path.lineTo(points->x()+.005, points->y());
01020             drawPath(path);
01021             ++points;
01022         }
01023         return;
01024     }
01025 
01026     static const int BUF_SIZE = 1024;
01027     XPoint xPoints[BUF_SIZE];
01028     int i = 0, j = 0;
01029     while (i < pointCount) {
01030         while (i < pointCount && j < BUF_SIZE) {
01031             const QPoint &xformed = d->matrix.map(points[i]);
01032             int x = xformed.x();
01033             int y = xformed.y();
01034             if (x >= SHRT_MIN && y >= SHRT_MIN && x < SHRT_MAX && y < SHRT_MAX) {
01035                 xPoints[j].x = x;
01036                 xPoints[j].y = y;
01037                 ++j;
01038             }
01039             ++i;
01040         }
01041         if (j)
01042             XDrawPoints(d->dpy, d->hd, d->gc, xPoints, j, CoordModeOrigin);
01043 
01044         j = 0;
01045     }
01046 }

Here is the call graph for this function:

void QX11PaintEngine::drawPoints ( const QPointF points,
int  pointCount 
) [virtual]

Draws the first pointCount points in the buffer points

Reimplemented from QPaintEngine.

Definition at line 1048 of file qpaintengine_x11.cpp.

References QPainter::Antialiasing, d, drawPath(), end(), i, j, path, qFloor(), QPointF::x(), x, QPointF::y(), and y.

01049 {
01050     Q_ASSERT(points);
01051     Q_ASSERT(pointCount);
01052     Q_D(QX11PaintEngine);
01053 
01054     if (!d->has_pen)
01055         return;
01056 
01057     if (d->cpen.widthF() > .0f
01058         || d->has_alpha_brush
01059         || d->has_alpha_pen
01060         || d->has_custom_pen
01061         || (d->render_hints & QPainter::Antialiasing)) {
01062         const QPointF *end = points + pointCount;
01063         while (points < end) {
01064             QPainterPath path;
01065             path.moveTo(*points);
01066             path.lineTo(points->x() + 0.005, points->y());
01067             drawPath(path);
01068             ++points;
01069         }
01070         return;
01071     }
01072 
01073     static const int BUF_SIZE = 1024;
01074     XPoint xPoints[BUF_SIZE];
01075     int i = 0, j = 0;
01076     while (i < pointCount) {
01077         while (i < pointCount && j < BUF_SIZE) {
01078             const QPointF &xformed = d->matrix.map(points[i]);
01079             int x = qFloor(xformed.x());
01080             int y = qFloor(xformed.y());
01081             if (x >= SHRT_MIN && y >= SHRT_MIN && x < SHRT_MAX && y < SHRT_MAX) {
01082                 xPoints[j].x = x;
01083                 xPoints[j].y = y;
01084                 ++j;
01085             }
01086             ++i;
01087         }
01088         if (j)
01089             XDrawPoints(d->dpy, d->hd, d->gc, xPoints, j, CoordModeOrigin);
01090 
01091         j = 0;
01092     }
01093 }

Here is the call graph for this function:

void QX11PaintEngine::drawEllipse ( const QRect r  )  [virtual]

The default implementation of this function calls the floating point version of this function

Reimplemented from QPaintEngine.

Definition at line 1439 of file qpaintengine_x11.cpp.

References d, drawPath(), h, QRect::height(), QRect::intersected(), path, qRound(), QRect::topLeft(), QRect::translate(), QPainterPrivate::TxTranslate, w, QRect::width(), QRect::x(), x, QRect::y(), and y.

01440 {
01441     Q_D(QX11PaintEngine);
01442     QRect devclip(SHRT_MIN, SHRT_MIN, SHRT_MAX*2 - 1, SHRT_MAX*2 - 1);
01443     QRect r(rect);
01444     if (d->txop == QPainterPrivate::TxTranslate)
01445         r.translate(qRound(d->matrix.dx()), qRound(d->matrix.dy()));
01446     if (d->use_path_fallback || devclip.intersected(r) != r) {
01447         QPainterPath path;
01448         path.addEllipse(rect);
01449         drawPath(path);
01450         return;
01451     }
01452 
01453     int x = r.x();
01454     int y = r.y();
01455     int w = r.width();
01456     int h = r.height();
01457     if (w < 1 || h < 1)
01458         return;
01459     if (w == 1 && h == 1) {
01460         XDrawPoint(d->dpy, d->hd, d->has_pen ? d->gc : d->gc_brush, x, y);
01461         return;
01462     }
01463     d->setupAdaptedOrigin(rect.topLeft());
01464     if (d->has_brush) {          // draw filled ellipse
01465         if (!d->has_pen) {
01466             XFillArc(d->dpy, d->hd, d->gc_brush, x, y, w-1, h-1, 0, 360*64);
01467             XDrawArc(d->dpy, d->hd, d->gc_brush, x, y, w-1, h-1, 0, 360*64);
01468             return;
01469         } else{
01470             XFillArc(d->dpy, d->hd, d->gc_brush, x, y, w, h, 0, 360*64);
01471         }
01472     }
01473     if (d->has_pen)                // draw outline
01474         XDrawArc(d->dpy, d->hd, d->gc, x, y, w, h, 0, 360*64);
01475     d->resetAdaptedOrigin();
01476 }

Here is the call graph for this function:

void QX11PaintEngine::drawEllipse ( const QRectF r  )  [inline, virtual]

Reimplement this function to draw the largest ellipse that can be contained within rectangle rect.

The default implementation calls drawPolygon().

Reimplemented from QPaintEngine.

Definition at line 85 of file qpaintengine_x11_p.h.

References QPaintEngine::drawEllipse().

Here is the call graph for this function:

void QX11PaintEngine::drawPolygon ( const QPointF points,
int  pointCount,
PolygonDrawMode  mode 
) [virtual]

Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.

The default implementation of this function will try to use drawPath if the engine supports the feature QPaintEngine::PainterPaths or try the float based drawPolygon() implementation if not.

Reimplemented from QPaintEngine.

Definition at line 1695 of file qpaintengine_x11.cpp.

References QX11PaintEnginePrivate::BrushGC, d, drawPath(), i, Qt::NoBrush, Qt::OddEvenFill, QPaintEngine::OddEvenMode, path, QPaintEngine::PolylineMode, and Qt::WindingFill.

01696 {
01697     Q_D(QX11PaintEngine);
01698     if (d->use_path_fallback) {
01699         QPainterPath path(polygonPoints[0]);
01700         for (int i = 1; i < pointCount; ++i)
01701             path.lineTo(polygonPoints[i]);
01702         if (mode == PolylineMode) {
01703             QBrush oldBrush = d->cbrush;
01704             d->cbrush = QBrush(Qt::NoBrush);
01705             path.setFillRule(Qt::WindingFill);
01706             drawPath(path);
01707             d->cbrush = oldBrush;
01708         } else {
01709             path.setFillRule(mode == OddEvenMode ? Qt::OddEvenFill : Qt::WindingFill);
01710             path.closeSubpath();
01711             drawPath(path);
01712         }
01713         return;
01714     }
01715     if (mode != PolylineMode && d->has_brush)
01716         d->fillPolygon_translated(polygonPoints, pointCount, QX11PaintEnginePrivate::BrushGC, mode);
01717 
01718     if (d->has_pen)
01719         d->strokePolygon_translated(polygonPoints, pointCount, mode != PolylineMode);
01720 }

Here is the call graph for this function:

void QX11PaintEngine::drawPolygon ( const QPoint points,
int  pointCount,
PolygonDrawMode  mode 
) [inline, virtual]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Reimplement this virtual function to draw the polygon defined by the pointCount first points in points, using mode mode.

The default implementation of this function will try to use drawPath() if the engine supports the feature QPaintEngine::PainterPaths or try the int based drawPolygon() implementation if not.

Reimplemented from QPaintEngine.

Definition at line 88 of file qpaintengine_x11_p.h.

References QPaintEngine::drawPolygon().

00089         { QPaintEngine::drawPolygon(points, pointCount, mode); }

Here is the call graph for this function:

void QX11PaintEngine::drawPixmap ( const QRectF r,
const QPixmap pm,
const QRectF sr 
) [virtual]

Reimplement this function to draw the part of the pm specified by the sr rectangle in the given r.

Implements QPaintEngine.

Definition at line 1844 of file qpaintengine_x11.cpp.

References d, QPixmapData::d, QPixmap::data, QRectF::height(), QColormap::instance(), num, p, QPaintEngine::Picture, QColormap::pixel(), QInternal::Pixmap, qGray(), qRound(), qt_getClipRects(), qt_render_bitmap(), Unsorted, QRectF::width(), QRectF::x(), x, QPaintEngine::X11, XNone, QRectF::y(), and y.

01845 {
01846     Q_D(QX11PaintEngine);
01847     QRectF sr = _sr;
01848     int x = qRound(r.x());
01849     int y = qRound(r.y());
01850     int sx = qRound(sr.x());
01851     int sy = qRound(sr.y());
01852     int sw = qRound(sr.width());
01853     int sh = qRound(sr.height());
01854 
01855     if ((d->xinfo && d->xinfo->screen() != pixmap.x11Info().screen())
01856         || (pixmap.x11Info().screen() != DefaultScreen(X11->display))) {
01857         QPixmap* p = const_cast<QPixmap *>(&pixmap);
01858         p->x11SetScreen(d->xinfo ? d->xinfo->screen() : DefaultScreen(X11->display));
01859     }
01860 
01861     QPixmap::x11SetDefaultScreen(pixmap.x11Info().screen());
01862 
01863 #ifndef QT_NO_XRENDER
01864     ::Picture src_pict = pixmap.data->picture;
01865     if (src_pict && d->picture) {
01866         if (pixmap.data->d == 1 && (d->has_alpha_pen)) {
01867             qt_render_bitmap(d->dpy, d->scrn, src_pict, d->picture,
01868                              sx, sy, x, y, sw, sh, d->cpen);
01869             return;
01870         } else if (pixmap.data->d != 1 && (pixmap.data->d == 32 || pixmap.data->d != d->pdev_depth)) {
01871             XRenderComposite(d->dpy, d->composition_mode,
01872                              src_pict, 0, d->picture, sx, sy, 0, 0, x, y, sw, sh);
01873             return;
01874         }
01875     }
01876 #endif
01877 
01878     bool mono_src = pixmap.data->d == 1;
01879     bool mono_dst = d->pdev_depth == 1;
01880     bool restore_clip = false;
01881 
01882     if (pixmap.data->x11_mask) { // pixmap has a mask
01883         QBitmap comb(sw, sh);
01884         GC cgc = XCreateGC(d->dpy, comb.handle(), 0, 0);
01885         XSetForeground(d->dpy, cgc, 0);
01886         XFillRectangle(d->dpy, comb.handle(), cgc, 0, 0, sw, sh);
01887         XSetBackground(d->dpy, cgc, 0);
01888         XSetForeground(d->dpy, cgc, 1);
01889         if (!d->crgn.isEmpty()) {
01890             int num;
01891             XRectangle *rects = (XRectangle *)qt_getClipRects(d->crgn, num);
01892             XSetClipRectangles(d->dpy, cgc, -x, -y, rects, num, Unsorted);
01893         } else if (d->has_clipping) {
01894             XSetClipRectangles(d->dpy, cgc, 0, 0, 0, 0, Unsorted);
01895         }
01896         XSetFillStyle(d->dpy, cgc, FillOpaqueStippled);
01897         XSetTSOrigin(d->dpy, cgc, -sx, -sy);
01898         XSetStipple(d->dpy, cgc, pixmap.data->x11_mask);
01899         XFillRectangle(d->dpy, comb.handle(), cgc, 0, 0, sw, sh);
01900         XFreeGC(d->dpy, cgc);
01901 
01902         XSetClipOrigin(d->dpy, d->gc, x, y);
01903         XSetClipMask(d->dpy, d->gc, comb.handle());
01904         restore_clip = true;
01905     }
01906 
01907     if (mono_src) {
01908         if (!d->crgn.isEmpty()) {
01909             Pixmap comb = XCreatePixmap(d->dpy, d->hd, sw, sh, 1);
01910             GC cgc = XCreateGC(d->dpy, comb, 0, 0);
01911             XSetForeground(d->dpy, cgc, 0);
01912             XFillRectangle(d->dpy, comb, cgc, 0, 0, sw, sh);
01913             int num;
01914             XRectangle *rects = (XRectangle *)qt_getClipRects(d->crgn, num);
01915             XSetClipRectangles(d->dpy, cgc, -x, -y, rects, num, Unsorted);
01916             XCopyArea(d->dpy, pixmap.handle(), comb, cgc, sx, sy, sw, sh, 0, 0);
01917             XFreeGC(d->dpy, cgc);
01918 
01919             XSetClipMask(d->dpy, d->gc, comb);
01920             XSetClipOrigin(d->dpy, d->gc, x, y);
01921             XFreePixmap(d->dpy, comb);
01922         } else {
01923             XSetClipMask(d->dpy, d->gc, pixmap.handle());
01924             XSetClipOrigin(d->dpy, d->gc, x, y);
01925         }
01926 
01927         if (mono_dst) {
01928             XSetForeground(d->dpy, d->gc, qGray(d->cpen.color().rgb()) > 127 ? 0 : 1);
01929         } else {
01930             QColormap cmap = QColormap::instance(d->scrn);
01931             XSetForeground(d->dpy, d->gc, cmap.pixel(d->cpen.color()));
01932         }
01933         XFillRectangle(d->dpy, d->hd, d->gc, x, y, sw, sh);
01934         restore_clip = true;
01935     } else {
01936         XCopyArea(d->dpy, pixmap.handle(), d->hd, d->gc, sx, sy, sw, sh, x, y);
01937     }
01938 
01939     if (d->pdev->devType() == QInternal::Pixmap) {
01940         const QPixmap *px = static_cast<const QPixmap*>(d->pdev);
01941         Pixmap src_mask = pixmap.data->x11_mask;
01942         Pixmap dst_mask = px->data->x11_mask;
01943         if (dst_mask) {
01944             GC cgc = XCreateGC(d->dpy, dst_mask, 0, 0);
01945             if (src_mask) { // copy src mask into dst mask
01946                 XCopyArea(d->dpy, pixmap.data->x11_mask, px->data->x11_mask, cgc, sx, sy, sw, sh, x, y);
01947             } else { // no src mask, but make sure the area copied is opaque in dest
01948                 XSetBackground(d->dpy, cgc, 0);
01949                 XSetForeground(d->dpy, cgc, 1);
01950                 XFillRectangle(d->dpy, px->data->x11_mask, cgc, x, y, sw, sh);
01951             }
01952             XFreeGC(d->dpy, cgc);
01953         }
01954     }
01955 
01956     if (restore_clip) {
01957         XSetClipOrigin(d->dpy, d->gc, 0, 0);
01958         int num;
01959         XRectangle *rects = (XRectangle *)qt_getClipRects(d->crgn, num);
01960         if (num == 0)
01961             XSetClipMask(d->dpy, d->gc, XNone);
01962         else
01963             XSetClipRectangles(d->dpy, d->gc, 0, 0, rects, num, Unsorted);
01964     }
01965 }

Here is the call graph for this function:

void QX11PaintEngine::drawTiledPixmap ( const QRectF r,
const QPixmap pixmap,
const QPointF s 
) [virtual]

Reimplement this function to draw the pixmap in the given rect, starting at the given p. The pixmap will be drawn repeatedly until the rect is filled.

Reimplemented from QPaintEngine.

Definition at line 2041 of file qpaintengine_x11.cpp.

References d, QPixmap::data, QPixmap::depth(), h, QRectF::height(), QPixmap::height(), p, qRound(), qt_draw_tile(), qt_render_bitmap(), w, QPixmap::width(), QRectF::width(), QRectF::x(), x, QPaintEngine::X11, XNone, QRectF::y(), and y.

02042 {
02043     int x = qRound(r.x());
02044     int y = qRound(r.y());
02045     int w = qRound(r.width());
02046     int h = qRound(r.height());
02047     int sx = qRound(p.x());
02048     int sy = qRound(p.y());
02049 
02050     Q_D(QX11PaintEngine);
02051 #ifndef QT_NO_XRENDER
02052     if (X11->use_xrender && d->picture && pixmap.x11PictureHandle()) {
02053         // this is essentially qt_draw_tile(), inlined for
02054         // the XRenderComposite call
02055         int yPos, xPos, drawH, drawW, yOff, xOff;
02056         yPos = y;
02057         yOff = sy;
02058         while(yPos < y + h) {
02059             drawH = pixmap.height() - yOff;    // Cropping first row
02060             if (yPos + drawH > y + h)        // Cropping last row
02061                 drawH = y + h - yPos;
02062             xPos = x;
02063             xOff = sx;
02064             while(xPos < x + w) {
02065                 drawW = pixmap.width() - xOff; // Cropping first column
02066                 if (xPos + drawW > x + w)    // Cropping last column
02067                     drawW = x + w - xPos;
02068                 if (pixmap.depth() == 1) {
02069                     qt_render_bitmap(d->dpy, d->scrn, pixmap.x11PictureHandle(), d->picture,
02070                                      xOff, yOff, xPos, yPos, drawW, drawH, d->cpen);
02071                 } else {
02072                     XRenderComposite(d->dpy, d->composition_mode,
02073                                      pixmap.x11PictureHandle(), XNone, d->picture,
02074                                      xOff, yOff, 0, 0, xPos, yPos, drawW, drawH);
02075                 }
02076                 xPos += drawW;
02077                 xOff = 0;
02078             }
02079             yPos += drawH;
02080             yOff = 0;
02081         }
02082     } else
02083 #endif // !QT_NO_XRENDER
02084         if (pixmap.depth() > 1 && !pixmap.data->x11_mask) {
02085             XSetTile(d->dpy, d->gc, pixmap.handle());
02086             XSetFillStyle(d->dpy, d->gc, FillTiled);
02087             XSetTSOrigin(d->dpy, d->gc, x-sx, y-sy);
02088             XFillRectangle(d->dpy, d->hd, d->gc, x, y, w, h);
02089             XSetTSOrigin(d->dpy, d->gc, 0, 0);
02090             XSetFillStyle(d->dpy, d->gc, FillSolid);
02091         } else {
02092             qt_draw_tile(this, x, y, w, h, pixmap, sx, sy);
02093         }
02094 }

Here is the call graph for this function:

void QX11PaintEngine::drawPath ( const QPainterPath path  )  [virtual]

The default implementation ignores the path and does nothing.

Reimplemented from QPaintEngine.

Definition at line 1732 of file qpaintengine_x11.cpp.

References QPainter::Antialiasing, QList< T >::at(), QX11PaintEnginePrivate::BrushGC, QPainterPathStroker::createStroke(), Qt::CustomDashLine, d, QVector< T >::data(), i, QPainterPath::isEmpty(), path, QX11PaintEnginePrivate::PenGC, QPainterPathStroker::setCapStyle(), QPainterPathStroker::setDashPattern(), QPainterPath::setFillRule(), QPainterPathStroker::setJoinStyle(), QPainterPathStroker::setWidth(), QVector< T >::size(), QList< T >::size(), Qt::SolidLine, QPainterPrivate::TxTranslate, width, Qt::WindingFill, and QPaintEngine::X11.

Referenced by drawEllipse(), drawLines(), drawPoints(), drawPolygon(), and drawRects().

01733 {
01734     Q_D(QX11PaintEngine);
01735     if (path.isEmpty())
01736         return;
01737     bool adjust_coords = (d->has_alpha_pen || (d->cpen.style() > Qt::SolidLine)) && !(d->render_hints & QPainter::Antialiasing);
01738     QMatrix old_matrix = d->matrix;
01739     if (adjust_coords) {
01740         d->matrix = QMatrix(d->matrix.m11(), d->matrix.m12(), d->matrix.m21(), d->matrix.m22(),
01741                             d->matrix.dx() + 0.5f, d->matrix.dy() + 0.5f);
01742     }
01743     if (d->has_brush)
01744         d->fillPath(path, QX11PaintEnginePrivate::BrushGC, true);
01745 
01746     if (d->has_pen
01747         && ((X11->use_xrender && (d->has_alpha_pen || d->has_alpha_brush
01748                                   || (d->render_hints & QPainter::Antialiasing)))
01749             || (d->cpen.widthF() > 0 && d->txop > QPainterPrivate::TxTranslate)
01750             || (d->cpen.style() > Qt::SolidLine))) {
01751         QPainterPathStroker stroker;
01752         if (d->cpen.style() == Qt::CustomDashLine)
01753             stroker.setDashPattern(d->cpen.dashPattern());
01754         else
01755             stroker.setDashPattern(d->cpen.style());
01756         stroker.setCapStyle(d->cpen.capStyle());
01757         stroker.setJoinStyle(d->cpen.joinStyle());
01758         QPainterPath stroke;
01759         qreal width = d->cpen.widthF();
01760         QPolygonF poly;
01761         // necessary to get aliased alphablended primitives to be drawn correctly
01762         if (width == 0) {
01763             stroker.setWidth(1);
01764             stroke = stroker.createStroke(path * d->matrix);
01765             if (stroke.isEmpty())
01766                 return;
01767             stroke.setFillRule(Qt::WindingFill);
01768             d->fillPath(stroke, QX11PaintEnginePrivate::PenGC, false);
01769         } else {
01770             stroker.setWidth(width);
01771             stroke = stroker.createStroke(path);
01772             if (stroke.isEmpty())
01773                 return;
01774             stroke.setFillRule(Qt::WindingFill);
01775             d->fillPath(stroke, QX11PaintEnginePrivate::PenGC, true);
01776         }
01777     } else if (d->has_pen) {
01778         // if we have a pen width of 0 - use XDrawLine() for speed
01779         QList<QPolygonF> polys = path.toSubpathPolygons(d->matrix);
01780         for (int i = 0; i < polys.size(); ++i)
01781             d->strokePolygon_dev(polys.at(i).data(), polys.at(i).size(), false);
01782     }
01783     if (adjust_coords)
01784         d->matrix = old_matrix;
01785 }

Here is the call graph for this function:

void QX11PaintEngine::drawTextItem ( const QPointF p,
const QTextItem textItem 
) [virtual]

This function draws the text item textItem at position p. The default implementation of this function converts the text to a QPainterPath and paints the resulting path.

Reimplemented from QPaintEngine.

Definition at line 2096 of file qpaintengine_x11.cpp.

References QFontEngine::Box, drawBox(), drawFreetype(), drawXLFD(), QTextItemInt::fontEngine, QFontEngine::Freetype, p, QFontEngine::type(), and QFontEngine::XLFD.

02097 {
02098     const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
02099 
02100     switch(ti.fontEngine->type()) {
02101     case QFontEngine::Box:
02102         drawBox(p, ti);
02103         break;
02104     case QFontEngine::XLFD:
02105         drawXLFD(p, ti);
02106         break;
02107 #ifndef QT_NO_FONTCONFIG
02108     case QFontEngine::Freetype:
02109         drawFreetype(p, ti);
02110         break;
02111 #endif
02112     default:
02113         Q_ASSERT(false);
02114     }
02115 }

Here is the call graph for this function:

void QX11PaintEngine::drawImage ( const QRectF r,
const QImage img,
const QRectF sr,
Qt::ImageConversionFlags  flags = Qt::AutoColor 
) [virtual]

Reimplement this function to draw the part of the image specified by the sr rectangle in the given rectangle using the given conversion flags flags, to convert it to a pixmap.

Reimplemented from QPaintEngine.

Definition at line 1787 of file qpaintengine_x11.cpp.

References QImage::bytesPerLine(), d, QPaintEngine::drawImage(), end(), h, QRectF::height(), QImage::height(), i, image, LSBFirst, MSBFirst, p, qRound(), QImage::scanLine(), QRectF::size(), w, QRectF::width(), QImage::width(), QRectF::x(), x, QRectF::y(), and y.

01788 {
01789     Q_D(QX11PaintEngine);
01790 
01791     if (!image.hasAlphaChannel()
01792         && d->pdev_depth >= 24 && image.depth() == 32
01793         && r.size() == sr.size())
01794     {
01795         int sx = qRound(sr.x());
01796         int sy = qRound(sr.y());
01797         int x = qRound(r.x());
01798         int y = qRound(r.y());
01799         int w = qRound(r.width());
01800         int h = qRound(r.height());
01801         XImage *xi;
01802         QImage im(image);
01803         // Note: this code assumes either RGB or BGR, 8 bpc server layouts
01804         const uint red_mask = (uint) ((Visual *) d->xinfo->visual())->red_mask;
01805         bool bgr_layout = (red_mask == 0xff);
01806         if ((QSysInfo::ByteOrder == QSysInfo::BigEndian
01807              && ((ImageByteOrder(d->dpy) == LSBFirst) || bgr_layout))
01808             || (ImageByteOrder(d->dpy) == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian))
01809         {
01810             for (int i=0; i < im.height(); i++) {
01811                 uint *p = (uint*)im.scanLine(i);
01812                 uint *end = p + im.width();
01813                 if (bgr_layout && ImageByteOrder(d->dpy) == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian) {
01814                     while (p < end) {
01815                         *p = ((*p << 8) & 0xffffff00) | ((*p >> 24) & 0x000000ff);
01816                         p++;
01817                     }
01818                 } else if ((ImageByteOrder(d->dpy) == LSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian)
01819                            || (ImageByteOrder(d->dpy) == MSBFirst && QSysInfo::ByteOrder == QSysInfo::LittleEndian)) {
01820                     while (p < end) {
01821                         *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000)
01822                              | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff);
01823                         p++;
01824                     }
01825                 } else if (ImageByteOrder(d->dpy) == MSBFirst && QSysInfo::ByteOrder == QSysInfo::BigEndian) {
01826                     while (p < end) {
01827                         *p = ((*p << 16) & 0x00ff0000) | ((*p >> 16) & 0x000000ff)
01828                              | ((*p ) & 0xff00ff00);
01829                         p++;
01830                     }
01831                 }
01832             }
01833         }
01834         xi = XCreateImage(d->dpy, (Visual *) d->xinfo->visual(), d->pdev_depth, ZPixmap,
01835                           0, (char *) im.scanLine(sy)+sx*sizeof(uint), w, h, 32, im.bytesPerLine());
01836         XPutImage(d->dpy, d->hd, d->gc, xi, 0, 0, x, y, w, h);
01837         xi->data = 0; // QImage owns these bits
01838         XDestroyImage(xi);
01839     } else {
01840         QPaintEngine::drawImage(r, image, sr, flags);
01841     }
01842 }

Here is the call graph for this function:

Qt::HANDLE QX11PaintEngine::handle (  )  const [virtual]

Definition at line 2030 of file qpaintengine_x11.cpp.

References d, and QPaintEngine::isActive().

02031 {
02032     Q_D(const QX11PaintEngine);
02033     Q_ASSERT(isActive());
02034     Q_ASSERT(d->hd);
02035     return d->hd;
02036 }

Here is the call graph for this function:

Type QX11PaintEngine::type (  )  const [inline, virtual]

Reimplement this function to return the paint engine {Type}.

Implements QPaintEngine.

Definition at line 99 of file qpaintengine_x11_p.h.

References QPaintEngine::X11.

00099 { return QPaintEngine::X11; }

QPainter::RenderHints QX11PaintEngine::supportedRenderHints (  )  const

Definition at line 1095 of file qpaintengine_x11.cpp.

References QPainter::Antialiasing, and QPaintEngine::X11.

01096 {
01097 #if !defined(QT_NO_XRENDER)
01098     if (X11->use_xrender)
01099         return QPainter::Antialiasing;
01100 #endif
01101     return QFlag(0);
01102 }

void QX11PaintEngine::drawBox ( const QPointF p,
const QTextItemInt si 
) [protected]

Definition at line 2118 of file qpaintengine_x11.cpp.

References QFontEngine::ascent(), QPainter::drawRect(), QTextItemInt::flags, QTextItemInt::fontEngine, QFontEngine::getGlyphPositions(), QTextItemInt::glyphs, QFontEngine::lineThickness(), Qt::NoBrush, QTextItemInt::num_glyphs, p, QPaintEngine::painter(), QPainter::pen(), positions, qRound(), QPainter::restore(), s, QPainter::save(), QPainter::setBrush(), QPainter::setPen(), QPen::setWidthF(), QVarLengthArray< T, Prealloc >::size(), size, QFixed::toReal(), and QMatrix::translate().

Referenced by drawTextItem().

02119 {
02120     if (!ti.num_glyphs)
02121         return;
02122 
02123     QVarLengthArray<QFixedPoint> positions;
02124     QVarLengthArray<glyph_t> glyphs;
02125     QMatrix matrix;
02126     matrix.translate(p.x(), p.y());
02127     ti.fontEngine->getGlyphPositions(ti.glyphs, ti.num_glyphs, matrix, ti.flags, glyphs, positions);
02128     if (glyphs.size() == 0)
02129         return;
02130 
02131     int size = qRound(ti.fontEngine->ascent());
02132     QSize s(size - 3, size - 3);
02133 
02134     painter()->save();
02135     painter()->setBrush(Qt::NoBrush);
02136     QPen pen = painter()->pen();
02137     pen.setWidthF(ti.fontEngine->lineThickness().toReal());
02138     painter()->setPen(pen);
02139     for (int k = 0; k < positions.size(); k++)
02140         painter()->drawRect(QRectF(positions[k].toPointF(), s));
02141     painter()->restore();
02142 }

Here is the call graph for this function:

void QX11PaintEngine::drawXLFD ( const QPointF p,
const QTextItemInt si 
) [protected]

Definition at line 2144 of file qpaintengine_x11.cpp.

References d, QPaintEngine::drawTextItem(), QTextItemInt::flags, QTextItemInt::fontEngine, QFontEngineXLFD::fontStruct(), QFontEngine::getGlyphPositions(), QTextItemInt::glyphs, i, QTextItemInt::num_glyphs, p, positions, qRound(), QVarLengthArray< T, Prealloc >::size(), QMatrix::translate(), QPainterPrivate::TxTranslate, x, and y.

Referenced by drawTextItem().

02145 {
02146     Q_D(QX11PaintEngine);
02147 
02148     if (d->txop > QPainterPrivate::TxTranslate) {
02149         // XServer or font don't support server side transformations, need to do it by hand
02150         QPaintEngine::drawTextItem(p, ti);
02151         return;
02152     }
02153 
02154     if (!ti.num_glyphs)
02155         return;
02156 
02157     QVarLengthArray<QFixedPoint> positions;
02158     QVarLengthArray<glyph_t> glyphs;
02159     QMatrix matrix = d->matrix;
02160     matrix.translate(p.x(), p.y());
02161     ti.fontEngine->getGlyphPositions(ti.glyphs, ti.num_glyphs, matrix, ti.flags, glyphs, positions);
02162     if (glyphs.size() == 0)
02163         return;
02164 
02165     QFontEngineXLFD *xlfd = static_cast<QFontEngineXLFD *>(ti.fontEngine);
02166     Qt::HANDLE font_id = xlfd->fontStruct()->fid;
02167 
02168     XSetFont(d->dpy, d->gc, font_id);
02169 
02170     for (int i = 0; i < glyphs.size(); i++) {
02171         int xp = qRound(positions[i].x);
02172         int yp = qRound(positions[i].y);
02173         if (xp < SHRT_MAX && xp > SHRT_MIN &&  yp > SHRT_MIN && yp < SHRT_MAX) {
02174             XChar2b ch;
02175             ch.byte1 = glyphs[i] >> 8;
02176             ch.byte2 = glyphs[i] & 0xff;
02177             XDrawString16(d->dpy, d->hd, d->gc, xp, yp, &ch, 1);
02178         }
02179     }
02180 }

Here is the call graph for this function:

void QX11PaintEngine::drawFreetype ( const QPointF p,
const QTextItemInt si 
) [protected]

Definition at line 2235 of file qpaintengine_x11.cpp.

References QPixmap::BitmapType, QFontEngineFT::cachedGlyph(), core_render_glyph(), QVarLengthArray< T, Prealloc >::count(), d, data, QVarLengthArray< T, Prealloc >::data(), QFontEngineFT::drawAsOutline(), QPaintEngine::drawTextItem(), QTextItemInt::flags, QFontEngineFT::fnt, QTextItemInt::fontEngine, QFixed::fromReal(), g, QFontEngine::getGlyphPositions(), QTextItemInt::glyphs, i, QFontEngineFT::loadTransformedGlyphSet(), QFontEngineFT::lockFace(), QTextItemInt::num_glyphs, p, QPaintEngine::Picture, QInternal::Pixmap, positions, qRound(), QVarLengthArray< T, Prealloc >::size(), QFixed::toInt(), QMatrix::translate(), QPainterPrivate::TxScale, QFontEngineFT::unlockFace(), x, QPaintEngine::X11, and y.

Referenced by drawTextItem().

02236 {
02237     Q_D(QX11PaintEngine);
02238     if (!ti.num_glyphs)
02239         return;
02240 
02241     QFontEngineFT *ft = static_cast<QFontEngineFT *>(ti.fontEngine);
02242 
02243     if (!d->cpen.isSolid() || ft->drawAsOutline()) {
02244         QPaintEngine::drawTextItem(p, ti);
02245     }
02246 
02247     QFixed xpos = QFixed::fromReal(p.x() + d->matrix.dx());
02248     QFixed ypos = QFixed::fromReal(p.y() + d->matrix.dy());
02249 
02250     QVarLengthArray<QFixedPoint> positions;
02251     QVarLengthArray<glyph_t> glyphs;
02252     QMatrix matrix = d->matrix;
02253     matrix.translate(p.x(), p.y());
02254     ft->getGlyphPositions(ti.glyphs, ti.num_glyphs, matrix, ti.flags, glyphs, positions);
02255     if (glyphs.count() == 0)
02256         return;
02257 
02258     bool drawTransformed = false;
02259 #ifndef QT_NO_XRENDER
02260     const bool xrenderPath = (X11->use_xrender
02261                               && !(d->pdev->devType() == QInternal::Pixmap
02262                               && static_cast<const QPixmap *>(d->pdev)->data->type == QPixmap::BitmapType));
02263 
02264     GlyphSet transformedGlyphSet = 0;
02265     if (d->txop >= QPainterPrivate::TxScale
02266         && xrenderPath) {
02267         drawTransformed = ft->loadTransformedGlyphSet(glyphs.data(), glyphs.size(), d->matrix, &transformedGlyphSet);
02268     }
02269 #endif
02270 
02271     if ((d->txop >= QPainterPrivate::TxScale && !drawTransformed)) {
02272         QPaintEngine::drawTextItem(p, ti);
02273         return;
02274     }
02275 
02276 #ifndef QT_NO_XRENDER
02277     if (xrenderPath) {
02278 
02279         GlyphSet glyphSet = drawTransformed ? transformedGlyphSet : ft->fnt.glyphSet;
02280 
02281         const QColor &pen = d->cpen.color();
02282         ::Picture src = X11->getSolidFill(d->scrn, pen);
02283         // XRenderPictFormat *maskFormat = XRenderFindStandardFormat(X11->display, ft->xglyph_format);
02284         // using a mask format other than 0 causes bitmap/XLFD fonts to garbled
02285         XRenderPictFormat *maskFormat = 0;
02286 
02287         enum { t_min = SHRT_MIN >> 1, t_max = SHRT_MAX >> 1};
02288         QFixed xp = positions[0].x;
02289         QFixed yp = positions[0].y;
02290 
02291         // better return instead of crashing the X server
02292         if (xp.toInt() < t_min || xp.toInt() > t_max
02293             || yp.toInt() < t_min || yp.toInt() > t_max)
02294             return;
02295 
02296         XGlyphElt32 elt;
02297         elt.glyphset = glyphSet;
02298         elt.chars = &glyphs[0];
02299         elt.nchars = 1;
02300         elt.xOff = qRound(xp);
02301         elt.yOff = qRound(yp);
02302         for (int i = 1; i < glyphs.size(); ++i) {
02303             QFontEngineFT::Glyph *g = ft->cachedGlyph(glyphs[i - 1]);
02304             if (g
02305                 && positions[i].x == xp + g->advance
02306                 && positions[i].y == yp
02307                 && elt.nchars < 253 // don't draw more than 253 characters as some X servers
02308                                     // hang with it
02309                 ) {
02310                 elt.nchars++;
02311                 xp += g->advance;
02312             } else {
02313                 xp = positions[i].x;
02314                 yp = positions[i].y;
02315 
02316                 XRenderCompositeText32(X11->display, PictOpOver, src, d->picture,
02317                                        maskFormat, 0, 0, 0, 0,
02318                                        &elt, 1);
02319                 elt.chars = &glyphs[i];
02320                 elt.nchars = 1;
02321                 elt.xOff = qRound(xp);
02322                 elt.yOff = qRound(yp);
02323             }
02324         }
02325         XRenderCompositeText32(X11->display, PictOpOver, src, d->picture,
02326                                maskFormat, 0, 0, 0, 0,
02327                                &elt, 1);
02328 
02329         return;
02330 
02331     }
02332 #endif
02333     ft->lockFace();
02334     int i = 0;
02335     while (i < glyphs.size()) {
02336         core_render_glyph(ft, qRound(positions[i].x), qRound(positions[i].y), glyphs[i]);
02337         ++i;
02338     }
02339     ft->unlockFace();
02340 }

Here is the call graph for this function:

void QX11PaintEngine::core_render_glyph ( QFontEngineFT fe,
int  xp,
int  yp,
uint  glyph 
) [protected]

Definition at line 2183 of file qpaintengine_x11.cpp.

References d, QFontEngineFT::Glyph::data, QFontEngineFT::Glyph::format, QFontEngineFT::Format_Mono, h, QFontEngineFT::Glyph::height, QFontEngineFT::loadGlyph(), n, Qt::NoPen, set(), QFontEngineFT::Glyph::width, width, QFontEngineFT::Glyph::x, x, x80, y, and QFontEngineFT::Glyph::y.

Referenced by drawFreetype().

02184 {
02185     Q_D(QX11PaintEngine);
02186     if (xp < SHRT_MIN || xp > SHRT_MAX  || yp < SHRT_MIN || yp > SHRT_MAX
02187         || d->cpen.style() == Qt::NoPen)
02188         return;
02189 
02190     QFontEngineFT::Glyph *glyph = fe->loadGlyph(g, QFontEngineFT::Format_Mono);
02191     // #### fix case where we don't get a glyph
02192     if (!glyph)
02193         return;
02194 
02195     Q_ASSERT(glyph->format == QFontEngineFT::Format_Mono);
02196 
02197     const int rectcount = 256;
02198     XRectangle rects[rectcount];
02199     int n = 0;
02200     int h = glyph->height;
02201     xp += glyph->x;
02202     yp += -glyph->y + glyph->height;
02203     int pitch = ((glyph->width + 31) & ~31) >> 3;
02204 
02205     uchar *src = glyph->data;
02206     while (h--) {
02207         for (int x = 0; x < glyph->width; ++x) {
02208             bool set = src[x >> 3] & (0x80 >> (x & 7));
02209             if (set) {
02210                 XRectangle r = { xp + x, yp - h, 1, 1 };
02211                 while (x < glyph->width-1 && src[(x+1) >> 3] & (0x80 >> ((x+1) & 7))) {
02212                     ++x;
02213                     ++r.width;
02214                 }
02215 
02216                 rects[n] = r;
02217                 ++n;
02218             }
02219             if (n == rectcount) {
02220                 d->setupAdaptedOrigin(QPoint(rects[0].x, rects[0].y));
02221                 XFillRectangles(d->dpy, d->hd, d->gc, rects, n);
02222                 n = 0;
02223                 d->resetAdaptedOrigin();
02224             }
02225         }
02226         src += pitch;
02227     }
02228     if (n) {
02229         d->setupAdaptedOrigin(QPoint(rects[0].x, rects[0].y));
02230         XFillRectangles(d->dpy, d->hd, d->gc, rects, n);
02231         d->resetAdaptedOrigin();
02232     }
02233 }

Here is the call graph for this function:


Friends And Related Function Documentation

friend class QPixmap [friend]

Definition at line 113 of file qpaintengine_x11_p.h.

Referenced by updateBrush().

friend class QFontEngineBox [friend]

Reimplemented from QPaintEngine.

Definition at line 114 of file qpaintengine_x11_p.h.

Q_GUI_EXPORT GC qt_x11_get_pen_gc ( QPainter p  )  [friend]

Returns the X11 specific pen GC for the painter p. Note that QPainter::begin() must be called before this function returns a valid GC.

Definition at line 69 of file qpaintengine_x11.cpp.

00070 {
00071     if (p && p->paintEngine()
00072         && p->paintEngine()->isActive()
00073         && p->paintEngine()->type() == QPaintEngine::X11) {
00074         return static_cast<QX11PaintEngine *>(p->paintEngine())->d_func()->gc;
00075     }
00076     return 0;
00077 }

Q_GUI_EXPORT GC qt_x11_get_brush_gc ( QPainter p  )  [friend]

Returns the X11 specific brush GC for the painter p. Note that QPainter::begin() must be called before this function returns a valid GC.

Definition at line 84 of file qpaintengine_x11.cpp.

00085 {
00086     if (p && p->paintEngine()
00087         && p->paintEngine()->isActive()
00088         && p->paintEngine()->type() == QPaintEngine::X11) {
00089         return static_cast<QX11PaintEngine *>(p->paintEngine())->d_func()->gc_brush;
00090     }
00091     return 0;
00092 }


The documentation for this class was generated from the following files:
Generated on Thu Mar 15 19:56:17 2007 for Qt 4.2 User's Guide by  doxygen 1.5.1