| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This reverts 518c2a58ed6fdfd7449cb4476aa8ea0d32ad16e3 which caused a
regression.
When writing systems are mixed and an underline is set on the font,
QPainter will set a pen with the current color and a new width on
itself before drawing the decoration. This would cause the recorder
in QStaticText to mark the pen as dirty, saving the current pen
color in all subsequent text items. The effect was e.g. that in QML
the cached color would override the current one, making it impossible
to change the color on the text without forcing a relayout somehow.
The right fix is to only mark the pen as dirty when its color actually
changes.
Task-number: QTBUG-20159
Reviewed-by: Jiang Jiang
|
|
|
|
|
|
|
| |
Updated version of LGPL and FDL licenseheaders.
Apply release phase licenseheaders for all source files.
Reviewed-by: Trust Me
|
|
|
|
| |
Reviewed-by: Trust Me
|
|
|
|
|
|
|
|
|
| |
The assumption that the output glyph array and input glyph array is
of equal size is wrong when unprintable characters are used (and
discarded in getGlyphPositions())
Task-number: QTBUG-12614
Reviewed-by: Jiang Jiang
|
|
|
|
|
|
|
|
|
| |
The text option property of QStaticText was not copied in the copy
constructor, so when the text was detached, the property would be
reset to the default.
Task-number: QTBUG-13368
Reviewed-by: Gunnar
|
|
|
|
|
|
|
|
|
|
|
|
| |
The original code path of QStaticText does not include decoration
drawing, this patch generalized the drawTextItemDecoration()
function to draw decoration for drawText(), then use that to draw
decoration for QStaticText. A helper function called
drawDecorationForGlyphs() is made to allow easier extension for
direct glyphs drawing support.
Task-number: QTBUG-12121
Reviewed-by: Eskil
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Since the OpenGL2 paint engine supports transforming the prerendered
glyphs rather than rasterizing the glyphs with the transformation
applied, we don't need to recalculate the QStaticText layout whenever
the transformation changes. This means that we can do fast animated
transforms for QStaticText on this paint engine. A quick test yields
something like 100x speed-up on Windows. This also give visually
better results, as we previously would animate the hinting of the
glyphs, thus causing jittering.
The autotest has been updated to reflect the fact that drawText() and
drawStaticText() now go through identical paths on GL, also when
transforms are set on the painter. However, the scale was changed in
one test, because it was so great that drawText() would fall back to
paths. With QStaticText the idea is speed, so you'll get a poor, but
fast result instead, which is better than tricking people.
Reviewed-by: Samuel
|
|
|
|
|
|
|
|
|
|
| |
Avoid taking fast path in drawText() since this is optimized and does
not draw text completely accurate on a floating point font engine.
Rather we use the slightly slower but more accurate drawText() which
takes a rectangle so that the results are identical to the ones
produced by drawStaticText().
Reviewed-by: TrustMe
|
|
|
|
|
|
|
|
|
|
|
|
| |
To avoid the unnecessary overhead of doing the text layout every time
a part of the QStaticText object is changed, we mark it as invalid
instead and do the layout when we have to. This means an overhead on
the first paint event for most users. The overhead can be avoided by
using the QStaticText::prepare() function and will probably not be
noticable anyway, since it's a one-time thing.
Task-number: QTBUG-9030
Reviewed-by: Gunnar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
To avoid having to precalculate the height of the laid out text, we
now only supply a maximum text width to QStaticText. The only usage of
the maximum height would be to clip the results, and clipping should be
set separately from the QStaticText call, since this has no impact on
the layout of the glyphs. The tests have been updated to reflect the
change in logic.
We also need a consistent way of specifying the position of the text.
Before, the position meant "baseline position" for unbroken text and
"top left position" for text with a specified layout width. We want
to be consistent, and since baseline position makes no sense for
multiline text, we standardize on top left position.
Task-number: QTBUG-9029
Reviewed-by: Gunnar
|
|
|
|
|
|
|
|
|
|
| |
QStaticText needs to support changing the pen on the painter to support
rich text, but it should not override the pen unless it has been
explicitly set in the rich text. We do this by marking the pen as dirty
in updateState() when we record the text items.
Task-number: QTBUG-8908
Reviewed-by: Gunnar
|
|
|
|
|
|
|
|
|
|
|
| |
Drawing a string as plain text and rich text should have identical
results unless special formatting information is added in the html.
This means we should not have any implicit margin on the QTextDocument
used to paint the text, and we should make up for the fact that
the drawStaticText() call currently takes the position of the baseline
and QTextDocument::drawContents() takes the top-left corner.
Reviewed-by: Gunnar
|
|
|
|
| |
Reviewed-by: Eskil
|
|
|
|
|
|
|
|
|
|
| |
Windows has the only font engine which supports transforming the
glyphs in the glyph cache currently. All other engines fall back to
drawing paths instead when using the raster engine. We disable
the transformation tests for platforms which aren't either Windows
or running a native graphics system.
Reviewed-by: Olivier
|
|
|
|
|
|
|
| |
This test no longer uses QtOpenGL, therefore it doesn't need to try to
link with it.
Reviewed-by: Eskil
|
|
|
|
|
|
|
|
| |
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
|
|\ |
|
| |
| |
| |
| |
| |
| |
| | |
Make the API more general and more readable by using a PerformanceHint
enum instead of an on/off-trigger for the OpenGL-specific caching.
Reviewed-by: Samuel
|
|/
|
|
| |
Reviewed-by: Trust Me
|
|
|
|
|
|
|
| |
The QGLWidget tests would fail at random. The use case has been
confirmed to work through manual tests, but I haven't found any good
way to test them automatically. They have been removed until time
permits.
|
|
|
|
|
| |
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.
|
|
|
|
| |
Some tests with and without VBO caching.
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
The rotatedTranslatedScaled-test would transform the text out of the
destination rect, so we'd just confirm two blank images. Also added
input to the two basic tests for backend optimizations.
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
| |
Projected text always has to go via paths, so we use the fall back for
this.
|
|
|
|
|
|
|
| |
Using QImage would only let us test the raster engine. Substitute
QPixmap, so we can test different graphics systems. Also initialize the
memory in the pixmaps (this was missed because memory is initialized by
default in debug builds.)
|
|
|
|
|
| |
This is more suited to be a benchmark, as it doesn't cover the
functionality of the class.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
painter
1. The font property in QStaticText has been removed. Rather than set a
font on the text explicitly, it picks up the font from the painter. If
you change the font on the painter, the text layout will have to be
updated, like with a matrix.
2. The translation might not be the only transformation on the painter,
so rather than translate back to origo, we explicitly set dx and dy
on the transform to 0.0 for the duration of the function.
3. Update test to reflect changes
|
|
|
|
|
|
| |
Combining rotations and translations will cause minor differences
between drawText() and drawStaticText(). This is not what the function
is testing, so it has been massaged to pass.
|
|
|
|
| |
Don't save images by default.
|
|
|
|
|
|
|
|
| |
There are tiny rounding errors in the matrix rotations which cause tiny
differences in drawText() and drawStaticText(). I've chosen to ignore
these. Instead of having a threshold on the comparison between the two
images, I've chosen to take the easy way out and avoid the problem by
not passing in any position for the text.
|
|
|
|
|
| |
Most of these tests currently fail revealing som offset bugs in the
painting code.
|
|
Tests that QStaticText rendering is identical to the same operations
done with regular QPainter::drawText()
|