summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpainter.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix possible crash in QStaticText and QDeclarativeTextLayoutEskil Abrahamsen Blomfeldt2010-10-291-2/+2
| | | | | | | | | | | | | 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
* Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into ↵Qt Continuous Integration System2010-09-301-1/+1
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.7-integration * '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-2: (24 commits) Stabilize tst_QGraphicsWidget::QT_BUG_13865_doublePaintWhenAddingASubItem Fixed accessing freed memory in raster engine. Build fix for -qtnamespace. Fixed parsing of SVGs with absolute font sizes. Moving QPdf::stripSpecialCharacter to fontengine Revert "Fix (implement!) hfw/wfh in QGridLayoutEngine" Fixed a layout issue where you could get NaN as dimensions QTextCodec: Fix valgrind warning when using QTextCodec in destructions functions Fix double painting when adding an item into a linear layout Fixed antialiased rasterization bug in raster engine. Fixed potential crash when loading corrupt GIFs. Work around an ATI driver problem with mutli-sampled pbuffers. tst_qstatemachine.cpp: fix compilation with Sun Studio Fixed regression in clipping.qps autotest on 64-bit. Fixed crash when using Qt::WA_DeleteOnClose on a QPrintDialog on Mac. Fixed performance regression in curve stroking. Don't disable texture_from_pixmap on GLX/X11 by default. Avoid creating copy of an image in memory when storing as png Doc update for the support of MSVC 2010 64-bit fix documentation of drawText(int, int, int, int, ... ...
| * fix documentation of drawText(int, int, int, int, ...Gunnar Sletta2010-09-271-1/+1
| |
* | Fixed performance issue in QML clipping with OpenGL 2.0 paint engine.Samuel Rødal2010-09-281-4/+4
|/ | | | | | | | | | | | | | | | Change 4c515ceb fixed Intersect and Unite-clipping after doing setClipping(false), but also introduced a performance problem. If there was no pre-existing clip we'd convert IntersectClips to ReplaceClips, which is unnecessary since the paint engines already handle this correctly. IntersectClips can be handled much more efficiently in the OpenGL 2 paint engine for example. We only need to convert to ReplaceClip when someone has used setClipEnabled(false) which is anyways expensive and not recommended. Reviewed-by: Trond
* Merge commit 'staging-1/4.7' into doc-4.7Morten Engvoldsen2010-09-031-2/+3
|\
| * Fix a crash when passing a null pixmap to QPainter::drawPixmapFragments().Trond Kjernåsen2010-09-011-1/+1
| | | | | | | | | | Task-number: QTBUG-13331 Reviewed-by: Samuel
| * Fix QStaticText with OpenGL1 engineEskil Abrahamsen Blomfeldt2010-08-301-1/+2
| | | | | | | | | | | | | | | | | | Like OpenGL2 and OpenVG, the OpenGL1 paint engine also transforms text coordinates itself and does not require QStaticText to use device coordinates. Task-number: QTBUG-13228 Reviewed-by: Samuel
* | Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/qt-doc-team into doc-4.7Morten Engvoldsen2010-09-021-1/+1
|\ \ | |/ |/|
| * Fixed spelling, broken links, and missing default values.Jerome Pasion2010-08-301-1/+1
| | | | | | | | | | Tasks: QTBUG-13271, QTBUG-13212, QTBUG-12321 Reviewer: David Boddie
* | Apparently QPen::brush() can't return a NoBrush for a NoPen.Trond Kjernåsen2010-08-271-4/+4
|/ | | | | | | | There are explicit tests in qdatastream for this. IMO it's wrong, wrong, wrong, but it's currently abused in the SVG module so we can't change it. Reviewed-by: Gunnar
* Fix mispositioned text with QStaticText and OpenVG graphics systemEskil Abrahamsen Blomfeldt2010-08-241-2/+5
| | | | | | | | | | | The OpenVG paint engine, like the OpenGL2 paint engine, supports caching the untransformed glyphs and transforming them as they are drawn. Since we would pretransform the positions of the glyphs, the transformation would be applied twice, thus making the glyphs appear in the wrong location when the painter had a transform set. Task-number: QTBUG-13049 Reviewed-by: Gunnar
* Add text decoration support to QStaticTextJiang Jiang2010-08-101-13/+71
| | | | | | | | | | | | 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
* Warn when drawPixmapFragments is called with an invalid source rectAndy Shaw2010-07-051-0/+9
| | | | | | | | | | When drawPixmapFragments() is called with fragments that has invalid source rects in it, then usually it causes the pixmap drawn on screen to appear corrupted. However it has been reported that a crash can occur (not reproducable locally) so by adding a warning in debug mode only means that this can hopefully be caught at development time. Reviewed-by: Trond
* Made -graphicssystem trace work with Qt::TextBypassShaping flag.Samuel Rødal2010-06-291-1/+1
| | | | | | The QPaintBuffer gets the text from the text item in order to stream it. Reviewed-by: Jocelyn Turcotte
* Speed up calls to QPainter::setCompositionMode when the mode is unchangedSimon Hausmann2010-06-171-0/+2
| | | | | | | | Avoid marking the composition mode as dirty and calling into the extended engine if the composition mode that the application wants to set is the same that's currently used. Reviewed-by: Gunnar
* Fixed missing stroke for flat ellipses.Samuel Rødal2010-06-151-4/+0
| | | | | | | The behavior should be the same as for arcs and rects. Task-number: QTBUG-2743 Reviewed-by: Eskil
* LayoutDirectionAuto is the default layout direction for QPainterLars Knoll2010-06-091-5/+7
| | | | | | | | | Don't retrieve the layout direction from QWidget or QApplication anymore. Respect if somebody explicitly sets the direction with setLayoutDirection(). Task-number: Part of QT-3292 Reviewed-by: Simon Hausmann
* More Pixmap cache key optimizationsJens Bache-Wiig2010-06-021-4/+4
| | | | Reviewed-by: ogoffart
* Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into ↵Qt Continuous Integration System2010-06-021-0/+17
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.7-integration * '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: Some optimizations for QImage::load() fix setRawData() Fix QML crashes on the N900 doc: Added DITA XML generator Fix build failure on Symbian 3.1. Add the Qt::TextBypassShaping flag. QTextEngine: skip an unnecessary call to GetDeviceCaps on Windows. Add my 4.7.0 changes qdoc: Added DITA XML generator doc: Fixed confusing ownership issue. update Russian translations for Qt tools update Russian translation for Qt libraries QXmlSchema documentation correction doc: Changed last breadcrumb to not be a link. doc: Fixed reference to setSize(), which is in QRectF. QNetworkCookie: do not accept cookies with non-alNum domain QtDeclarative: Remove trailing commas in enums Doc: MonotonicClock is obviously monotonic
| * Add the Qt::TextBypassShaping flag.Jocelyn Turcotte2010-05-311-0/+17
| | | | | | | | | | | | | | | | | | | | This allows quick layouting especially with Windows fonts which contain heavy OpenType logic. On regular latin text the visual compromize is the loss of kerning, justification, capitalization, word spacing and letter spacing support. Reviewed-by: Simon Hausmann Reviewed-by: Eskil
* | Speed up QStaticText with affine transformation on GL2 engineEskil Abrahamsen Blomfeldt2010-06-011-6/+17
|/ | | | | | | | | | | | | | | | | | | | 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
* Merge remote branch 'origin/4.7' into HEADOlivier Goffart2010-05-191-2/+7
|\ | | | | | | | | Conflicts: src/corelib/tools/qlocale_symbian.cpp
| * Merge remote branch 'origin/4.6' into qt-4.7-from-4.6Olivier Goffart2010-05-171-2/+7
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: demos/demos.pro mkspecs/features/resources.prf mkspecs/features/uic.prf src/corelib/io/qurl.cpp src/corelib/tools/qlocale_symbian.cpp src/gui/graphicsview/qgraphicsscene.cpp src/gui/graphicsview/qgraphicswidget_p.cpp src/gui/graphicsview/qgraphicswidget_p.h src/gui/util/qsystemtrayicon_win.cpp src/multimedia/audio/qaudioinput.cpp tests/auto/qhostinfo/qhostinfo.pro
| | * Recalculate script item widths when forcing justificationEskil Abrahamsen Blomfeldt2010-05-061-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When going through the special WebKit code path for text drawing and forcing justification for text, we would set the justification in the text engine, but never actually update the widths of the script items. Since the width of the script item is used to position the text, the text would be drawn with the correct justification, but the position would be set based on the non-justified text width. The result was overlapping text whenever the script of the text changed. The fix goes through the justified glyphs and sets the width and position based on the new effective advance. Task-number: QTBUG-10421 Reviewed-by: Simon Hausmann
* | | doc: Fixed many broken links.Martin Smith2010-05-191-22/+21
|/ /
* | Fix setting font for QStaticText on Linux and MacEskil Abrahamsen Blomfeldt2010-03-301-5/+5
| | | | | | | | | | | | | | | | When using the fallback in QStaticText we have to update its font to the current painter's font, otherwise we will override the painter's font with the one cached in the QStaticText object. Reviewed-by: Olivier
* | Implement proper QStaticText support in QPaintBufferEskil Abrahamsen Blomfeldt2010-03-291-0/+10
| | | | | | | | | | | | | | | | | | Use qt_draw_glyphs() to implement a QPaintBuffer::drawStaticText() which will actually replay via drawStaticTextItem() on engines that support it. Task-number: QTBUG-9064 Reviewed-by: Gunnar
* | Make QStaticText layout lazyEskil Abrahamsen Blomfeldt2010-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | 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-23/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | Respect QPainter::pen() in QPainter::drawStaticText()Eskil Abrahamsen Blomfeldt2010-03-291-1/+1
| | | | | | | | | | | | | | | | | | | | 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
* | Add new function QTextLine::horizontalAdvance()Eskil Abrahamsen Blomfeldt2010-03-231-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Add a function to QTextLine which returns the accumulated advance of the glyphs in the text. Previously QTextLine::naturalTextWidth() was used for both this purpose and for calculating the pixel width of the text. Since these two metrics are not the same, either of the two usages would be wrong. QTextLine::naturalTextWidth() has been changed to do what its documentation claims it does, and horizontalAdvance() should now be used for laying out text horizontally. Reviewed-by: Simon Hausmann
* | Fixed performance issues when falling back to raster for sub-pixmaps.Samuel Rødal2010-03-221-2/+7
| | | | | | | | | | | | | | Copy the sub-pixmap so that we don't need to convert the entire pixmap to a QImage each time. Reviewed-by: Gunnar Sletta
* | Merge branch '4.7-cutoff' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into ↵Qt Continuous Integration System2010-03-091-4/+4
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 4.7-integration * '4.7-cutoff' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (82 commits) Revert 12b6987031be9faee3886d7623888feb4e1762af Changed TEST_COMPILER from CC to CXX in configure script. doc: Fixed several qdoc errors. Carbon: Native filedialog does not apply filters on app-bundles Cocoa: Native filedialog does not apply filters on app-bundles Improve performance of QTimer::singleShot Add a benchmark comparing single shot timer with invokeMethod use Qt's private mac functions, reduce code redundancy Assistant: Fix compile warning for empty header. Doc: mark QEasingCurve support functions as new in 4.7. Modify the XML test suite not to use non-characters. Autotest: Fix failing QTextCodec tests Doc: mark methods as internal (as they were in previous releases) Doc: add image for Qt Quick to "What's New" page. qdoc: Clear a static multimap after each qdocconf file. qdoc: Added some debug output to track down a crash Fixed mouse wheel handling in scrollareas. Added two missing keys for X11 Carbon: usage of menu bars can cause exceptions to be thrown Mac: compile fix ...
| * | doc: Fixed several qdoc errors.Martin Smith2010-03-091-4/+4
| | |
* | | Merge branch '4.7' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.7Eskil Abrahamsen Blomfeldt2010-03-091-23/+30
|\ \ \
| * | | Renamed QPainter::Fragment/Hint -> QPainter::PixmapFragment/HintTrond Kjernåsen2010-03-091-20/+20
| |/ / | | | | | | | | | Reviewed-by: Kim
| * | Fixed qDrawPixmaps() to draw on integer coordinates on Mac OS X.Trond Kjernåsen2010-03-011-3/+10
| | | | | | | | | | | | | | | | | | | | | This is the 4.7 port of d04f5336f769d9e5d2f9105e1da4a7d23ea91795. Task-number: related to QTBUG-8455 Reviewed-by: Kim
* | | Fix alignment of text with negative right bearingEskil Abrahamsen Blomfeldt2010-03-091-2/+3
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In change 5364fd96a72c89b281f0540da909fe64d0575ccf and some related changes, we made sure that the natural text width used for calculating bounding rects and line breaks in the text, takes the right bearing of the last glyph into consideration. As a side-effect, this broke alignment of text, as we want to align based on the accumulated advance of the glyphs, not based on the actual width. This is in particular important when aligning monospaced text, since the text can become misaligned if the glyphs extend beyond their advance. The bug was visible e.g. in line numbers ending with 2 in Qt Creator on X11, which would be shifted one pixel to the left compared to other line numbers. Task-number: QTBUG-8864 Reviewed-by: Thorbjørn
* | Merge branch 'master' of scm.dev.nokia.troll.no:qt/qtRhys Weatherley2010-02-241-0/+1
|\ \ | | | | | | | | | | | | Conflicts: configure
| * \ Merge remote branch 'origin/master' into bearermanagement/unit-testsAaron McCarthy2010-02-221-3/+141
| |\ \ | | | | | | | | | | | | | | | | Conflicts: src/network/access/qnetworkaccessmanager.cpp
| * \ \ Merge remote branch 'origin/4.6' into bearermanagement/integrationAaron McCarthy2010-02-111-7/+20
| |\ \ \ | | | | | | | | | | | | | | | | | | | | Conflicts: src/s60installs/s60installs.pro
| * \ \ \ Merge commit 'origin/4.6' into bearermanagement/integration-4Aaron McCarthy2010-01-291-13/+131
| |\ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/gui/painting/qpainter.cpp src/s60installs/s60installs.pro
| * | | | | Fix build on Maemo, force type to qreal.Aaron McCarthy2010-01-071-1/+2
| | | | | |
* | | | | | Add private qt_draw_glyphs() APIEskil Abrahamsen Blomfeldt2010-02-231-0/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In some use cases where you use an external font engine and want to use Qt's font engine for painting, you might need a function which will give you direct access to the underlying font. A generic API for this requires a lot of API changes, so in the meantime, we implement an internal, specialized API to support the use cases where it is required. The API is considered internal and experimental, and not guaranteed to be stable or even exist across releases. This is API which provides several fun ways to shoot yourself in the foot, but if used properly, it will allow you to paint glyph ids at precalculated positions. Task-number: QTBUG-7844 Reviewed-by: Trond
* | | | | | Made the qDrawPixmaps() API public (with modifications).Trond Kjernåsen2010-02-231-0/+154
| |_|_|/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QPainter has now gotten a drawPixmapFragments() function together with a Fragment class that describes how each pixmap fragment is supposed to be drawn. Reviewed-by: Gunnar Reviewed-by: Samuel
* | | | | Merge remote branch 'origin/master' into qt-master-from-4.6Thiago Macieira2010-02-201-0/+137
|\ \ \ \ \ | |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure.exe src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp src/opengl/qgl.cpp
| * | | | 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
| * | | | doc: Update documentation for QStaticTextEskil Abrahamsen Blomfeldt2010-02-161-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make some smaller modifications, fixes and additions. Remove \internal because the API is public now, and add documentation for QPainter::drawStaticText() since this was missing. Reviewed-by: TrustMe
| * | | | 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-5/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.