summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authoraxis <qt-info@nokia.com>2010-02-16 11:53:07 (GMT)
committeraxis <qt-info@nokia.com>2010-02-16 11:53:07 (GMT)
commit15b08dffc1354bc816b04901a7442679382b0935 (patch)
tree783af85b75f9de3ab10902c5ba66cf5e22b2fe61 /src/gui/painting
parent9f5b02406f38fe02a27de7843b9f8a11232d2064 (diff)
parent9d174f13e48730ac06aa429e0f011a02b333025e (diff)
downloadQt-15b08dffc1354bc816b04901a7442679382b0935.zip
Qt-15b08dffc1354bc816b04901a7442679382b0935.tar.gz
Qt-15b08dffc1354bc816b04901a7442679382b0935.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-s60-public
Conflicts: configure mkspecs/common/symbian/symbian.conf mkspecs/features/symbian/application_icon.prf qmake/generators/makefile.cpp qmake/generators/symbian/initprojectdeploy_symbian.cpp qmake/generators/symbian/symmake.cpp tools/assistant/tools/assistant/assistant.pro
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/qbrush.cpp36
-rw-r--r--src/gui/painting/qdatabuffer_p.h7
-rw-r--r--src/gui/painting/qemulationpaintengine.cpp30
-rw-r--r--src/gui/painting/qpainterpath.cpp2
-rw-r--r--src/gui/painting/qwindowsurface_s60.cpp10
5 files changed, 66 insertions, 19 deletions
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 1a83b1d..a82d0f9 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -912,7 +912,7 @@ void QBrush::setTransform(const QTransform &matrix)
otherwise returns false.
Two brushes are different if they have different styles, colors or
- pixmaps.
+ transforms or different pixmaps or gradients depending on the style.
\sa operator==()
*/
@@ -924,7 +924,7 @@ void QBrush::setTransform(const QTransform &matrix)
otherwise returns false.
Two brushes are equal if they have equal styles, colors and
- pixmaps.
+ transforms and equal pixmaps or gradients depending on the style.
\sa operator!=()
*/
@@ -933,26 +933,26 @@ bool QBrush::operator==(const QBrush &b) const
{
if (b.d == d)
return true;
- if (b.d->style == d->style && b.d->color == d->color) {
- switch (d->style) {
- case Qt::TexturePattern: {
- QPixmap &us = (static_cast<QTexturedBrushData *>(d.data()))->pixmap();
- QPixmap &them = (static_cast<QTexturedBrushData *>(b.d.data()))->pixmap();
+ if (b.d->style != d->style || b.d->color != d->color || b.d->transform != d->transform)
+ return false;
+ switch (d->style) {
+ case Qt::TexturePattern:
+ {
+ const QPixmap &us = (static_cast<QTexturedBrushData *>(d.data()))->pixmap();
+ const QPixmap &them = (static_cast<QTexturedBrushData *>(b.d.data()))->pixmap();
return ((us.isNull() && them.isNull()) || us.cacheKey() == them.cacheKey());
}
- case Qt::LinearGradientPattern:
- case Qt::RadialGradientPattern:
- case Qt::ConicalGradientPattern:
- {
- QGradientBrushData *d1 = static_cast<QGradientBrushData *>(d.data());
- QGradientBrushData *d2 = static_cast<QGradientBrushData *>(b.d.data());
- return d1->gradient == d2->gradient;
- }
- default:
- return true;
+ case Qt::LinearGradientPattern:
+ case Qt::RadialGradientPattern:
+ case Qt::ConicalGradientPattern:
+ {
+ const QGradientBrushData *d1 = static_cast<QGradientBrushData *>(d.data());
+ const QGradientBrushData *d2 = static_cast<QGradientBrushData *>(b.d.data());
+ return d1->gradient == d2->gradient;
}
+ default:
+ return true;
}
- return false;
}
/*!
diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h
index a7834ea..bc5f1ef 100644
--- a/src/gui/painting/qdatabuffer_p.h
+++ b/src/gui/painting/qdatabuffer_p.h
@@ -81,7 +81,9 @@ public:
inline Type &at(int i) { Q_ASSERT(i >= 0 && i < siz); return buffer[i]; }
inline const Type &at(int i) const { Q_ASSERT(i >= 0 && i < siz); return buffer[i]; }
+ inline Type &last() { Q_ASSERT(!isEmpty()); return buffer[siz-1]; }
inline const Type &last() const { Q_ASSERT(!isEmpty()); return buffer[siz-1]; }
+ inline Type &first() { Q_ASSERT(!isEmpty()); return buffer[0]; }
inline const Type &first() const { Q_ASSERT(!isEmpty()); return buffer[0]; }
inline void add(const Type &t) {
@@ -90,6 +92,11 @@ public:
++siz;
}
+ inline void pop_back() {
+ Q_ASSERT(siz > 0);
+ --siz;
+ }
+
inline void resize(int size) {
reserve(size);
siz = size;
diff --git a/src/gui/painting/qemulationpaintengine.cpp b/src/gui/painting/qemulationpaintengine.cpp
index f2f0c73..fd42736 100644
--- a/src/gui/painting/qemulationpaintengine.cpp
+++ b/src/gui/painting/qemulationpaintengine.cpp
@@ -172,6 +172,36 @@ void QEmulationPaintEngine::drawTextItem(const QPointF &p, const QTextItem &text
QRectF rect(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).toReal());
fillBGRect(rect);
}
+
+ QPainterState *s = state();
+ Qt::BrushStyle style = qbrush_style(s->pen.brush());
+ if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern)
+ {
+ QPen savedPen = s->pen;
+ QGradient g = *s->pen.brush().gradient();
+
+ if (g.coordinateMode() > QGradient::LogicalMode) {
+ QTransform mat = s->pen.brush().transform();
+ if (g.coordinateMode() == QGradient::StretchToDeviceMode) {
+ mat.scale(real_engine->painter()->device()->width(), real_engine->painter()->device()->height());
+ } else if (g.coordinateMode() == QGradient::ObjectBoundingMode) {
+ const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
+ QRectF r(p.x(), p.y() - ti.ascent.toReal(), ti.width.toReal(), (ti.ascent + ti.descent + 1).toReal());
+ mat.translate(r.x(), r.y());
+ mat.scale(r.width(), r.height());
+ }
+ g.setCoordinateMode(QGradient::LogicalMode);
+ QBrush brush(g);
+ brush.setTransform(mat);
+ s->pen.setBrush(brush);
+ penChanged();
+ real_engine->drawTextItem(p, textItem);
+ s->pen = savedPen;
+ penChanged();
+ return;
+ }
+ }
+
real_engine->drawTextItem(p, textItem);
}
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index fba3595..f78de34 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -1257,6 +1257,8 @@ Qt::FillRule QPainterPath::fillRule() const
void QPainterPath::setFillRule(Qt::FillRule fillRule)
{
ensureData();
+ if (d_func()->fillRule == fillRule)
+ return;
detach();
d_func()->fillRule = fillRule;
diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp
index b01a515..949b338 100644
--- a/src/gui/painting/qwindowsurface_s60.cpp
+++ b/src/gui/painting/qwindowsurface_s60.cpp
@@ -149,11 +149,19 @@ void QS60WindowSurface::flush(QWidget *widget, const QRegion &region, const QPoi
Q_ASSERT(window);
QTLWExtra *topExtra = window->d_func()->maybeTopData();
Q_ASSERT(topExtra);
+ QRect qr = region.boundingRect();
if (!topExtra->inExpose) {
topExtra->inExpose = true; // Prevent DrawNow() from calling syncBackingStore() again
- TRect tr = qt_QRect2TRect(region.boundingRect());
+ TRect tr = qt_QRect2TRect(qr);
widget->winId()->DrawNow(tr);
topExtra->inExpose = false;
+ } else {
+ // This handles the case when syncBackingStore updates content outside of the
+ // original drawing rectangle. This might happen if there are pending update()
+ // events at the same time as we get a Draw() from Symbian.
+ QRect drawRect = qt_TRect2QRect(widget->winId()->DrawableWindow()->GetDrawRect());
+ if (!drawRect.contains(qr))
+ widget->winId()->DrawDeferred();
}
}