diff --git a/experimental/tqtinterface/qt4/src/kernel/tqpainter.h b/experimental/tqtinterface/qt4/src/kernel/tqpainter.h index c1a509249..b3cd896c0 100644 --- a/experimental/tqtinterface/qt4/src/kernel/tqpainter.h +++ b/experimental/tqtinterface/qt4/src/kernel/tqpainter.h @@ -302,6 +302,7 @@ public: inline void tqdrawPolyline(const QPolygon &pa, int index, int npoints = -1) { drawPolyline(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); } inline void tqdrawPolygon(const QPolygon &pa, bool winding, int index = 0, int npoints = -1) { drawPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints, winding ? Qt::WindingFill : Qt::OddEvenFill); } inline void tqdrawPolygon(const QPolygonF &polygon, bool winding, int index = 0, int npoints = -1) { drawPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints, winding ? Qt::WindingFill : Qt::OddEvenFill); } + void tqdrawPolyline( const TQPointArray &, int index=0, int npoints=-1 ); inline void tqdrawConvexPolygon(const QPolygonF &polygon, int index, int npoints = -1) { drawConvexPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints); } inline void tqdrawConvexPolygon(const QPolygon &pa, int index, int npoints = -1) { drawConvexPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); } // static inline void redirect(QPaintDevice *pdev, QPaintDevice *replacement) { setRedirected(pdev, replacement); } diff --git a/experimental/tqtinterface/qt4/src/kernel/tqpainter_x11.cpp b/experimental/tqtinterface/qt4/src/kernel/tqpainter_x11.cpp index 7e68625f9..f5ad34888 100644 --- a/experimental/tqtinterface/qt4/src/kernel/tqpainter_x11.cpp +++ b/experimental/tqtinterface/qt4/src/kernel/tqpainter_x11.cpp @@ -242,12 +242,74 @@ void TQPainter::drawWinFocusRect( int x, int y, int w, int h, bool xorPaint, con printf("[WARNING] TQPainter::drawWinFocusRect may not draw the correct rectangle in all cases [due to shift from Xorg to Qt painting]\n\r"); // drawRect( x, y, w-1, h-1 ); - drawRect( x, y, w, h ); + drawRect( x, y, w, h ); setRasterOp( old_rop ); setPen( old_pen ); } +/*! + Draws the polyline defined by the \a npoints points in \a a + starting at \a a[index]. (\a index defaults to 0.) + + If \a npoints is -1 (the default) all points until the end of the + array are used (i.e. a.size()-index-1 line segments are drawn). + + \warning On X11, coordinates that do not fit into 16-bit signed + values are truncated. This limitation is expected to go away in + TQt 4. + + \sa drawLineSegments(), drawPolygon(), TQPen +*/ + +void TQPainter::tqdrawPolyline( const TQPointArray &a, int index, int npoints ) +{ + if ( npoints < 0 ) + npoints = a.size() - index; + if ( index + npoints > (int)a.size() ) + npoints = a.size() - index; + if ( !isActive() || npoints < 2 || index < 0 ) + return; + TQPointArray pa = a; + if ( testf(ExtDev|VxF|WxF) ) { + if ( testf(ExtDev) ) { +// if ( npoints != (int)pa.size() ) { +// pa = TQPointArray( npoints ); +// for ( int i=0; icmd(TQPaintDevice::PdcDrawPolyline, this, param) || !hd ) +// return; + printf("[FIXME] TQPainter::drawPolyline not yet supported on external paint devices\n\r"); + } +#if 0 + if ( txop != TxNone ) { + pa = xForm( pa, index, npoints ); + if ( pa.size() != a.size() ) { + index = 0; + npoints = pa.size(); + } + } + } + if ( cpen.style() != Qt::NoPen ) { + while(npoints>65535) { + XDrawLines( dpy, hd, gc, (XPoint*)(pa.shortPoints( index, 65535 )), + 65535, CoordModeOrigin ); + npoints-=65535; + index+=65535; + } + XDrawLines( dpy, hd, gc, (XPoint*)(pa.shortPoints( index, npoints )), + npoints, CoordModeOrigin ); + } +#else + } + printf("[WARNING] TQPainter::tqdrawPolyline UNIMPLEMENTED\n\r"); +#endif +} + #else // USE_QT4 // paintevent magic to provide Windows semantics on X11 @@ -3345,4 +3407,4 @@ TQPoint TQPainter::pos() const return curPt; } -#endif // USE_QT4 \ No newline at end of file +#endif // USE_QT4