diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp index b58e22dcb..66e238d93 100644 --- a/src/gui/painting/qpaintengine_x11.cpp +++ b/src/gui/painting/qpaintengine_x11.cpp @@ -2116,139 +2116,4 @@ void QX11PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, co } } -void QX11PaintEngine::drawTextItem(const QPointF &p, const QTextItem &textItem) -{ - const QTextItemInt &ti = static_cast(textItem); - - switch(ti.fontEngine->type()) { - case QFontEngine::Box: - d_func()->drawBoxTextItem(p, ti); - break; -#ifndef QT_NO_FONTCONFIG - case QFontEngine::Freetype: - drawFreetype(p, ti); - break; -#endif - default: - Q_ASSERT(false); - } -} - -#ifndef QT_NO_FONTCONFIG -static QPainterPath path_for_glyphs(const QVarLengthArray &glyphs, - const QVarLengthArray &positions, - const QFontEngineFT *ft) -{ - QPainterPath path; - path.setFillRule(Qt::WindingFill); - ft->lockFace(); - int i = 0; - while (i < glyphs.size()) { - QFontEngineFT::Glyph *glyph = ft->loadGlyph(glyphs[i], QFontEngineFT::Format_Mono); - // #### fix case where we don't get a glyph - if (!glyph) - break; - - Q_ASSERT(glyph->format == QFontEngineFT::Format_Mono); - int n = 0; - int h = glyph->height; - int xp = qRound(positions[i].x); - int yp = qRound(positions[i].y); - - xp += glyph->x; - yp += -glyph->y + glyph->height; - int pitch = ((glyph->width + 31) & ~31) >> 3; - - uchar *src = glyph->data; - while (h--) { - for (int x = 0; x < glyph->width; ++x) { - bool set = src[x >> 3] & (0x80 >> (x & 7)); - if (set) { - QRect r(xp + x, yp - h, 1, 1); - while (x+1 < glyph->width && src[(x+1) >> 3] & (0x80 >> ((x+1) & 7))) { - ++x; - r.setRight(r.right()+1); - } - - path.addRect(r); - ++n; - } - } - src += pitch; - } - ++i; - } - ft->unlockFace(); - return path; -} - -void QX11PaintEngine::drawFreetype(const QPointF &p, const QTextItemInt &ti) -{ - Q_D(QX11PaintEngine); - if (!ti.glyphs.numGlyphs) - return; - - if (!d->cpen.isSolid()) { - QPaintEngine::drawTextItem(p, ti); - return; - } - - QFontEngineX11FT *ft = static_cast(ti.fontEngine); - QVarLengthArray positions; - QVarLengthArray glyphs; - const QTransform matrix = QTransform::fromTranslate(p.x(), p.y()); - - ft->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); - if (glyphs.count() == 0) - return; - - QPainterPath path = path_for_glyphs(glyphs, positions, ft); - if (path.elementCount() <= 1) - return; - Q_ASSERT((path.elementCount() % 5) == 0); - if (d->txop >= QTransform::TxScale) { - painter()->save(); - painter()->setBrush(d->cpen.brush()); - painter()->setPen(Qt::NoPen); - painter()->drawPath(path); - painter()->restore(); - return; - } - - const int rectcount = 256; - XRectangle rects[rectcount]; - int num_rects = 0; - - QPoint delta(qRound(d->matrix.dx()), qRound(d->matrix.dy())); - QRect clip(d->polygonClipper.boundingRect()); - for (int i=0; i < path.elementCount(); i+=5) { - int x = qRound(path.elementAt(i).x); - int y = qRound(path.elementAt(i).y); - int w = qRound(path.elementAt(i+1).x) - x; - int h = qRound(path.elementAt(i+2).y) - y; - - QRect rect = QRect(x + delta.x(), y + delta.y(), w, h); - rect = rect.intersected(clip); - if (rect.isEmpty()) - continue; - - rects[num_rects].x = short(rect.x()); - rects[num_rects].y = short(rect.y()); - rects[num_rects].width = ushort(rect.width()); - rects[num_rects].height = ushort(rect.height()); - ++num_rects; - if (num_rects == rectcount) { - XFillRectangles(d->dpy, d->hd, d->gc, rects, num_rects); - num_rects = 0; - } - } - if (num_rects > 0) - XFillRectangles(d->dpy, d->hd, d->gc, rects, num_rects); - -} -#endif // !QT_NO_XRENDER - QT_END_NAMESPACE - - - diff --git a/src/gui/painting/qpaintengine_x11_p.h b/src/gui/painting/qpaintengine_x11_p.h index 58c7aded7..9d9cb701e 100644 --- a/src/gui/painting/qpaintengine_x11_p.h +++ b/src/gui/painting/qpaintengine_x11_p.h @@ -84,7 +84,6 @@ public: 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); @@ -95,10 +94,6 @@ public: protected: QX11PaintEngine(QX11PaintEnginePrivate &dptr); -#ifndef QT_NO_FONTCONFIG - void drawFreetype(const QPointF &p, const QTextItemInt &si); -#endif - friend class QPixmap; friend class QFontEngineBox;