summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/declarative/QmlChanges.txt3
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp11
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable_p_p.h6
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp59
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem_p.h11
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview.cpp10
-rw-r--r--src/declarative/graphicsitems/qdeclarativepathview_p_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp2
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp6
-rw-r--r--src/gui/text/qstatictext.cpp163
-rw-r--r--src/gui/text/qstatictext_p.h19
-rw-r--r--src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp2
-rw-r--r--src/opengl/qpaintengine_opengl.cpp2
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp25
-rw-r--r--src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h2
16 files changed, 180 insertions, 146 deletions
diff --git a/src/declarative/QmlChanges.txt b/src/declarative/QmlChanges.txt
index 3eed8d6..142920c 100644
--- a/src/declarative/QmlChanges.txt
+++ b/src/declarative/QmlChanges.txt
@@ -1,6 +1,9 @@
=============================================================================
The changes below are pre Qt 4.7.0 RC
+TextInput and TextEdit:
+ - showInputPanelOnFocus property added
+ - openSoftwareInputPanel() and closeSoftwareInputPanel() functions added
Flickable:
- overShoot is replaced by boundsBehavior enumeration
- flickingHorizontally and flickingVertically properties added
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index 1dde510..10dc0f8 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -160,6 +160,7 @@ void QDeclarativeFlickablePrivate::init()
q->setFiltersChildEvents(true);
QDeclarativeItemPrivate *viewportPrivate = static_cast<QDeclarativeItemPrivate*>(QGraphicsItemPrivate::get(viewport));
viewportPrivate->addItemChangeListener(this, QDeclarativeItemPrivate::Geometry);
+ lastPosTime.invalidate();
}
/*
@@ -656,7 +657,7 @@ void QDeclarativeFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEven
void QDeclarativeFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
Q_Q(QDeclarativeFlickable);
- if (!interactive || lastPosTime.isNull())
+ if (!interactive || !lastPosTime.isValid())
return;
bool rejectY = false;
bool rejectX = false;
@@ -752,7 +753,7 @@ void QDeclarativeFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEv
stealMouse = false;
q->setKeepMouseGrab(false);
pressed = false;
- if (lastPosTime.isNull())
+ if (!lastPosTime.isValid())
return;
if (QDeclarativeItemPrivate::elapsed(lastPosTime) > 100) {
@@ -780,7 +781,7 @@ void QDeclarativeFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEv
fixupX();
}
- lastPosTime = QTime();
+ lastPosTime.invalidate();
if (!timeline.isActive())
q->movementEnding();
@@ -1218,8 +1219,8 @@ bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event)
}
return stealThisEvent || d->delayedPressEvent;
- } else if (!d->lastPosTime.isNull()) {
- d->lastPosTime = QTime();
+ } else if (d->lastPosTime.isValid()) {
+ d->lastPosTime.invalidate();
}
if (mouseEvent.type() == QEvent::GraphicsSceneMouseRelease) {
d->clearDelayedPress();
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
index b467ed2..66d2678 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeflickable_p_p.h
@@ -140,13 +140,13 @@ public:
bool stealMouse : 1;
bool pressed : 1;
bool interactive : 1;
- QTime lastPosTime;
+ QElapsedTimer lastPosTime;
QPointF lastPos;
QPointF pressPos;
- QTime pressTime;
+ QElapsedTimer pressTime;
qreal deceleration;
qreal maxVelocity;
- QTime velocityTime;
+ QElapsedTimer velocityTime;
QPointF lastFlickablePosition;
qreal reportedVelocitySmoothing;
QGraphicsSceneMouseEvent *delayedPressEvent;
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 2841ac3..7bd08ce 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -3145,41 +3145,56 @@ QDebug operator<<(QDebug debug, QDeclarativeItem *item)
return debug;
}
-int QDeclarativeItemPrivate::consistentTime = -1;
-void QDeclarativeItemPrivate::setConsistentTime(int t)
+qint64 QDeclarativeItemPrivate::consistentTime = -1;
+void QDeclarativeItemPrivate::setConsistentTime(qint64 t)
{
consistentTime = t;
}
-QTime QDeclarativeItemPrivate::currentTime()
+class QElapsedTimerConsistentTimeHack
{
- if (consistentTime == -1)
- return QTime::currentTime();
- else
- return QTime(0, 0).addMSecs(consistentTime);
-}
+public:
+ void start() {
+ t1 = QDeclarativeItemPrivate::consistentTime;
+ t2 = 0;
+ }
+ qint64 elapsed() {
+ return QDeclarativeItemPrivate::consistentTime - t1;
+ }
+ qint64 restart() {
+ qint64 val = QDeclarativeItemPrivate::consistentTime - t1;
+ t1 = QDeclarativeItemPrivate::consistentTime;
+ t2 = 0;
+ return val;
+ }
-void QDeclarativeItemPrivate::start(QTime &t)
+private:
+ qint64 t1;
+ qint64 t2;
+};
+
+void QDeclarativeItemPrivate::start(QElapsedTimer &t)
{
- t = currentTime();
+ if (QDeclarativeItemPrivate::consistentTime == -1)
+ t.start();
+ else
+ ((QElapsedTimerConsistentTimeHack*)&t)->start();
}
-int QDeclarativeItemPrivate::elapsed(QTime &t)
+qint64 QDeclarativeItemPrivate::elapsed(QElapsedTimer &t)
{
- int n = t.msecsTo(currentTime());
- if (n < 0) // passed midnight
- n += 86400 * 1000;
- return n;
+ if (QDeclarativeItemPrivate::consistentTime == -1)
+ return t.elapsed();
+ else
+ return ((QElapsedTimerConsistentTimeHack*)&t)->elapsed();
}
-int QDeclarativeItemPrivate::restart(QTime &t)
+qint64 QDeclarativeItemPrivate::restart(QElapsedTimer &t)
{
- QTime time = currentTime();
- int n = t.msecsTo(time);
- if (n < 0) // passed midnight
- n += 86400*1000;
- t = time;
- return n;
+ if (QDeclarativeItemPrivate::consistentTime == -1)
+ return t.restart();
+ else
+ return ((QElapsedTimerConsistentTimeHack*)&t)->restart();
}
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativeitem_p.h b/src/declarative/graphicsitems/qdeclarativeitem_p.h
index 15b34f0..184d6f1 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeitem_p.h
@@ -305,12 +305,11 @@ public:
virtual void focusChanged(bool);
- static int consistentTime;
- static QTime currentTime();
- static void setConsistentTime(int t);
- static void start(QTime &);
- static int elapsed(QTime &);
- static int restart(QTime &);
+ static qint64 consistentTime;
+ static void setConsistentTime(qint64 t);
+ static void start(QElapsedTimer &);
+ static qint64 elapsed(QElapsedTimer &);
+ static qint64 restart(QElapsedTimer &);
};
/*
diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp
index 3a69f44..448ec06 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp
@@ -948,7 +948,7 @@ void QDeclarativePathView::mousePressEvent(QGraphicsSceneMouseEvent *event)
void QDeclarativePathView::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
{
Q_D(QDeclarativePathView);
- if (!d->interactive || d->lastPosTime.isNull())
+ if (!d->interactive || !d->lastPosTime.isValid())
return;
if (!d->stealMouse) {
@@ -982,7 +982,7 @@ void QDeclarativePathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *)
Q_D(QDeclarativePathView);
d->stealMouse = false;
setKeepMouseGrab(false);
- if (!d->interactive || d->lastPosTime.isNull())
+ if (!d->interactive || !d->lastPosTime.isValid())
return;
qreal elapsed = qreal(d->lastElapsed + QDeclarativeItemPrivate::elapsed(d->lastPosTime)) / 1000.;
@@ -1017,7 +1017,7 @@ void QDeclarativePathView::mouseReleaseEvent(QGraphicsSceneMouseEvent *)
d->fixOffset();
}
- d->lastPosTime = QTime();
+ d->lastPosTime.invalidate();
ungrabMouse();
}
@@ -1059,8 +1059,8 @@ bool QDeclarativePathView::sendMouseEvent(QGraphicsSceneMouseEvent *event)
grabMouse();
return d->stealMouse;
- } else if (!d->lastPosTime.isNull()) {
- d->lastPosTime = QTime();
+ } else if (d->lastPosTime.isValid()) {
+ d->lastPosTime.invalidate();
}
return false;
}
diff --git a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
index 3abb2f4..a0d2610 100644
--- a/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepathview_p_p.h
@@ -97,6 +97,7 @@ public:
q->setFlag(QGraphicsItem::ItemIsFocusScope);
q->setFiltersChildEvents(true);
q->connect(&tl, SIGNAL(updated()), q, SLOT(ticked()));
+ lastPosTime.invalidate();
}
void itemGeometryChanged(QDeclarativeItem *item, const QRectF &newGeometry, const QRectF &oldGeometry) {
@@ -154,7 +155,7 @@ public:
bool autoHighlight : 1;
bool highlightUp : 1;
bool layoutScheduled : 1;
- QTime lastPosTime;
+ QElapsedTimer lastPosTime;
QPointF lastPos;
qreal dragMargin;
qreal deceleration;
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 167db77..9ccb8d2 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -1335,7 +1335,7 @@ void QDeclarativeTextEdit::setShowInputPanelOnFocus(bool showOnFocus)
void QDeclarativeTextEdit::focusInEvent(QFocusEvent *event)
{
Q_D(const QDeclarativeTextEdit);
- if (d->showInputPanelOnFocus && !isReadOnly()) {
+ if (d->showInputPanelOnFocus && !isReadOnly() && event->reason() != Qt::ActiveWindowFocusReason) {
openSoftwareInputPanel();
}
QDeclarativePaintedItem::focusInEvent(event);
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index 18e3595..9c70ea9 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -1282,7 +1282,7 @@ void QDeclarativeTextInput::setShowInputPanelOnFocus(bool showOnFocus)
void QDeclarativeTextInput::focusInEvent(QFocusEvent *event)
{
Q_D(const QDeclarativeTextInput);
- if (d->showInputPanelOnFocus && !isReadOnly()) {
+ if (d->showInputPanelOnFocus && !isReadOnly() && event->reason() != Qt::ActiveWindowFocusReason) {
openSoftwareInputPanel();
}
QDeclarativePaintedItem::focusInEvent(event);
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index db6c4c5..36d21a6 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -1275,14 +1275,14 @@ void QGraphicsItemPrivate::childrenBoundingRectHelper(QTransform *x, QRectF *rec
QTransform matrix = childd->transformToParent();
if (x)
matrix *= *x;
- *rect |= matrix.mapRect(child->boundingRect());
+ *rect |= matrix.mapRect(child->d_ptr->effectiveBoundingRect());
if (!childd->children.isEmpty())
childd->childrenBoundingRectHelper(&matrix, rect);
} else {
if (x)
- *rect |= x->mapRect(child->boundingRect());
+ *rect |= x->mapRect(child->d_ptr->effectiveBoundingRect());
else
- *rect |= child->boundingRect();
+ *rect |= child->d_ptr->effectiveBoundingRect();
if (!childd->children.isEmpty())
childd->childrenBoundingRectHelper(x, rect);
}
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index c7817c6..84c1d96 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -363,23 +363,24 @@ QSizeF QStaticText::size() const
}
QStaticTextPrivate::QStaticTextPrivate()
- : textWidth(-1.0), items(0), itemCount(0), glyphPool(0), positionPool(0),
+ : textWidth(-1.0), items(0), itemCount(0), glyphPool(0), positionPool(0), charPool(0),
needsRelayout(true), useBackendOptimizations(false), textFormat(Qt::AutoText)
{
}
QStaticTextPrivate::QStaticTextPrivate(const QStaticTextPrivate &other)
: text(other.text), font(other.font), textWidth(other.textWidth), matrix(other.matrix),
- items(0), itemCount(0), glyphPool(0), positionPool(0), needsRelayout(true),
+ items(0), itemCount(0), glyphPool(0), positionPool(0), charPool(0), needsRelayout(true),
useBackendOptimizations(other.useBackendOptimizations), textFormat(other.textFormat)
{
}
QStaticTextPrivate::~QStaticTextPrivate()
{
- delete[] items;
+ delete[] items;
delete[] glyphPool;
delete[] positionPool;
+ delete[] charPool;
}
QStaticTextPrivate *QStaticTextPrivate::get(const QStaticText *q)
@@ -395,15 +396,8 @@ namespace {
class DrawTextItemRecorder: public QPaintEngine
{
public:
- DrawTextItemRecorder(int expectedItemCount, QStaticTextItem *items,
- int expectedGlyphCount, QFixedPoint *positionPool, glyph_t *glyphPool)
- : m_items(items),
- m_itemCount(0), m_glyphCount(0),
- m_expectedItemCount(expectedItemCount),
- m_expectedGlyphCount(expectedGlyphCount),
- m_glyphPool(glyphPool),
- m_positionPool(positionPool),
- m_dirtyPen(false)
+ DrawTextItemRecorder(bool useBackendOptimizations, int numChars)
+ : m_dirtyPen(false), m_useBackendOptimizations(useBackendOptimizations)
{
}
@@ -415,26 +409,19 @@ namespace {
virtual void drawTextItem(const QPointF &position, const QTextItem &textItem)
{
- const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
-
- m_itemCount++;
- m_glyphCount += ti.glyphs.numGlyphs;
- if (m_items == 0)
- return;
-
- Q_ASSERT(m_itemCount <= m_expectedItemCount);
- Q_ASSERT(m_glyphCount <= m_expectedGlyphCount);
-
- QStaticTextItem *currentItem = (m_items + (m_itemCount - 1));
- currentItem->fontEngine = ti.fontEngine;
- currentItem->font = ti.font();
- currentItem->chars = ti.chars;
- currentItem->numChars = ti.num_chars;
- currentItem->numGlyphs = ti.glyphs.numGlyphs;
- currentItem->glyphs = m_glyphPool;
- currentItem->glyphPositions = m_positionPool;
+ const QTextItemInt &ti = static_cast<const QTextItemInt &>(textItem);
+
+ QStaticTextItem currentItem;
+ currentItem.fontEngine = ti.fontEngine;
+ currentItem.font = ti.font();
+ currentItem.charOffset = m_chars.size();
+ currentItem.numChars = ti.num_chars;
+ currentItem.numGlyphs = ti.glyphs.numGlyphs;
+ currentItem.glyphOffset = m_glyphs.size(); // Store offset into glyph pool
+ currentItem.positionOffset = m_glyphs.size(); // Offset into position pool
+ currentItem.useBackendOptimizations = m_useBackendOptimizations;
if (m_dirtyPen)
- currentItem->color = state->pen().color();
+ currentItem.color = state->pen().color();
QTransform matrix = state->transform();
matrix.translate(position.x(), position.y());
@@ -447,13 +434,21 @@ namespace {
Q_ASSERT(size == ti.glyphs.numGlyphs);
Q_ASSERT(size == positions.size());
- memmove(currentItem->glyphs, glyphs.constData(), sizeof(glyph_t) * size);
- memmove(currentItem->glyphPositions, positions.constData(), sizeof(QFixedPoint) * size);
+ m_glyphs.resize(m_glyphs.size() + size);
+ m_positions.resize(m_glyphs.size());
+ m_chars.resize(m_chars.size() + ti.num_chars);
- m_glyphPool += size;
- m_positionPool += size;
- }
+ glyph_t *glyphsDestination = m_glyphs.data() + currentItem.glyphOffset;
+ qMemCopy(glyphsDestination, glyphs.constData(), sizeof(glyph_t) * currentItem.numGlyphs);
+ QFixedPoint *positionsDestination = m_positions.data() + currentItem.positionOffset;
+ qMemCopy(positionsDestination, positions.constData(), sizeof(QFixedPoint) * currentItem.numGlyphs);
+
+ QChar *charsDestination = m_chars.data() + currentItem.charOffset;
+ qMemCopy(charsDestination, ti.chars, sizeof(QChar) * currentItem.numChars);
+
+ m_items.append(currentItem);
+ }
virtual bool begin(QPaintDevice *) { return true; }
virtual bool end() { return true; }
@@ -463,38 +458,42 @@ namespace {
return User;
}
- int itemCount() const
+ QVector<QStaticTextItem> items() const
{
- return m_itemCount;
+ return m_items;
}
- int glyphCount() const
+ QVector<QFixedPoint> positions() const
{
- return m_glyphCount;
+ return m_positions;
}
- private:
- QStaticTextItem *m_items;
- int m_itemCount;
- int m_glyphCount;
- int m_expectedItemCount;
- int m_expectedGlyphCount;
+ QVector<glyph_t> glyphs() const
+ {
+ return m_glyphs;
+ }
+
+ QVector<QChar> chars() const
+ {
+ return m_chars;
+ }
- glyph_t *m_glyphPool;
- QFixedPoint *m_positionPool;
+ private:
+ QVector<QStaticTextItem> m_items;
+ QVector<QFixedPoint> m_positions;
+ QVector<glyph_t> m_glyphs;
+ QVector<QChar> m_chars;
bool m_dirtyPen;
+ bool m_useBackendOptimizations;
};
class DrawTextItemDevice: public QPaintDevice
{
public:
- DrawTextItemDevice(int expectedItemCount = -1, QStaticTextItem *items = 0,
- int expectedGlyphCount = -1, QFixedPoint *positionPool = 0,
- glyph_t *glyphPool = 0)
+ DrawTextItemDevice(bool useBackendOptimizations, int numChars)
{
- m_paintEngine = new DrawTextItemRecorder(expectedItemCount, items,
- expectedGlyphCount, positionPool, glyphPool);
+ m_paintEngine = new DrawTextItemRecorder(useBackendOptimizations, numChars);
}
~DrawTextItemDevice()
@@ -538,14 +537,24 @@ namespace {
return m_paintEngine;
}
- int itemCount() const
+ QVector<glyph_t> glyphs() const
{
- return m_paintEngine->itemCount();
+ return m_paintEngine->glyphs();
}
- int glyphCount() const
+ QVector<QFixedPoint> positions() const
{
- return m_paintEngine->glyphCount();
+ return m_paintEngine->positions();
+ }
+
+ QVector<QStaticTextItem> items() const
+ {
+ return m_paintEngine->items();
+ }
+
+ QVector<QChar> chars() const
+ {
+ return m_paintEngine->chars();
}
private:
@@ -616,42 +625,42 @@ void QStaticTextPrivate::init()
delete[] items;
delete[] glyphPool;
delete[] positionPool;
+ delete[] charPool;
position = QPointF(0, 0);
- // Draw once to count number of items and glyphs, so that we can use as little memory
- // as possible to store the data
- DrawTextItemDevice counterDevice;
+ DrawTextItemDevice device(useBackendOptimizations, text.size());
{
- QPainter painter(&counterDevice);
+ QPainter painter(&device);
painter.setFont(font);
painter.setTransform(matrix);
paintText(QPointF(0, 0), &painter);
-
}
- itemCount = counterDevice.itemCount();
+ QVector<QStaticTextItem> deviceItems = device.items();
+ QVector<QFixedPoint> positions = device.positions();
+ QVector<glyph_t> glyphs = device.glyphs();
+ QVector<QChar> chars = device.chars();
+
+ itemCount = deviceItems.size();
items = new QStaticTextItem[itemCount];
- if (useBackendOptimizations) {
- for (int i=0; i<itemCount; ++i)
- items[i].useBackendOptimizations = true;
- }
+ glyphPool = new glyph_t[glyphs.size()];
+ qMemCopy(glyphPool, glyphs.constData(), glyphs.size() * sizeof(glyph_t));
+ positionPool = new QFixedPoint[positions.size()];
+ qMemCopy(positionPool, positions.constData(), positions.size() * sizeof(QFixedPoint));
- int glyphCount = counterDevice.glyphCount();
- glyphPool = new glyph_t[glyphCount];
- positionPool = new QFixedPoint[glyphCount];
+ charPool = new QChar[chars.size()];
+ qMemCopy(charPool, chars.constData(), chars.size() * sizeof(QChar));
- // Draw again to actually record the items and glyphs
- DrawTextItemDevice recorderDevice(itemCount, items, glyphCount, positionPool, glyphPool);
- {
- QPainter painter(&recorderDevice);
- painter.setFont(font);
- painter.setTransform(matrix);
+ for (int i=0; i<itemCount; ++i) {
+ items[i] = deviceItems.at(i);
- paintText(QPointF(0, 0), &painter);
+ items[i].glyphs = glyphPool + items[i].glyphOffset;
+ items[i].glyphPositions = positionPool + items[i].positionOffset;
+ items[i].chars = charPool + items[i].charOffset;
}
needsRelayout = false;
diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h
index f017ed1..2ab5579 100644
--- a/src/gui/text/qstatictext_p.h
+++ b/src/gui/text/qstatictext_p.h
@@ -88,9 +88,18 @@ public:
userData = newUserData;
}
- QFixedPoint *glyphPositions; // 8 bytes per glyph
- glyph_t *glyphs; // 4 bytes per glyph
- const QChar *chars; // 2 bytes per glyph
+ union {
+ QFixedPoint *glyphPositions; // 8 bytes per glyph
+ int positionOffset;
+ };
+ union {
+ glyph_t *glyphs; // 4 bytes per glyph
+ int glyphOffset;
+ };
+ union {
+ QChar *chars; // 2 bytes per glyph
+ int charOffset;
+ };
// =================
// 14 bytes per glyph
@@ -134,14 +143,16 @@ public:
QTransform matrix; // 80 bytes per text
QStaticTextItem *items; // 4 bytes per text
int itemCount; // 4 bytes per text
+
glyph_t *glyphPool; // 4 bytes per text
QFixedPoint *positionPool; // 4 bytes per text
+ QChar *charPool; // 4 bytes per text
unsigned char needsRelayout : 1;
unsigned char useBackendOptimizations : 1; // 1 byte per text
unsigned char textFormat : 2;
// ================
- // 163 bytes per text
+ // 167 bytes per text
static QStaticTextPrivate *get(const QStaticText *q);
};
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 4461358..5758b25 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1401,7 +1401,7 @@ void QGL2PaintEngineEx::drawTextItem(const QPointF &p, const QTextItem &textItem
{
QStaticTextItem staticTextItem;
- staticTextItem.chars = ti.chars;
+ staticTextItem.chars = const_cast<QChar *>(ti.chars);
staticTextItem.fontEngine = ti.fontEngine;
staticTextItem.glyphs = glyphs.data();
staticTextItem.numChars = ti.num_chars;
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 28d37bc..12c487d 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -4999,7 +4999,7 @@ void QOpenGLPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte
{
QStaticTextItem staticTextItem;
- staticTextItem.chars = ti.chars;
+ staticTextItem.chars = const_cast<QChar *>(ti.chars);
staticTextItem.fontEngine = ti.fontEngine;
staticTextItem.glyphs = glyphs.data();
staticTextItem.numChars = ti.num_chars;
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
index 80366d1..f704432 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp
@@ -91,6 +91,7 @@ void QDirectFBPixmapData::resize(int width, int height)
setSerialNumber(++global_ser_no);
}
+#ifdef QT_DIRECTFB_OPAQUE_DETECTION
// mostly duplicated from qimage.cpp (QImageData::checkForAlphaPixels)
static bool checkForAlphaPixels(const QImage &img)
{
@@ -160,12 +161,16 @@ static bool checkForAlphaPixels(const QImage &img)
return false;
}
+#endif // QT_DIRECTFB_OPAQUE_DETECTION
-bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img)
+bool QDirectFBPixmapData::hasAlphaChannel(const QImage &img, Qt::ImageConversionFlags flags)
{
-#ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION
- return checkForAlphaPixels(img);
+ if (img.depth() == 1)
+ return true;
+#ifdef QT_DIRECTFB_OPAQUE_DETECTION
+ return ((flags & Qt::NoOpaqueDetection) ? img.hasAlphaChannel() : checkForAlphaPixels(img));
#else
+ Q_UNUSED(flags);
return img.hasAlphaChannel();
#endif
}
@@ -287,19 +292,9 @@ bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescripti
#endif
-void QDirectFBPixmapData::fromImage(const QImage &img,
- Qt::ImageConversionFlags flags)
+void QDirectFBPixmapData::fromImage(const QImage &img, Qt::ImageConversionFlags flags)
{
- if (img.depth() == 1) {
- alpha = true;
-#ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION
- } else if (flags & Qt::NoOpaqueDetection || QDirectFBPixmapData::hasAlphaChannel(img)) {
- alpha = true;
-#else
- } else if (img.hasAlphaChannel()) {
- alpha = true;
-#endif
- }
+ alpha = QDirectFBPixmapData::hasAlphaChannel(img, flags);
imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat();
QImage image;
if ((flags & ~Qt::NoOpaqueDetection) != Qt::AutoColor) {
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
index da6edc6..343b26e 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.h
@@ -86,8 +86,8 @@ public:
virtual int metric(QPaintDevice::PaintDeviceMetric m) const { return QDirectFBPaintDevice::metric(m); }
inline QImage::Format pixelFormat() const { return imageFormat; }
- static bool hasAlphaChannel(const QImage &img);
inline bool hasAlphaChannel() const { return alpha; }
+ static bool hasAlphaChannel(const QImage &img, Qt::ImageConversionFlags flags = Qt::AutoColor);
private:
#ifdef QT_DIRECTFB_IMAGEPROVIDER
bool fromDataBufferDescription(const DFBDataBufferDescription &dataBuffer);