remove obsolete stuff

everything inside QT3_SUPPORT is gone in
gui/painting
This commit is contained in:
Lars Knoll 2011-05-03 21:51:54 +02:00
parent 34f712e79e
commit 52352c6c57
13 changed files with 0 additions and 1132 deletions

View File

@ -40,7 +40,6 @@ HEADERS += \
painting/qtextureglyphcache_p.h \
painting/qtransform.h \
painting/qwindowsurface_p.h \
painting/qwmatrix.h \
painting/qpaintbuffer_p.h

View File

@ -712,36 +712,6 @@ void QBrush::setColor(const QColor &c)
Sets the brush color to the given \a color.
*/
#ifdef QT3_SUPPORT
/*!
\fn void QBrush::setPixmap(const QPixmap &pixmap)
\compat
Sets a custom pattern for this brush.
Use setTexture() instead.
*/
/*!
\fn QPixmap *QBrush::pixmap() const
Returns a pointer to the custom brush pattern.
Use texture() instead.
*/
QPixmap *QBrush::pixmap() const
{
if (d->style != Qt::TexturePattern)
return 0;
QTexturedBrushData *data = static_cast<QTexturedBrushData*>(d.data());
QPixmap &pixmap = data->pixmap();
return pixmap.isNull() ? 0 : &pixmap;
}
#endif
/*!
\fn QPixmap QBrush::texture() const

View File

@ -126,12 +126,6 @@ public:
bool operator==(const QBrush &b) const;
inline bool operator!=(const QBrush &b) const { return !(operator==(b)); }
#ifdef QT3_SUPPORT
inline QT3_SUPPORT operator const QColor&() const;
QT3_SUPPORT QPixmap *pixmap() const;
inline QT3_SUPPORT void setPixmap(const QPixmap &pixmap) { setTexture(pixmap); }
#endif
private:
#if defined(Q_WS_X11)
friend class QX11PaintEngine;
@ -185,10 +179,6 @@ inline const QMatrix &QBrush::matrix() const { return d->transform.toAffine(); }
inline QTransform QBrush::transform() const { return d->transform; }
inline bool QBrush::isDetached() const { return d->ref == 1; }
#ifdef QT3_SUPPORT
inline QBrush::operator const QColor&() const { return d->color; }
#endif
/*******************************************************************************
* QGradients

View File

@ -2463,30 +2463,6 @@ void QColor::invalidate()
ct.argb.pad = 0;
}
#ifdef QT3_SUPPORT
/*!
Returns the pixel value used by the underlying window system to refer to a
color.
Use QColormap::pixel() instead.
\oldcode
QColor myColor;
uint pixel = myColor.pixel(screen);
\newcode
QColormap cmap = QColormap::instance(screen);
uint pixel = cmap.pixel(*this);
\endcode
*/
uint QColor::pixel(int screen) const
{
QColormap cmap = QColormap::instance(screen);
return cmap.pixel(*this);
}
#endif // QT3_SUPPORT
/*****************************************************************************
QColor stream functions
*****************************************************************************/

View File

@ -208,30 +208,9 @@ public:
static void setAllowX11ColorNames(bool enabled);
#endif
#ifdef QT3_SUPPORT
inline QT3_SUPPORT_CONSTRUCTOR QColor(int x, int y, int z, Spec colorSpec)
{ if (colorSpec == Hsv) setHsv(x, y, z); else setRgb(x, y, z); }
inline QT3_SUPPORT void rgb(int *r, int *g, int *b) const
{ getRgb(r, g, b); }
inline QT3_SUPPORT void hsv(int *h, int *s, int *v) const
{ getHsv(h, s, v); }
inline QT3_SUPPORT void setRgba(int r, int g, int b, int a)
{ setRgb(r, g, b, a); }
inline QT3_SUPPORT void getRgba(int *r, int *g, int *b, int *a) const
{ getRgb(r, g, b, a); }
QT3_SUPPORT uint pixel(int screen = -1) const;
#endif
static bool isValidColor(const QString &name);
private:
#ifndef QT3_SUPPORT
// do not allow a spec to be used as an alpha value
QColor(int, int, int, Spec);
#endif
void invalidate();
bool setColorFromString(const QString &name);

View File

@ -742,312 +742,6 @@ void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &c,
lineWidth, fill);
}
#ifdef QT3_SUPPORT
static void qDrawWinArrow(QPainter *p, Qt::ArrowType type, bool down,
int x, int y, int w, int h,
const QPalette &pal, bool enabled)
{
QPolygon a; // arrow polygon
switch (type) {
case Qt::UpArrow:
a.setPoints(7, -3,1, 3,1, -2,0, 2,0, -1,-1, 1,-1, 0,-2);
break;
case Qt::DownArrow:
a.setPoints(7, -3,-1, 3,-1, -2,0, 2,0, -1,1, 1,1, 0,2);
break;
case Qt::LeftArrow:
a.setPoints(7, 1,-3, 1,3, 0,-2, 0,2, -1,-1, -1,1, -2,0);
break;
case Qt::RightArrow:
a.setPoints(7, -1,-3, -1,3, 0,-2, 0,2, 1,-1, 1,1, 2,0);
break;
default:
break;
}
if (a.isEmpty())
return;
if (down) {
x++;
y++;
}
QPen savePen = p->pen(); // save current pen
if (down)
p->setBrushOrigin(p->brushOrigin() + QPoint(1,1));
p->fillRect(x, y, w, h, pal.brush(QPalette::Button));
if (down)
p->setBrushOrigin(p->brushOrigin() - QPoint(1,1));
if (enabled) {
a.translate(x+w/2, y+h/2);
p->setPen(pal.foreground().color());
p->drawLine(a.at(0), a.at(1));
p->drawLine(a.at(2), a.at(2));
p->drawPoint(a[6]);
} else {
a.translate(x+w/2+1, y+h/2+1);
p->setPen(pal.light().color());
p->drawLine(a.at(0), a.at(1));
p->drawLine(a.at(2), a.at(2));
p->drawPoint(a[6]);
a.translate(-1, -1);
p->setPen(pal.mid().color());
p->drawLine(a.at(0), a.at(1));
p->drawLine(a.at(2), a.at(2));
p->drawPoint(a[6]);
}
p->setPen(savePen); // restore pen
}
#endif // QT3_SUPPORT
#if defined(Q_CC_MSVC)
#pragma warning(disable: 4244)
#endif
#ifdef QT3_SUPPORT
#ifndef QT_NO_STYLE_MOTIF
// motif arrows look the same whether they are used or not
// is this correct?
static void qDrawMotifArrow(QPainter *p, Qt::ArrowType type, bool down,
int x, int y, int w, int h,
const QPalette &pal, bool)
{
QPolygon bFill; // fill polygon
QPolygon bTop; // top shadow.
QPolygon bBot; // bottom shadow.
QPolygon bLeft; // left shadow.
QTransform matrix; // xform matrix
bool vertical = type == Qt::UpArrow || type == Qt::DownArrow;
bool horizontal = !vertical;
int dim = w < h ? w : h;
int colspec = 0x0000; // color specification array
if (dim < 2) // too small arrow
return;
if (dim > 3) {
if (dim > 6)
bFill.resize(dim & 1 ? 3 : 4);
bTop.resize((dim/2)*2);
bBot.resize(dim & 1 ? dim + 1 : dim);
bLeft.resize(dim > 4 ? 4 : 2);
bLeft.putPoints(0, 2, 0,0, 0,dim-1);
if (dim > 4)
bLeft.putPoints(2, 2, 1,2, 1,dim-3);
bTop.putPoints(0, 4, 1,0, 1,1, 2,1, 3,1);
bBot.putPoints(0, 4, 1,dim-1, 1,dim-2, 2,dim-2, 3,dim-2);
for(int i=0; i<dim/2-2 ; i++) {
bTop.putPoints(i*2+4, 2, 2+i*2,2+i, 5+i*2, 2+i);
bBot.putPoints(i*2+4, 2, 2+i*2,dim-3-i, 5+i*2,dim-3-i);
}
if (dim & 1) // odd number size: extra line
bBot.putPoints(dim-1, 2, dim-3,dim/2, dim-1,dim/2);
if (dim > 6) { // dim>6: must fill interior
bFill.putPoints(0, 2, 1,dim-3, 1,2);
if (dim & 1) // if size is an odd number
bFill.setPoint(2, dim - 3, dim / 2);
else
bFill.putPoints(2, 2, dim-4,dim/2-1, dim-4,dim/2);
}
}
else {
if (dim == 3) { // 3x3 arrow pattern
bLeft.setPoints(4, 0,0, 0,2, 1,1, 1,1);
bTop .setPoints(2, 1,0, 1,0);
bBot .setPoints(2, 1,2, 2,1);
}
else { // 2x2 arrow pattern
bLeft.setPoints(2, 0,0, 0,1);
bTop .setPoints(2, 1,0, 1,0);
bBot .setPoints(2, 1,1, 1,1);
}
}
if (type == Qt::UpArrow || type == Qt::LeftArrow) {
matrix.translate(x, y);
if (vertical) {
matrix.translate(0, h - 1);
matrix.rotate(-90);
} else {
matrix.translate(w - 1, h - 1);
matrix.rotate(180);
}
if (down)
colspec = horizontal ? 0x2334 : 0x2343;
else
colspec = horizontal ? 0x1443 : 0x1434;
}
else if (type == Qt::DownArrow || type == Qt::RightArrow) {
matrix.translate(x, y);
if (vertical) {
matrix.translate(w-1, 0);
matrix.rotate(90);
}
if (down)
colspec = horizontal ? 0x2443 : 0x2434;
else
colspec = horizontal ? 0x1334 : 0x1343;
}
const QColor *cols[5];
cols[0] = 0;
cols[1] = &pal.button().color();
cols[2] = &pal.mid().color();
cols[3] = &pal.light().color();
cols[4] = &pal.dark().color();
#define CMID *cols[(colspec>>12) & 0xf]
#define CLEFT *cols[(colspec>>8) & 0xf]
#define CTOP *cols[(colspec>>4) & 0xf]
#define CBOT *cols[colspec & 0xf]
QPen savePen = p->pen(); // save current pen
QBrush saveBrush = p->brush(); // save current brush
QTransform wxm = p->transform();
QPen pen(Qt::NoPen);
const QBrush &brush = pal.brush(QPalette::Button);
p->setPen(pen);
p->setBrush(brush);
p->setTransform(matrix, true); // set transformation matrix
p->drawPolygon(bFill); // fill arrow
p->setBrush(Qt::NoBrush); // don't fill
p->setPen(CLEFT);
p->drawLines(bLeft);
p->setPen(CTOP);
p->drawLines(bTop);
p->setPen(CBOT);
p->drawLines(bBot);
p->setTransform(wxm);
p->setBrush(saveBrush); // restore brush
p->setPen(savePen); // restore pen
#undef CMID
#undef CLEFT
#undef CTOP
#undef CBOT
}
#endif // QT_NO_STYLE_MOTIF
QRect qItemRect(QPainter *p, Qt::GUIStyle gs,
int x, int y, int w, int h,
int flags,
bool enabled,
const QPixmap *pixmap,
const QString& text, int len)
{
QRect result;
if (pixmap) {
if ((flags & Qt::AlignVCenter) == Qt::AlignVCenter)
y += h/2 - pixmap->height()/2;
else if ((flags & Qt::AlignBottom) == Qt::AlignBottom)
y += h - pixmap->height();
if ((flags & Qt::AlignRight) == Qt::AlignRight)
x += w - pixmap->width();
else if ((flags & Qt::AlignHCenter) == Qt::AlignHCenter)
x += w/2 - pixmap->width()/2;
else if ((flags & Qt::AlignLeft) != Qt::AlignLeft && QGuiApplication::isRightToLeft())
x += w - pixmap->width();
result = QRect(x, y, pixmap->width(), pixmap->height());
} else if (!text.isNull() && p) {
result = p->boundingRect(QRect(x, y, w, h), flags, text.left(len));
if (gs == Qt::WindowsStyle && !enabled) {
result.setWidth(result.width()+1);
result.setHeight(result.height()+1);
}
} else {
result = QRect(x, y, w, h);
}
return result;
}
void qDrawArrow(QPainter *p, Qt::ArrowType type, Qt::GUIStyle style, bool down,
int x, int y, int w, int h,
const QPalette &pal, bool enabled)
{
switch (style) {
case Qt::WindowsStyle:
qDrawWinArrow(p, type, down, x, y, w, h, pal, enabled);
break;
#ifndef QT_NO_STYLE_MOTIF
case Qt::MotifStyle:
qDrawMotifArrow(p, type, down, x, y, w, h, pal, enabled);
break;
#endif
default:
qWarning("qDrawArrow: Requested unsupported GUI style");
}
}
void qDrawItem(QPainter *p, Qt::GUIStyle gs,
int x, int y, int w, int h,
int flags,
const QPalette &pal, bool enabled,
const QPixmap *pixmap,
const QString& text, int len , const QColor* penColor)
{
p->setPen(penColor?*penColor:pal.foreground().color());
if (pixmap) {
QPixmap pm(*pixmap);
bool clip = (flags & Qt::TextDontClip) == 0;
if (clip) {
if (pm.width() < w && pm.height() < h)
clip = false;
else
p->setClipRect(x, y, w, h);
}
if ((flags & Qt::AlignVCenter) == Qt::AlignVCenter)
y += h/2 - pm.height()/2;
else if ((flags & Qt::AlignBottom) == Qt::AlignBottom)
y += h - pm.height();
if ((flags & Qt::AlignRight) == Qt::AlignRight)
x += w - pm.width();
else if ((flags & Qt::AlignHCenter) == Qt::AlignHCenter)
x += w/2 - pm.width()/2;
else if (((flags & Qt::AlignLeft) != Qt::AlignLeft) && QGuiApplication::isRightToLeft()) // Qt::AlignAuto && rightToLeft
x += w - pm.width();
if (!enabled) {
if (pm.hasAlphaChannel()) { // pixmap with a mask
pm = pm.mask();
} else if (pm.depth() == 1) { // monochrome pixmap, no mask
;
#ifndef QT_NO_IMAGE_HEURISTIC_MASK
} else { // color pixmap, no mask
QString k = QLatin1Literal("$qt-drawitem")
% HexString<qint64>(pm.cacheKey());
if (!QPixmapCache::find(k, pm)) {
pm = pm.createHeuristicMask();
pm.setMask((QBitmap&)pm);
QPixmapCache::insert(k, pm);
}
#endif
}
if (gs == Qt::WindowsStyle) {
p->setPen(pal.light().color());
p->drawPixmap(x+1, y+1, pm);
p->setPen(pal.text().color());
}
}
p->drawPixmap(x, y, pm);
if (clip)
p->setClipping(false);
} else if (!text.isNull()) {
if (gs == Qt::WindowsStyle && !enabled) {
p->setPen(pal.light().color());
p->drawText(x+1, y+1, w, h, flags, text.left(len));
p->setPen(pal.text().color());
}
p->drawText(x, y, w, h, flags, text.left(len));
}
}
#endif
/*!
\class QTileRules

View File

@ -53,9 +53,6 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
class QPainter;
#ifndef QT3_SUPPORT
class QColorGroup;
#endif
class QPalette;
class QPoint;
class QColor;
@ -115,23 +112,6 @@ Q_GUI_EXPORT void qDrawPlainRect(QPainter *p, const QRect &r, const QColor &,
int lineWidth = 1, const QBrush *fill = 0);
#ifdef QT3_SUPPORT
//
// Use QStyle::itemRect(), QStyle::drawItem() and QStyle::drawArrow() instead.
//
Q_GUI_EXPORT QT3_SUPPORT QRect qItemRect(QPainter *p, Qt::GUIStyle gs, int x, int y, int w, int h,
int flags, bool enabled,
const QPixmap *pixmap, const QString& text, int len=-1);
Q_GUI_EXPORT QT3_SUPPORT void qDrawItem(QPainter *p, Qt::GUIStyle gs, int x, int y, int w, int h,
int flags, const QPalette &pal, bool enabled,
const QPixmap *pixmap, const QString& text,
int len=-1, const QColor* penColor = 0);
Q_GUI_EXPORT QT3_SUPPORT void qDrawArrow(QPainter *p, Qt::ArrowType type, Qt::GUIStyle style, bool down,
int x, int y, int w, int h,
const QPalette &pal, bool enabled);
#endif
struct QTileRules
{

View File

@ -118,12 +118,6 @@ public:
operator QVariant() const;
#ifdef QT3_SUPPORT
inline QT3_SUPPORT QMatrix invert(bool *invertible=0) const { return inverted(invertible); }
inline QT3_SUPPORT QRect map(const QRect &r) const { return mapRect(r); }
QT3_SUPPORT QRegion mapToRegion(const QRect &r) const;
#endif
private:
inline QMatrix(bool)
: _m11(1.)
@ -193,12 +187,6 @@ Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QMatrix &);
Q_GUI_EXPORT QDebug operator<<(QDebug, const QMatrix &);
#endif
#ifdef QT3_SUPPORT
QT_BEGIN_INCLUDE_NAMESPACE
#include <QtGui/qwmatrix.h>
QT_END_INCLUDE_NAMESPACE
#endif
QT_END_NAMESPACE
QT_END_HEADER

View File

@ -111,55 +111,12 @@ protected:
private:
Q_DISABLE_COPY(QPaintDevice)
#if defined(Q_WS_X11) && defined(QT3_SUPPORT)
public:
QT3_SUPPORT Display *x11Display() const;
QT3_SUPPORT int x11Screen() const;
QT3_SUPPORT int x11Depth() const;
QT3_SUPPORT int x11Cells() const;
QT3_SUPPORT Qt::HANDLE x11Colormap() const;
QT3_SUPPORT bool x11DefaultColormap() const;
QT3_SUPPORT void *x11Visual() const;
QT3_SUPPORT bool x11DefaultVisual() const;
static QT3_SUPPORT Display *x11AppDisplay();
static QT3_SUPPORT int x11AppScreen();
static QT3_SUPPORT int x11AppDepth(int screen = -1);
static QT3_SUPPORT int x11AppCells(int screen = -1);
static QT3_SUPPORT Qt::HANDLE x11AppRootWindow(int screen = -1);
static QT3_SUPPORT Qt::HANDLE x11AppColormap(int screen = -1);
static QT3_SUPPORT void *x11AppVisual(int screen = -1);
static QT3_SUPPORT bool x11AppDefaultColormap(int screen =-1);
static QT3_SUPPORT bool x11AppDefaultVisual(int screen =-1);
static QT3_SUPPORT int x11AppDpiX(int screen = -1);
static QT3_SUPPORT int x11AppDpiY(int screen = -1);
static QT3_SUPPORT void x11SetAppDpiX(int, int);
static QT3_SUPPORT void x11SetAppDpiY(int, int);
#endif
friend class QPainter;
friend class QFontEngineMac;
friend class QX11PaintEngine;
friend Q_GUI_EXPORT int qt_paint_device_metric(const QPaintDevice *device, PaintDeviceMetric metric);
};
#ifdef QT3_SUPPORT
QT3_SUPPORT Q_GUI_EXPORT
void bitBlt(QPaintDevice *dst, int dx, int dy,
const QPaintDevice *src, int sx=0, int sy=0, int sw=-1, int sh=-1,
bool ignoreMask=false);
QT3_SUPPORT Q_GUI_EXPORT
void bitBlt(QPaintDevice *dst, int dx, int dy,
const QImage *src, int sx=0, int sy=0, int sw=-1, int sh=-1,
int conversion_flags=0);
QT3_SUPPORT Q_GUI_EXPORT
void bitBlt(QPaintDevice *dst, const QPoint &dp,
const QPaintDevice *src, const QRect &sr=QRect(0,0,-1,-1),
bool ignoreMask=false);
#endif
/*****************************************************************************
Inline functions
*****************************************************************************/

View File

@ -81,118 +81,4 @@ const Q_GUI_EXPORT QX11Info *qt_x11Info(const QPaintDevice *pd)
return 0;
}
#ifdef QT3_SUPPORT
Display *QPaintDevice::x11Display() const
{
return X11->display;
}
int QPaintDevice::x11Screen() const
{
const QX11Info *info = qt_x11Info(this);
if (info)
return info->screen();
return QX11Info::appScreen();
}
void *QPaintDevice::x11Visual() const
{
const QX11Info *info = qt_x11Info(this);
if (info)
return info->visual();
return QX11Info::appVisual();
}
int QPaintDevice::x11Depth() const
{
const QX11Info *info = qt_x11Info(this);
if (info)
return info->depth();
return QX11Info::appDepth();
}
int QPaintDevice::x11Cells() const
{
const QX11Info *info = qt_x11Info(this);
if (info)
return info->cells();
return QX11Info::appCells();
}
Qt::HANDLE QPaintDevice::x11Colormap() const
{
const QX11Info *info = qt_x11Info(this);
if (info)
return info->colormap();
return QX11Info::appColormap();
}
bool QPaintDevice::x11DefaultColormap() const
{
const QX11Info *info = qt_x11Info(this);
if (info)
return info->defaultColormap();
return QX11Info::appDefaultColormap();
}
bool QPaintDevice::x11DefaultVisual() const
{
const QX11Info *info = qt_x11Info(this);
if (info)
return info->defaultVisual();
return QX11Info::appDefaultVisual();
}
void *QPaintDevice::x11AppVisual(int screen)
{ return QX11Info::appVisual(screen); }
Qt::HANDLE QPaintDevice::x11AppColormap(int screen)
{ return QX11Info::appColormap(screen); }
Display *QPaintDevice::x11AppDisplay()
{ return QX11Info::display(); }
int QPaintDevice::x11AppScreen()
{ return QX11Info::appScreen(); }
int QPaintDevice::x11AppDepth(int screen)
{ return QX11Info::appDepth(screen); }
int QPaintDevice::x11AppCells(int screen)
{ return QX11Info::appCells(screen); }
Qt::HANDLE QPaintDevice::x11AppRootWindow(int screen)
{ return QX11Info::appRootWindow(screen); }
bool QPaintDevice::x11AppDefaultColormap(int screen)
{ return QX11Info::appDefaultColormap(screen); }
bool QPaintDevice::x11AppDefaultVisual(int screen)
{ return QX11Info::appDefaultVisual(screen); }
void QPaintDevice::x11SetAppDpiX(int dpi, int screen)
{
QX11Info::setAppDpiX(dpi, screen);
}
void QPaintDevice::x11SetAppDpiY(int dpi, int screen)
{
QX11Info::setAppDpiY(dpi, screen);
}
int QPaintDevice::x11AppDpiX(int screen)
{
return QX11Info::appDpiX(screen);
}
int QPaintDevice::x11AppDpiY(int screen)
{
return QX11Info::appDpiY(screen);
}
#endif
QT_END_NAMESPACE

View File

@ -56,7 +56,6 @@
#include "qpixmapcache.h"
#include "qpolygon.h"
#include "qtextlayout.h"
#include "qwidget.h"
#include "qstyle.h"
#include "qthread.h"
#include "qvarlengtharray.h"
@ -4603,82 +4602,6 @@ void QPainter::drawChord(const QRectF &r, int a, int alen)
startAngle and \a spanAngle.
*/
#ifdef QT3_SUPPORT
/*!
\fn void QPainter::drawLineSegments(const QPolygon &polygon, int
index, int count)
Draws \a count separate lines from points defined by the \a
polygon, starting at \a{polygon}\e{[index]} (\a index defaults to
0). If \a count is -1 (the default) all points until the end of
the array are used.
Use drawLines() combined with QPolygon::constData() instead.
\oldcode
QPainter painter(this);
painter.drawLineSegments(polygon, index, count);
\newcode
int lineCount = (count == -1) ? (polygon.size() - index) / 2 : count;
QPainter painter(this);
painter.drawLines(polygon.constData() + index * 2, lineCount);
\endcode
*/
void QPainter::drawLineSegments(const QPolygon &a, int index, int nlines)
{
#ifdef QT_DEBUG_DRAW
if (qt_show_painter_debug_output)
printf("QPainter::drawLineSegments(), count=%d\n", a.size()/2);
#endif
Q_D(QPainter);
if (!d->engine)
return;
if (nlines < 0)
nlines = a.size()/2 - index/2;
if (index + nlines*2 > (int)a.size())
nlines = (a.size() - index)/2;
if (nlines < 1 || index < 0)
return;
if (d->extended) {
// FALCON: Use QVectorPath
QVector<QLineF> lines;
for (int i=index; i<index + nlines*2; i+=2)
lines << QLineF(a.at(i), a.at(i+1));
d->extended->drawLines(lines.data(), lines.size());
return;
}
d->updateState(d->state);
QVector<QLineF> lines;
if (d->state->emulationSpecifier) {
if (d->state->emulationSpecifier == QPaintEngine::PrimitiveTransform
&& d->state->matrix.type() == QTransform::TxTranslate) {
QPointF offset(d->state->matrix.dx(), d->state->matrix.dy());
for (int i=index; i<index + nlines*2; i+=2)
lines << QLineF(a.at(i) + offset, a.at(i+1) + offset);
} else {
QPainterPath linesPath;
for (int i=index; i<index + nlines*2; i+=2) {
linesPath.moveTo(a.at(i));
linesPath.lineTo(a.at(i+1));
}
d->draw_helper(linesPath, QPainterPrivate::StrokeDraw);
return;
}
} else {
for (int i=index; i<index + nlines*2; i+=2)
lines << QLineF(a.at(i), a.at(i+1));
}
d->engine->drawLines(lines.data(), lines.size());
}
#endif // QT3_SUPPORT
/*!
Draws the first \a lineCount lines in the array \a lines
@ -7491,307 +7414,6 @@ void QPainter::setViewTransformEnabled(bool enable)
d->updateMatrix();
}
#ifdef QT3_SUPPORT
/*!
\obsolete
Use the worldTransform() combined with QTransform::dx() instead.
\oldcode
QPainter painter(this);
qreal x = painter.translationX();
\newcode
QPainter painter(this);
qreal x = painter.worldTransform().dx();
\endcode
*/
qreal QPainter::translationX() const
{
Q_D(const QPainter);
if (!d->engine) {
qWarning("QPainter::translationX: Painter not active");
return 0.0;
}
return d->state->worldMatrix.dx();
}
/*!
\obsolete
Use the worldTransform() combined with QTransform::dy() instead.
\oldcode
QPainter painter(this);
qreal y = painter.translationY();
\newcode
QPainter painter(this);
qreal y = painter.worldTransform().dy();
\endcode
*/
qreal QPainter::translationY() const
{
Q_D(const QPainter);
if (!d->engine) {
qWarning("QPainter::translationY: Painter not active");
return 0.0;
}
return d->state->worldMatrix.dy();
}
/*!
\fn void QPainter::map(int x, int y, int *rx, int *ry) const
\internal
Sets (\a{rx}, \a{ry}) to the point that results from applying the
painter's current transformation on the point (\a{x}, \a{y}).
*/
void QPainter::map(int x, int y, int *rx, int *ry) const
{
QPoint p(x, y);
p = p * combinedMatrix();
*rx = p.x();
*ry = p.y();
}
/*!
\fn QPoint QPainter::xForm(const QPoint &point) const
Use combinedTransform() instead.
*/
QPoint QPainter::xForm(const QPoint &p) const
{
Q_D(const QPainter);
if (!d->engine) {
qWarning("QPainter::xForm: Painter not active");
return QPoint();
}
if (d->state->matrix.type() == QTransform::TxNone)
return p;
return p * combinedMatrix();
}
/*!
\fn QRect QPainter::xForm(const QRect &rectangle) const
\overload
Use combinedTransform() instead of this function and call
mapRect() on the result to obtain a QRect.
*/
QRect QPainter::xForm(const QRect &r) const
{
Q_D(const QPainter);
if (!d->engine) {
qWarning("QPainter::xForm: Painter not active");
return QRect();
}
if (d->state->matrix.type() == QTransform::TxNone)
return r;
return combinedMatrix().mapRect(r);
}
/*!
\fn QPolygon QPainter::xForm(const QPolygon &polygon) const
\overload
Use combinedTransform() instead.
*/
QPolygon QPainter::xForm(const QPolygon &a) const
{
Q_D(const QPainter);
if (!d->engine) {
qWarning("QPainter::xForm: Painter not active");
return QPolygon();
}
if (d->state->matrix.type() == QTransform::TxNone)
return a;
return a * combinedMatrix();
}
/*!
\fn QPolygon QPainter::xForm(const QPolygon &polygon, int index, int count) const
\overload
Use combinedTransform() combined with QPolygon::mid() instead.
\oldcode
QPainter painter(this);
QPolygon transformed = painter.xForm(polygon, index, count)
\newcode
QPainter painter(this);
QPolygon transformed = polygon.mid(index, count) * painter.combinedTransform();
\endcode
*/
QPolygon QPainter::xForm(const QPolygon &av, int index, int npoints) const
{
int lastPoint = npoints < 0 ? av.size() : index+npoints;
QPolygon a(lastPoint-index);
memcpy(a.data(), av.data()+index, (lastPoint-index)*sizeof(QPoint));
return a * combinedMatrix();
}
/*!
\fn QPoint QPainter::xFormDev(const QPoint &point) const
\overload
\obsolete
Use combinedTransform() combined with QTransform::inverted() instead.
\oldcode
QPainter painter(this);
QPoint transformed = painter.xFormDev(point);
\newcode
QPainter painter(this);
QPoint transformed = point * painter.combinedTransform().inverted();
\endcode
*/
QPoint QPainter::xFormDev(const QPoint &p) const
{
Q_D(const QPainter);
if (!d->engine) {
qWarning("QPainter::xFormDev: Painter not active");
return QPoint();
}
if(d->state->matrix.type() == QTransform::TxNone)
return p;
return p * combinedMatrix().inverted();
}
/*!
\fn QRect QPainter::xFormDev(const QRect &rectangle) const
\overload
\obsolete
Use combinedTransform() combined with QTransform::inverted() instead.
\oldcode
QPainter painter(this);
QRect transformed = painter.xFormDev(rectangle);
\newcode
QPainter painter(this);
QRegion region = QRegion(rectangle) * painter.combinedTransform().inverted();
QRect transformed = region.boundingRect();
\endcode
*/
QRect QPainter::xFormDev(const QRect &r) const
{
Q_D(const QPainter);
if (!d->engine) {
qWarning("QPainter::xFormDev: Painter not active");
return QRect();
}
if (d->state->matrix.type() == QTransform::TxNone)
return r;
return combinedMatrix().inverted().mapRect(r);
}
/*!
\overload
\fn QPoint QPainter::xFormDev(const QPolygon &polygon) const
\obsolete
Use combinedTransform() combined with QTransform::inverted() instead.
\oldcode
QPainter painter(this);
QPolygon transformed = painter.xFormDev(rectangle);
\newcode
QPainter painter(this);
QPolygon transformed = polygon * painter.combinedTransform().inverted();
\endcode
*/
QPolygon QPainter::xFormDev(const QPolygon &a) const
{
Q_D(const QPainter);
if (!d->engine) {
qWarning("QPainter::xFormDev: Painter not active");
return QPolygon();
}
if (d->state->matrix.type() == QTransform::TxNone)
return a;
return a * combinedMatrix().inverted();
}
/*!
\fn QPolygon QPainter::xFormDev(const QPolygon &polygon, int index, int count) const
\overload
\obsolete
Use combinedTransform() combined with QPolygon::mid() and QTransform::inverted() instead.
\oldcode
QPainter painter(this);
QPolygon transformed = painter.xFormDev(polygon, index, count);
\newcode
QPainter painter(this);
QPolygon transformed = polygon.mid(index, count) * painter.combinedTransform().inverted();
\endcode
*/
QPolygon QPainter::xFormDev(const QPolygon &ad, int index, int npoints) const
{
Q_D(const QPainter);
int lastPoint = npoints < 0 ? ad.size() : index+npoints;
QPolygon a(lastPoint-index);
memcpy(a.data(), ad.data()+index, (lastPoint-index)*sizeof(QPoint));
if (d->state->matrix.type() == QTransform::TxNone)
return a;
return a * combinedMatrix().inverted();
}
/*!
\fn void QPainter::drawCubicBezier(const QPolygon &controlPoints, int index)
Draws a cubic Bezier curve defined by the \a controlPoints,
starting at \a{controlPoints}\e{[index]} (\a index defaults to 0).
Points after \a{controlPoints}\e{[index + 3]} are ignored. Nothing
happens if there aren't enough control points.
Use strokePath() instead.
\oldcode
QPainter painter(this);
painter.drawCubicBezier(controlPoints, index)
\newcode
QPainterPath path;
path.moveTo(controlPoints.at(index));
path.cubicTo(controlPoints.at(index+1),
controlPoints.at(index+2),
controlPoints.at(index+3));
QPainter painter(this);
painter.strokePath(path, painter.pen());
\endcode
*/
void QPainter::drawCubicBezier(const QPolygon &a, int index)
{
Q_D(QPainter);
if (!d->engine)
return;
if ((int)a.size() - index < 4) {
qWarning("QPainter::drawCubicBezier: Cubic Bezier needs 4 control "
"points");
return;
}
QPainterPath path;
path.moveTo(a.at(index));
path.cubicTo(a.at(index+1), a.at(index+2), a.at(index+3));
strokePath(path, d->state->pen);
}
#endif
struct QPaintDeviceRedirection
{
@ -8335,45 +7957,6 @@ void QPainterState::init(QPainter *p) {
opacity = 1;
}
#ifdef QT3_SUPPORT
static void bitBlt_helper(QPaintDevice *dst, const QPoint &dp,
const QPaintDevice *src, const QRect &sr, bool)
{
Q_ASSERT(dst);
Q_ASSERT(src);
if (src->devType() == QInternal::Pixmap) {
const QPixmap *pixmap = static_cast<const QPixmap *>(src);
QPainter pt(dst);
pt.drawPixmap(dp, *pixmap, sr);
} else {
qWarning("QPainter: bitBlt only works when source is of type pixmap");
}
}
void bitBlt(QPaintDevice *dst, int dx, int dy,
const QPaintDevice *src, int sx, int sy, int sw, int sh,
bool ignoreMask )
{
bitBlt_helper(dst, QPoint(dx, dy), src, QRect(sx, sy, sw, sh), ignoreMask);
}
void bitBlt(QPaintDevice *dst, const QPoint &dp, const QPaintDevice *src, const QRect &sr, bool ignoreMask)
{
bitBlt_helper(dst, dp, src, sr, ignoreMask);
}
void bitBlt(QPaintDevice *dst, int dx, int dy,
const QImage *src, int sx, int sy, int sw, int sh, int fl)
{
Qt::ImageConversionFlags flags(fl);
QPixmap srcPixmap = QPixmap::fromImage(*src, flags);
bitBlt_helper(dst, QPoint(dx, dy), &srcPixmap, QRect(sx, sy, sw, sh), false);
}
#endif // QT3_SUPPORT
/*!
\fn void QPainter::setBackgroundColor(const QColor &color)

View File

@ -464,79 +464,6 @@ public:
void beginNativePainting();
void endNativePainting();
#ifdef QT3_SUPPORT
inline QT3_SUPPORT void setBackgroundColor(const QColor &color) { setBackground(color); }
inline QT3_SUPPORT const QColor &backgroundColor() const { return background().color(); }
inline QT3_SUPPORT void drawText(int x, int y, const QString &s, int pos, int len)
{ drawText(x, y, s.mid(pos, len)); }
inline QT3_SUPPORT void drawText(const QPoint &p, const QString &s, int pos, int len)
{ drawText(p, s.mid(pos, len)); }
inline QT3_SUPPORT void drawText(int x, int y, const QString &s, int len)
{ drawText(x, y, s.left(len)); }
inline QT3_SUPPORT void drawText(const QPoint &p, const QString &s, int len)
{ drawText(p, s.left(len)); }
inline QT3_SUPPORT void drawText(const QRect &r, int flags, const QString &str, int len, QRect *br=0)
{ drawText(r, flags, str.left(len), br); }
inline QT3_SUPPORT void drawText(int x, int y, int w, int h, int flags, const QString &text, int len, QRect *br=0)
{ drawText(QRect(x, y, w, h), flags, text.left(len), br); }
inline QT3_SUPPORT QRect boundingRect(const QRect &rect, int flags, const QString &text, int len)
{ return boundingRect(rect, flags, text.left(len)); }
inline QT3_SUPPORT QRect boundingRect(int x, int y, int w, int h, int flags, const QString &text, int len)
{ return boundingRect(QRect(x, y, w, h), flags, text.left(len)); }
inline QT3_SUPPORT bool begin(QPaintDevice *pdev, const QWidget *init)
{ bool ret = begin(pdev); initFrom(init); return ret; }
QT3_SUPPORT void drawPoints(const QPolygon &pa, int index, int npoints = -1)
{ drawPoints(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
QT3_SUPPORT void drawCubicBezier(const QPolygon &pa, int index = 0);
QT3_SUPPORT void drawLineSegments(const QPolygon &points, int index = 0, int nlines = -1);
inline QT3_SUPPORT void drawPolyline(const QPolygon &pa, int index, int npoints = -1)
{ drawPolyline(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
inline QT3_SUPPORT void drawPolygon(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 QT3_SUPPORT void drawPolygon(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); }
inline QT3_SUPPORT void drawConvexPolygon(const QPolygonF &polygon, int index, int npoints = -1)
{ drawConvexPolygon(polygon.constData() + index, npoints == -1 ? polygon.size() - index : npoints); }
inline QT3_SUPPORT void drawConvexPolygon(const QPolygon &pa, int index, int npoints = -1)
{ drawConvexPolygon(pa.constData() + index, npoints == -1 ? pa.size() - index : npoints); }
static inline QT3_SUPPORT void redirect(QPaintDevice *pdev, QPaintDevice *replacement)
{ setRedirected(pdev, replacement); }
static inline QT3_SUPPORT QPaintDevice *redirect(QPaintDevice *pdev)
{ return const_cast<QPaintDevice*>(redirected(pdev)); }
inline QT3_SUPPORT void setWorldXForm(bool enabled) { setMatrixEnabled(enabled); }
inline QT3_SUPPORT bool hasWorldXForm() const { return matrixEnabled(); }
inline QT3_SUPPORT void resetXForm() { resetTransform(); }
inline QT3_SUPPORT void setViewXForm(bool enabled) { setViewTransformEnabled(enabled); }
inline QT3_SUPPORT bool hasViewXForm() const { return viewTransformEnabled(); }
QT3_SUPPORT void map(int x, int y, int *rx, int *ry) const;
QT3_SUPPORT QPoint xForm(const QPoint &) const; // map virtual -> deviceb
QT3_SUPPORT QRect xForm(const QRect &) const;
QT3_SUPPORT QPolygon xForm(const QPolygon &) const;
QT3_SUPPORT QPolygon xForm(const QPolygon &, int index, int npoints) const;
QT3_SUPPORT QPoint xFormDev(const QPoint &) const; // map device -> virtual
QT3_SUPPORT QRect xFormDev(const QRect &) const;
QT3_SUPPORT QPolygon xFormDev(const QPolygon &) const;
QT3_SUPPORT QPolygon xFormDev(const QPolygon &, int index, int npoints) const;
QT3_SUPPORT qreal translationX() const;
QT3_SUPPORT qreal translationY() const;
#endif
private:
Q_DISABLE_COPY(QPainter)
friend class Q3Painter;

View File

@ -1,61 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights. These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QWMATRIX_H
#define QWMATRIX_H
#include <QtGui/qmatrix.h>
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_MODULE(Gui)
#if defined(QT3_SUPPORT)
typedef QMatrix QWMatrix;
#endif
QT_END_NAMESPACE
QT_END_HEADER
#endif // QWMATRIX_H