summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Compile on WindowsEskil Abrahamsen Blomfeldt2010-02-011-0/+8
| | | | | | The default GL header on Windows is GL 1.1, so the 1.5 extensions are not defined. To work around this, we define the macros when needed. The macros are required for QStaticText's OpenGL backend.
* Remove reference to _ARB macrosEskil Abrahamsen Blomfeldt2010-02-011-9/+9
| | | | These belong to an OpenGL extension which is not in use.
* Improve performance of QStaticText on OpenGL by caching data on GPUEskil Abrahamsen Blomfeldt2010-01-295-25/+173
| | | | | | | | 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-292-11/+0
| | | | The copy constructor for QStaticTextPrivate was never called.
* Initialize member variables in QStaticTextPrivate constructorEskil Abrahamsen Blomfeldt2010-01-291-0/+1
| | | | Avoid crash when copying a QStaticTextPrivate object
* Compile for SymbianEskil Abrahamsen Blomfeldt2010-01-261-0/+1
| | | | Missing include
* Compile for S60Eskil Abrahamsen Blomfeldt2010-01-262-14/+19
| | | | Make the OpenVG code for QStaticText compile.
* Attempt at making OpenVG work with QStaticTextEskil Abrahamsen Blomfeldt2010-01-262-25/+37
| | | | | Done in the blind, so I don't expect this to compile, but it's to make it easier to get it over into a Symbian-ready repository.
* CompileEskil Abrahamsen Blomfeldt2010-01-202-6/+3
| | | | | Compile QStaticText and also use font object in QPaintBuffer since it's now available
* Add font object to QStaticTextEskil Abrahamsen Blomfeldt2010-01-202-1/+3
| | | | This will be needed by OpenVG paint engine, and is useful elsewhere.
* Inline QGL2PEXVertexArray::addRect()Eskil Abrahamsen Blomfeldt2010-01-192-16/+15
| | | | Optimization for drawStaticText()
* Optimize speed of QGL2PEXVertexArrayEskil Abrahamsen Blomfeldt2010-01-191-2/+11
| | | | | | | This function is the main performance hog when using QStaticText with the OpenGL engine, so I've improved on it a little by removing the conversion from (qreal,qreal) -> QPointF -> QGLPoint. Since the function is called so often, it has an impact on drawStaticText().
* Implement QPaintBufferEngine::drawStaticTextItem()Eskil Abrahamsen Blomfeldt2010-01-184-1/+42
| | | | | | Make QPaintEngineEx::drawStaticTextItem() pure virtual to make sure it's implemented in all engines, and implement the paint buffer version to make gui compile.
* doc: Add some performance hints to the documentationEskil Abrahamsen Blomfeldt2010-01-151-4/+11
|
* Use fallback when drawing projected textEskil Abrahamsen Blomfeldt2010-01-152-1/+30
| | | | | Projected text always has to go via paths, so we use the fall back for this.
* Test current graphics system + initialize memoryEskil Abrahamsen Blomfeldt2010-01-151-23/+44
| | | | | | | 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.)
* Remove translationDoesNotCauseRelayout testEskil Abrahamsen Blomfeldt2010-01-151-45/+0
| | | | | This is more suited to be a benchmark, as it doesn't cover the functionality of the class.
* Add tests for QStaticText::prepare()Eskil Abrahamsen Blomfeldt2010-01-151-0/+51
|
* Fix crash when wrapping textEskil Abrahamsen Blomfeldt2010-01-151-1/+1
| | | | | | | | The two runs (counting the number of items and then storing the information) needs to be identical, so they need to have the same text flags set. Otherwise we would count more items than we actually generated and crash later when we tried to access an uninitialized item.
* Update size commentEskil Abrahamsen Blomfeldt2010-01-151-1/+2
| | | | The pointers are included in the per item overhead.
* CompileEskil Abrahamsen Blomfeldt2010-01-153-20/+5
| | | | Some errors introduced by merges.
* 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-143-6/+14
| | | | | | | 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.
* Add prepare() function to QStaticTextEskil Abrahamsen Blomfeldt2010-01-142-1/+29
| | | | | | Allow the QStaticText layout to be completely defined prior to painting by introducing a function for setting the font and transform on the object ahead of using it with a QPainter.
* CompileEskil Abrahamsen Blomfeldt2010-01-143-3/+18
| | | | Update the code to compile with merged changes.
* Implement drawStaticTextItem() in OpenGL paint enginesEskil Abrahamsen Blomfeldt2010-01-1413-69/+135
| | | | | | | | | | | | 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 font property in QStaticText and fix handling translation onEskil Abrahamsen Blomfeldt2010-01-144-50/+44
| | | | | | | | | | | | | 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
* Ignore rounding errors in QStaticText testEskil Abrahamsen Blomfeldt2010-01-141-11/+4
| | | | | | 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.
* Remove debug outputEskil Abrahamsen Blomfeldt2010-01-141-1/+1
| | | | Don't save images by default.
* Ignore rounding error when painting to rotated painterEskil Abrahamsen Blomfeldt2010-01-141-15/+17
| | | | | | | | 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.
* Speed up QStaticText initializationEskil Abrahamsen Blomfeldt2010-01-141-10/+5
| | | | | | Instead of translating each position manually afterwards, just have the matrix do it when calculating the positions inside getGlyphPositions().
* Apply painter matrix to position in QPainter::drawStaticText()Eskil Abrahamsen Blomfeldt2010-01-141-10/+9
| | | | | | We need to transform the position of the text in accordance with the painter's matrix. Also, use state->matrix directly instead of calling a function to get it.
* Add autotests for transformed static textEskil Abrahamsen Blomfeldt2010-01-141-0/+184
| | | | | Most of these tests currently fail revealing som offset bugs in the painting code.
* 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.
* Some documentation fixesEskil Abrahamsen Blomfeldt2010-01-141-4/+7
| | | | Clarify the use of transformations combined with static texts.
* Support transformations in drawStaticText() and optimize for spaceEskil Abrahamsen Blomfeldt2010-01-149-61/+130
| | | | | | | | | | 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-1410-110/+137
| | | | | | | | | | | 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.
* Remove const-specifier to make QTextItemInt::operator=() more beautifulEskil Abrahamsen Blomfeldt2010-01-142-2/+2
| | | | | | | The const-specifier on the char format was unecessary, and made the operator= implementation ugly, so it has been removed. Reviewed-by: Simon Hausmann
* Respect font settings of QStaticText and clip to maximum sizeEskil Abrahamsen Blomfeldt2010-01-142-1/+22
| | | | | | | drawText() that renders into a QRect will clip the text (unless otherwise set by the text flags passed to the function.) In drawStaticText() we should do the same for identical behavior. We also need to respect the font set on the QStaticText object.
* Add test for QStaticTextEskil Abrahamsen Blomfeldt2010-01-142-0/+162
| | | | | Tests that QStaticText rendering is identical to the same operations done with regular QPainter::drawText()
* Support maximumSize for the layout of the text in a QStaticTextEskil Abrahamsen Blomfeldt2010-01-146-59/+279
| | | | | | | 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-146-23/+40
| | | | | | | 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().
* Fix drawing in QStaticTextEskil Abrahamsen Blomfeldt2010-01-141-0/+1
| | | | Also clone the offsets structure into the new QGlyphLayout.
* Space optimization in QStaticTextEskil Abrahamsen Blomfeldt2010-01-142-14/+9
| | | | | | | The engine.layoutData's glyph count is the number allocated, which may be larger than the actual number of glyphs. To minimize the space needed we base allocation on "used" which contains the number of glyphs actually used to represent the text.
* Optimize QStaticText for one line stringsEskil Abrahamsen Blomfeldt2010-01-146-85/+98
| | | | | | | 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.
* Fix memory leakEskil Abrahamsen Blomfeldt2010-01-141-1/+3
|
* Compile on S60Eskil Abrahamsen Blomfeldt2010-01-141-0/+1
|
* CompileEskil Abrahamsen Blomfeldt2010-01-141-2/+2
| | | | Q_DECLARE_PRIVATE requires d_ptr to be a QFooPointer<>-object.
* Add operators and implicit sharing to QStaticTextEskil Abrahamsen Blomfeldt2010-01-143-26/+91
| | | | | Adds copy constructor, operator==, operator= and operator!= to QStaticText. Implemented using an implicitly shared private object.
* Remove ambiguous overload for QStaticText() constructorEskil Abrahamsen Blomfeldt2010-01-141-1/+0
| | | | | The QStaticText(QString) constructor has been replaced by a constructor with defaults for the additional arguments