| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
When the paint engine does not support QStaticText, we fall back to
regular drawText() calls. This fallback would previously paint all
text to (0, 0). This fixes the qstatictext autotest on Linux.
Reviewed-by: Olivier
|
|
|
|
| |
Reviewed-by: Trust Me
|
| |
|
|
|
|
| |
The bit field has to be unsigned to support values of 2 (and higher.)
|
|
|
|
|
|
|
|
|
| |
isEmpty() function in QStaticText
To make the return value of text() more intuitively clearer, and to make
the API more readable, I've separated out the text format into a
separate property. The isEmpty() function seemed out-of-place in the
API, as suggested by reviews, so it has been removed.
|
|
|
|
|
|
| |
Required for several use cases, support for some html tags to change
font, color and do advanced text layouts, as well as getting the
bounds of the text when drawn.
|
|
|
|
|
| |
QStaticText was previously made private API to support inclusion in
Qt 4.6.x. This change turns it back into public API for Qt 4.7.0.
|
|
|
|
|
|
|
|
|
|
|
| |
We can't add new symbols to QPainter for Qt 4.6.x, as we would not be
able to remove them again if we regretted the API. Hence, I've made
removable symbols instead, a private global function and a
drawStaticText() in QPainterPrivate. In order to tie things together,
I needed a static private-getter in QPainterPrivate, and hence it
had to be a friend of QPainter.
Reviewed-by: Trond
|
|
|
|
|
| |
Since QStaticText will be private API for Qt 4.6.x series, we need the
regular warning in the header file.
|
|
|
|
|
|
|
|
| |
Turns QStaticText into private API in preparation for Qt 4.6.x. The
related functions in QPainter are marked as internal in the docs. There
are already internal functions in QPainter, so this seemed like a
reasonable solution. Since the functions require QStaticText they will
not be accessible to anyone who does not include private API.
|
|
|
|
|
|
|
|
| |
There's a big improvement to be seen in the OpenGL engine by caching
the vertex data for the QStaticText in VBOs. In order to have the
buffers properly disposed, I've implemented a userdata concept for
QStaticTextItem. By default, the optimizations will be turned off, and
can be turned on by using the useBackendOptimizations flag.
|
|
|
|
| |
The copy constructor for QStaticTextPrivate was never called.
|
|
|
|
| |
This will be needed by OpenVG paint engine, and is useful elsewhere.
|
|
|
|
| |
The pointers are included in the per item overhead.
|
|
|
|
|
| |
I've added a flag char, so the size of the static text is now one byte
greater.
|
|
|
|
|
|
|
| |
In order to be feature consistent with drawText(), we have to clip the
text whenever the text expands beyond its borders. This is a
performance hit, but luckily we can detect the cases where it's
necessary before-hand.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The OpenGL and OpenGL2 engines now have support for static text, as
well as the QEmulationPaintEngine.
Also contains an optimization: Instead of passing both the position and
glyph positions to drawStaticTextItem() we add the position into the
glyph position and update it only when it changes. Otherwise we would
have to do this work in all engines for every call. This means we have
to cache the position in QStaticTextPrivate as well, but it seems like
a small price to pay, since it's a per-text overhead and only 16 bytes.
|
|
|
|
|
| |
Remove a private include which was unresolvable in autotests (because
it indirectly included a 3rdparty header) and add Q_AUTOTEST_EXPORT.
|
|
|
|
|
|
|
|
|
|
| |
1. Support transformations on the painter in drawStaticText().
Transforming the painter will cause the text layout to be recalculated,
except for translations, which are handled by shifting the position of
the text items.
2. Make const length arrays of the internal data in QStaticTextItem in
order to minimize the memory consumption.
|
|
|
|
|
|
|
|
|
|
|
| |
By caching the results of getGlyphPositions() we can make a code path
in the critical paint engines which is optimal both in space and speed.
The engines where speed is of less importance (pdf engine etc.) which
may need more information, we choose the slower code path of drawText()
which lays out the text again. We should have optimal paths in raster,
vg and GL2 paint engines. The others are less important. Memory
consumption of static text is now 14 bytes per glyph, 8 bytes per item
and a static overhead of 40 bytes per QStaticText object.
|
|
|
|
|
|
|
| |
Put back maximumSize property in QStaticText to allow matching calls
to drawText with a target rectangle. Implementation is done by
having a dummy paint engine which records the calls to drawTextItem()
and storing these, then replaying them later.
|
|
|
|
|
|
|
| |
Don't use QVector to store the text items, but put them in a regular
array for quick access.
drawStaticText() is now about 2.7 times the speed of drawText().
|
|
|
|
|
|
|
| |
QTextLayout takes a lot of memory. We can get a bigger speed-up and
a more reasonable memory consumption by only supporting the single
line static texts and caching the text items. We need to copy some
structs from the text engine, since this is on the stack.
|
|
|
|
|
| |
Adds copy constructor, operator==, operator= and operator!= to
QStaticText. Implemented using an implicitly shared private object.
|
|
|
|
|
|
| |
People should be able to initialize the QStaticText lazily, or change
its data after instantiation. Each of the setters will recalculate the
layout to make sure it's always in sync.
|
|
|
|
|
| |
The rectangle should clip the text vertically and break lines
horizontally, to mirror behavior of QPainter::drawText().
|
|
|
|
|
| |
Support to mirror drawText(QRectF, QString). Instead of a rect you give
the text a static size and then paint it to an arbitrary point later on.
|
|
|
|
|
| |
Not much to gain by going directly to the QTextEngine, and the code
is a lot simpler if we just use the QTextLayout instead.
|
|
Much of the time in drawText() is used on text layouting, which is
wasted time when the text is not updated every frame. QStaticText is
meant to cache the relevant parts of this work. It currently uses
a copy-paste of the layout code in QPainter::drawText() and 99% of the
time in QPainter::drawStaticText() is spent in drawTextItem(). We can
use QTextLayout here instead without losing much.
|