summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qstatictext_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Updated year in copyright headerKai Koehne2014-03-261-1/+1
| | | | | | | | | | | | | | | | | | find . -path '*/3rdparty/*' -prune -o -type f -print | xargs -L1 sed -i -E 's/Copyright(.*) 2013 Digia/Copyright\1 2014 Digia/g' Manually patched files: demos/spectrum/3rdparty/fftreal/fftreal_wrapper.h demos/spectrum/3rdparty/fftreal/fftreal_wrapper.cpp src/3rdparty/s60/eiksoftkeyimage.h tools/qdoc3/test/qt-project.qdocconf tests/auto/qsharedpointer/nontracked.h tests/auto/qsharedpointer/nontracked.cpp Change-Id: I3f9074923b4d6bd4666258ab04f01476cc6e901c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Sergio Ahumada <sahumada@blackberry.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-131-1/+1
| | | | | | Change-Id: I52bf8ef0447b701b4ebf7d7d240013a72adb9425 Reviewed-by: Akseli Salovaara <akseli.salovaara@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-291-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: I280c0a575987d1770e354b4948f1d4d767d711ea Reviewed-by: Simo Fält <simo.falt@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Update contact information in license headers.Sergio Ahumada2012-08-011-2/+2
| | | | | | | | | | | | | - Replace Nokia contact email address with Qt Project website. - Remove "All rights reserved" line from license headers. As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: Ie7ba62011752fcb149b99b26317c54f2a0cfa931 Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
* Update year in Nokia copyright messages.Jason McDonald2012-01-111-1/+1
| | | | | | | | | Simple search and replace. This commit doesn't touch 3rd-party files, nor translations (where the change is not so simple and will be handled in a separate commit). Change-Id: I4e48513b8078a44a8cd272326685b25338890148 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update licenseheader text in source files for qt4.8Jyri Tahtela2011-05-131-17/+17
| | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* Update copyright year to 2011.Jason McDonald2011-01-101-1/+1
| | | | Reviewed-by: Trust Me
* Fix possible crash in QStaticText and QDeclarativeTextLayoutEskil Abrahamsen Blomfeldt2010-10-291-9/+45
| | | | | | | | | | | | | The QStaticTextItem held an uncounted reference to QFontEngine. The pointer would dangle in some cases where there was no font object referencing the engine and the cache was cleaned out (e.g. when a new application font is added.) Properly count the reference, and also add reference counting to userData to make it harder to shoot yourself in the foot, since the QStaticTextItem class is now being used in different places, Task-number: QTBUG-14446 Reviewed-by: Martin Jones
* Add QTextOption API to QStaticTextEskil Abrahamsen Blomfeldt2010-06-141-1/+5
| | | | | | | | | | | To allow more control over the layout process for a QStaticText, introduce a QTextOption API. This will allow you to, e.g., set an alignment for the text layout. Patch also contains a couple of bug fixes to make right alignment work correctly when you set a text width on the QStaticText. Task-number: QTBUG-9031 Reviewed-by: Samuel
* Speed up QStaticText with affine transformation on GL2 engineEskil Abrahamsen Blomfeldt2010-06-011-3/+4
| | | | | | | | | | | | | | | | | | | | 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
* Optimize initialization of QStaticTextEskil Abrahamsen Blomfeldt2010-05-271-4/+15
| | | | | | | | | | Since QStaticText would be created once and used often, not much thought was put into optimizing its initialization. For simplicity, the code would do two drawText() passes. Since this was an unnecessary overhead, the extra pass has been removed and replaced by memmoves instead. Initialization is now twice as fast. Reviewed-by: Samuel
* Make QStaticText layout lazyEskil Abrahamsen Blomfeldt2010-03-291-0/+6
| | | | | | | | | | | | 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
* Change QStaticText::setMaximumSize() to setTextWidth()Eskil Abrahamsen Blomfeldt2010-03-291-4/+3
| | | | | | | | | | | | | | | | | | 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
* Fix fallback for QStaticText when it's unsupported in paint engineEskil Abrahamsen Blomfeldt2010-02-191-1/+1
| | | | | | | | 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
* Fix license headers.Jason McDonald2010-02-161-18/+18
| | | | Reviewed-by: Trust Me
* Compile fix for QStaticText - include declaration of QColorRhys Weatherley2010-02-151-0/+1
|
* Support Qt::AutoTest in QStaticText::setTextFormat()Eskil Abrahamsen Blomfeldt2010-02-151-3/+3
| | | | The bit field has to be unsigned to support values of 2 (and higher.)
* Separate out textFormat property from setText() function and removeEskil Abrahamsen Blomfeldt2010-02-151-1/+1
| | | | | | | | | 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.
* Add API for rich text and getting actual size of QStaticTextEskil Abrahamsen Blomfeldt2010-02-141-3/+7
| | | | | | 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.
* Make QStaticText public API againEskil Abrahamsen Blomfeldt2010-02-101-39/+71
| | | | | 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.
* Temporarily remove QPainter::drawStaticText() for Qt 4.6.x integrationEskil Abrahamsen Blomfeldt2010-02-051-1/+1
| | | | | | | | | | | 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
* Add private header warning to qstatictext_p.hEskil Abrahamsen Blomfeldt2010-02-011-0/+11
| | | | | Since QStaticText will be private API for Qt 4.6.x series, we need the regular warning in the header file.
* Make QStaticText private APIEskil Abrahamsen Blomfeldt2010-02-011-82/+40
| | | | | | | | 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.
* Improve performance of QStaticText on OpenGL by caching data on GPUEskil Abrahamsen Blomfeldt2010-01-291-15/+44
| | | | | | | | 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.
* Remove unused constructor in QStaticTextPrivateEskil Abrahamsen Blomfeldt2010-01-291-1/+0
| | | | The copy constructor for QStaticTextPrivate was never called.
* Add font object to QStaticTextEskil Abrahamsen Blomfeldt2010-01-201-1/+2
| | | | This will be needed by OpenVG paint engine, and is useful elsewhere.
* Update size commentEskil Abrahamsen Blomfeldt2010-01-151-1/+2
| | | | The pointers are included in the per item overhead.
* Update size comment in QStaticTextPrivateEskil Abrahamsen Blomfeldt2010-01-141-1/+1
| | | | | I've added a flag char, so the size of the static text is now one byte greater.
* Optimize drawStaticText() with rectangle destinationEskil Abrahamsen Blomfeldt2010-01-141-1/+2
| | | | | | | 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.
* Implement drawStaticTextItem() in OpenGL paint enginesEskil Abrahamsen Blomfeldt2010-01-141-2/+3
| | | | | | | | | | | | 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.
* Allow access to QStaticTextPrivate from autotestsEskil Abrahamsen Blomfeldt2010-01-141-4/+3
| | | | | Remove a private include which was unresolvable in autotests (because it indirectly included a 3rdparty header) and add Q_AUTOTEST_EXPORT.
* Support transformations in drawStaticText() and optimize for spaceEskil Abrahamsen Blomfeldt2010-01-141-11/+16
| | | | | | | | | | 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.
* Optimize QStaticText for spaceEskil Abrahamsen Blomfeldt2010-01-141-11/+27
| | | | | | | | | | | 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.
* Support maximumSize for the layout of the text in a QStaticTextEskil Abrahamsen Blomfeldt2010-01-141-3/+8
| | | | | | | 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.
* Speed optimization for QStaticTextEskil Abrahamsen Blomfeldt2010-01-141-1/+2
| | | | | | | 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().
* Optimize QStaticText for one line stringsEskil Abrahamsen Blomfeldt2010-01-141-2/+5
| | | | | | | 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.
* Add operators and implicit sharing to QStaticTextEskil Abrahamsen Blomfeldt2010-01-141-0/+2
| | | | | Adds copy constructor, operator==, operator= and operator!= to QStaticText. Implemented using an implicitly shared private object.
* Add lazy initialization to QStaticTextEskil Abrahamsen Blomfeldt2010-01-141-1/+1
| | | | | | 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.
* Fix formatting/clipping rectangle in QPainter::drawStaticText()Eskil Abrahamsen Blomfeldt2010-01-141-2/+57
| | | | | The rectangle should clip the text vertically and break lines horizontally, to mirror behavior of QPainter::drawText().
* Start support for formatting text within a bounding rectEskil Abrahamsen Blomfeldt2010-01-141-1/+1
| | | | | 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.
* Simplify QStaticTextEskil Abrahamsen Blomfeldt2010-01-141-2/+2
| | | | | Not much to gain by going directly to the QTextEngine, and the code is a lot simpler if we just use the QTextLayout instead.
* Introduce QStaticText APIEskil Abrahamsen Blomfeldt2010-01-141-0/+22
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.