summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpaintengine_raster.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Avoid out of bounds memory reads when scaling imagesv4.8.6Lars Knoll2014-04-031-1/+1
| | | | | | | | | | | | | | | | | | The calculation of the width/height required for the scaling algorithm was prone to floating point rounding issues, where the lower value got rounded down, the higher one rounded up. This could lead to a situation where we iterated over one more line/pixel in the line than we have in the source image. Correct this by passing the dimension of the source image into the function and bounds checking the values before iterating. Backport of If44b2235a479224660d508a0504fec40d724763a from Qt 5 Task-number: QTBUG-35927 Change-Id: If145ee715a143b889538243f45227d8d78a0050f Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* 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>
* Fixed dashes being rendered differently depending on system clip.Samuel Rødal2013-03-141-13/+13
| | | | | | | | | | | | We need to clip lines to the unclipped device rect in the case of dashing, since otherwise the dashes will be shifted and rendered differently when partial repaints are done. Task-number: QTBUG-24762 Change-Id: I3599b54baa552acc20bf8cc2e12f846b45f6019e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> (cherry picked from commit a12f6ba302e54c1570c54aa4c722f2dafbf794af)
* 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>
* Fixed outline / fill inconsistencies in raster paint engine.Samuel Rødal2012-09-271-6/+1
| | | | | | | | | | | | We did coordinate rounding of the fill in the raster paint engine to match how drawLine_midpoint_i rendered lines. With the new cosmetic stroker in 4.8 this rounding is not needed anymore. Task-number: QTBUG-26013 (cherry picked from commit b6acec1e5d55d03ad3a0a70d2cf371d3f8fde629) Change-Id: I0324e3a45c525890fb58817a180c6aa712716780 Reviewed-by: Lars Knoll <lars.knoll@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>
* The scaling should not effect the width of a cosmetic penAndy Shaw2012-03-301-1/+1
| | | | | | | | | | | | When the scaling effects the pen width so that it is less than 1 pixel in width then it would use the QCosmeticStroker to draw, however this should not be the case for cosmetic pens that are not less than 1 pixel in width as the scaling does not change their width. Task-number: QTBUG-25006 Change-Id: I142db0f3a7ee02aa87171495d5a7a7011100814e Reviewed-by: Lars Knoll <lars.knoll@nokia.com> (cherry picked from commit 6eae3cec5a34fbed28e519ffd8a8f3f1cd7b5c5b)
* 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>
* Converting from double to qreal in guimread2011-10-101-4/+4
| | | | | | | | | | | | | | | | | | There were a number of places in QtGui where doubles were used in expressions due to the use of floating point constants in the code. Many of these constants are now constructed as qreal, removing the use of double operations where unneeded. These changes have been limited to constants that have exactly the same value whether double or float, to ensure that precision errors are not introduced. This should not affect any of the desktop platforms where qreal is double. On Symbian, where qreal is float, appropriate autotests have been run. Task-number: QTBUG-4894 Reviewed-by: Sami Merila
* Allocate 16-byte aligned memory independent of platform for raster pool.Samuel Rødal2011-09-091-37/+17
| | | | | | | Fixes crash on MIPS (see original merge request https://qt.gitorious.org/qt/qt/merge_requests/1366). Reviewed-by: Olivier Goffart
* Merge remote-tracking branch 'upstream/4.8'Sergio Ahumada2011-08-291-2/+2
|\ | | | | | | | | Conflicts: tools/qdoc3/cppcodemarker.cpp
| * Use CoreText for font rendering on uikit.Eike Ziller2011-08-241-2/+2
| |
* | Replace 'i < len-1 && func(i+1)' by 'i+1 < len && func(i+1)'suzuki toshiya2011-08-181-2/+2
|/ | | | | Merge-request: 1299 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Fixed regression introduced by 5842d19cf3dff37a85c.Samuel Rødal2011-08-031-4/+9
| | | | | | We need a normalized rectangle. Reviewed-by: aavit
* Fixed holes in border image drawing by introducing new API.Samuel Rødal2011-07-261-5/+6
| | | | | | | | | | | | | | | | | | | | | When rasterizing two adjacent QRectFs it's important that the shared x or y-edges have the exact same coordinates, or there might be a hole or an overlapping pixel when they are rasterized. Since the drawPixmapFragments API was based on a center position and a scale, it can not be used for this purpose, as the in the situation of two horizontally adjacent rectangles the right edge of the left-most rect and the left edge of the right-most edge are computed differently. Thus rounding errors can cause them to not be equal, especially when there's also a scaling / translating painter transform involved. Thus, to not sacrifice performance, we need to introduce a new drawPixmapFragments API that's simply takes an array of target rectangles and an array of source rectangles. It should give a slight performance boost for the border pixmap use case as well, since there are less floating point multiplications / divisions involved. Task-number: QTBUG-19079 Reviewed-by: Kim
* Get subpixel antialiasing again w/combo of raster and affine transformEskil Abrahamsen Blomfeldt2011-07-251-9/+3
| | | | | | | | | | | | | | | Revert part of hot fix 48ff7e5af99923396243940979d15d4ec2e2730c since it is no longer needed in Qt 4.8 due to the introduction of a separate code path for the FreeType case in drawCachedGlyphs(). This is also explained in the description for that commit. The consequence of the commit was that subpixel antialiasing would be turned off for all text drawn with a transformation and the raster engine. In the past this was not the case, it is however the case in several other paint engine, so the regression was deemed okay to hot fix the original problem. In Qt 4.8 the original problem has been fixed properly. Task-number: QTBUG-16205 Reviewed-by: Jiang Jiang
* Fix vertical positioning of glyphs in raster engine with FreeTypeJiang Jiang2011-06-281-3/+4
| | | | Reviewed-by: aavit
* Merge branch 'qt-4.8-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration ↵Qt Continuous Integration System2011-06-091-1/+9
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | into master-integration * 'qt-4.8-from-4.7' of scm.dev.nokia.troll.no:qt/qt-integration: (54 commits) Update internal state before emitting configurationChanged() signals. Fixed qmlshadersplugin manual test shaders on SGX family GPU:s. Fixed qmlshadersplugin on windows VC2008 toolchain. Reset input context in Symbian when another window is opened. KERN-EXEC 3 panic in QCoeFepInputContext::translateInputWidget() Close context menus during orientation change. Have -small-screen enabled in certain examples on Symbian always. Update Japanese translations. Revert some of "Make QMLViewer startup animation stop after a while" Fix for winscw QtGui.def Add private method for flushing the pixmap cache. QDeclarative: Fix QPerformanceTimer on Symbian Fix QTreeWidget autotest cases on Symbian/VGA Increase SSL readbuffer 1 -> 16 kB Fix pixel metrics for Symbian VGA devices Revert "Fix QNetworkConfigurationManager usage outside main thread first" Avoid buffer overrun in QMacPixmapData resizing Fix glyph metrics with QStaticText/Freetype/raster and light/no hinting Fix tst_QGraphicsItem::sorting() test case for Symbian Fix QHeaderView test case for VGA Symbian devices. ...
| * Merge branch '4.7' into qt-4.8-from-4.7Liang Qi2011-06-061-1/+9
| |\ | | | | | | | | | | | | | | | | | | Conflicts: src/gui/painting/qpaintengine_raster.cpp src/gui/text/qfontengine_ft.cpp src/s60installs/bwins/QtGuiu.def
| | * Missing glyphs transforming QStaticText on X11/raster with subpixel AAEskil Abrahamsen Blomfeldt2011-05-301-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Static text took an untested and broken code path for the combo of subpixel AA, X11, raster engine and transformation. This would cause missing glyphs. The reason was that QStaticText took an unused code path which turned out not to work. The workaround is to use gray AA on transformed text, like we already do for the GL engine. In Qt 4.8, the static text code path has been rewritten to use the Freetype cache instead of the image glyph cache, so the bug will be fixed more properly there. Reviewed-by: Samuel
| | * Update licenseheader text in source filesJyri Tahtela2011-05-131-17/+17
| | | | | | | | | | | | | | | | | | | | | Updated version of LGPL and FDL licenseheaders. Apply release phase licenseheaders for all source files. Reviewed-by: Trust Me
* | | Merge remote branch 'qt/4.8' into fire-masterPaul Olav Tvete2011-06-061-17/+17
|\| | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/platforms/wayland/qwaylandclipboard.cpp src/plugins/platforms/wayland/qwaylandclipboard.h src/plugins/platforms/wayland/qwaylanddisplay.cpp src/s60installs/eabi/QtOpenGLu.def
| * | 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
* | | Fix Windows buildJiang Jiang2011-06-031-2/+2
| | |
* | | Refactor glyph pretransform checkJiang Jiang2011-06-031-34/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move paintEngineSupportsTransformations logic from QPainter to paint engine subclasses. Simplify and consolidate checks for cached drawing (pretransformed) and path drawing (untransformed) in raster paint engine. Fix unnecessary transform when paint engines actually take the path drawing track. Fix scaling and rotation transform in raster engine for Mac. Task-number: QTBUG-19086 Change-Id: I1c0c1800a5173d3db765b9fccfd0e7a3628e3815 Reviewed-on: http://codereview.qt.nokia.com/298 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> (cherry picked from commit 43c0e08ba2e3487840b4063b2099bc17cdd4dce2)
* | | Still use midpoint rendering of aliased ellipsesaavit2011-05-311-0/+160
| | | | | | | | | | | | | | | | | | | | | 37c329a removed this, but it is required to get correct fills, particularly for small radii Reviewed-by: gunnar
* | | Keep line consistency with text baselineJiang Jiang2011-05-301-1/+2
| | | | | | | | | | | | | | | | | | Also revert previous underline patch. Reviewed-by: Eskil
* | | Revert the revert of subpixel positions interpretation for textJiang Jiang2011-05-231-3/+2
| | | | | | | | | | | | | | | | | | | | | So that text rendering with raster engine on Mac can be the same as with native engine. Reviewed-by: Eskil
* | | Compilation fix of f8e8583aavit2011-05-191-2/+3
| | |
* | | Revert "Fix how subpixel positions are intepreted in an aliased grid."aavit2011-05-191-12/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 69fc9e594e6d5da87bff42707973683f84b67c93. Conflicts: src/gui/painting/qpaintengine_raster.cpp src/gui/painting/qrasterizer.cpp
* | | Fall back to using paths for large fonts in drawStaticText()Eskil Abrahamsen Blomfeldt2011-05-181-2/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QStaticText had an implicit risk which meant you had to make sure the text size did not grow unreasonably large. This was intended to avoid hiding the performance impact of using QStaticText for such a purpose, but it's too inconvenient. Thus, the same fall back as in drawTextItem() has been introduced. This will also fix a bug recently introduced when we started using the FT cache to draw static text in the raster engine, since this will fail for large fonts. Task-number: QTBUG-19084, QTBUG-19370 Reviewed-by: Jiang Jiang
* | | New algorithm for drawing thin linesLars Knoll2011-05-121-1442/+78
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Added a new QCosmeticStroker class for drawing thin lines. The class can handle both aliased and antialiased lines. The code replaces all the midpoint line drawing algorithms in the raster paintengine and gives correct subpixel positioning for lines. It gives around 30% to 50% speedup against the midpoint algorithm. If we missed that fast path, the speedup is around between a factor of 6 to 8 for lines and aliased paths and 100 and 400 for antialiased paths. Reviewed-by: Kim
* | Added support for six-parameter radial gradients.Samuel Rødal2011-04-131-1/+2
| | | | | | | | | | | | | | | | The extended radial gradients conform to the radial gradient specification in HTML 5 canvas. Task-number: QTBUG-14075 Reviewed-by: Andreas Kling
* | Improved gradient table generation performance for two-stop gradients.Samuel Rødal2011-04-131-0/+78
| | | | | | | | | | | | | | | | Two stops is a fairly common case so we gain quite a bit by special casing it. Improves performance by 10 % in parcycle benchmark, and by 90 % in a synthetic benchmark. Reviewed-by: Andreas Kling
* | Make sure we don't use subpixel positions in full hinting modeJiang Jiang2011-04-011-6/+1
| | | | | | | | | | | | | | | | Some of the text can start from subpixel positions (start from 100.5 for instance), we need to make sure they stick to pixel grid in this case. Reviewed-by: Eskil
* | Fix remaining regressions in QWSJiang Jiang2011-03-251-2/+5
| | | | | | | | Reviewed-by: TrustMe
* | Fixed remaining issues in subpixel positioning with FreeTypeJiang Jiang2011-03-241-125/+125
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1. Merge QStaticText and QGlyphs drawing code of raster engine into glyph drawing code for normal QTextItem, it simplify the caching system (we don't use QImageTextureGlyphCache for raster anymore, just glyph set cache in FreeType engine is enough), and fix some regressions in QStaticText and QGlyphs drawing. 2. Fix subpixel positioning support for OpenGL texture glyph cache. Including a transform handling regression introduced by the initial patch. 3. Disable subpixel positioning for bitmap fonts (mono format). After this change, we only have two code paths for glyph rendering with FreeType: raster will always use the simple code path (with QFontEngine_FT cache) while GL will always use QTextureGlyphCache. Reviewed-by: Eskil
* | Implement subpixel positioning with FreeTypeJiang Jiang2011-03-221-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | QFontEngineFT are used in raster/OpenGL paint engine and QGLWidget, also in Symbian, etc. We want to make sure it works well in raster and QGLWidget first. Regardless subpixel antialiasing (LCD filtering) is enabled or not (though it does look better when subpixel antialiasing is on). We also need to support transformations. The tricky part here is that, under X11, we have a different code path for QFontEngineFT and other font engines in raster engine, which uses QFontEngineFT's own glyph cache system. While in other platforms (Windows and Mac) and QGLWidget, we will use the generic QTextureGlyphCache. The generic QTextureGlyphCache already has support for subpixel positions, this solution is ported to QFontEngineFT for its QGlyphSet: the key for QGlyphSet hash table has been extended from glyph_t to <glyph_t, QFixed subPixelPosition> pair. The real work to enable subpixel positioning with FreeType is in fact really simple, we just set the horizontal translation to the subpixel position * 64 (FreeType uses a coordinate system of 1/64 of a pixel resolution internally) immediately before loading the glyph. A slight tweek to bitmap width is applied when we are getting the bitmap ourselves instead of using FT_Render_Glyph to accommodate the subpixel translation, which will only be used in non-LCD filtering cases (grayscale antialiasing). From what we have observed, FreeType can generate different bitmaps for at least 12 different subpixel positions (each with a slight difference). To limit the memory consumption, we restrict the number of subpixel positions to be 4 (hardcoded), which should be good enough for most low resolution displays. Subpixel positioning (and fractional glyph advances) will only be enabled when the hintingPreference for the font being used is PreferNoHinting or PreferVerticalHinting. We will use fontconfig hintstyle setting by default when no hintingPreference is set for the font. Task-number: QTBUG-12279 Reviewed-by: Eskil
* | Merge remote-tracking branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2011-02-231-0/+7
|\| | | | | | | | | | | | | | | Conflicts: src/gui/kernel/qcocoaview_mac.mm src/s60installs/bwins/QtGuiu.def src/s60installs/eabi/QtGuiu.def src/testlib/qtestcase.cpp
| * Prevent infinite loop in raster engine on zero dash pattern length.Samuel Rødal2011-02-221-0/+7
| | | | | | | | | | Task-number: QTBUG-17053 Reviewed-by: Kim
* | Fix silly warnings about initialising in the wrong orderThiago Macieira2011-02-211-4/+4
| |
* | Merge remote branch 'origin/4.7' into qt-master-from-4.7Olivier Goffart2011-01-171-3/+3
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: examples/webkit/imageanalyzer/imageanalyzer.h examples/webkit/imageanalyzer/mainwindow.h mkspecs/unsupported/qws/linux-x86-openkode-g++/qplatformdefs.h src/corelib/io/qfsfileengine_iterator_unix.cpp src/corelib/io/qfsfileengine_iterator_win.cpp src/corelib/kernel/qcoreapplication.cpp src/network/access/qnetworkaccessdatabackend.cpp src/plugins/bearer/connman/qconnmanservice_linux.cpp src/plugins/platforms/openvglite/qwindowsurface_vglite.h src/s60installs/bwins/QtCoreu.def src/s60installs/eabi/QtCoreu.def src/s60installs/s60installs.pro tools/assistant/tools/assistant/helpviewer_qwv.h tools/qdoc3/test/qt-html-templates.qdocconf
| * Update copyright year to 2011.Jason McDonald2011-01-111-1/+1
| | | | | | | | Reviewed-by: Trust Me
| * Doc: Fixing typoSergio Ahumada2011-01-071-2/+2
| |
* | Merge branch 'qt-graphics-team-text-master'Eskil Abrahamsen Blomfeldt2011-01-101-1/+3
|\ \
| * | Optimize texture glyph cacheEskil Abrahamsen Blomfeldt2010-12-211-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To avoid calling the bounding box function for the same non-printable characters in every call, we cache them as empty in the coords table and bail out before painting them. This patch also fixes some possible reads of uninitialized memory (reference to return value) and reference to a default constructed object consisting of uninitialized pods. Reviewed-by: Samuel
* | | Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into ↵Qt Continuous Integration System2010-12-211-22/+15
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | master-integration * 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (33 commits) Add inter-process binary shader cache for MeeGo Track average wait times under our maximum spin time threshold Store and track spin times in nanosecond resolution Optimize adaptive spinning mutex code Improve QMutex contention performance on Linux Improve QMutex contention performance on Mac OS X Disable spinning under lock contention on single CPU machines Remove unnecessary testAndSetAcquire from QMutex::lockInternal() Move contender count maintenance to QMutexPrivate test contention when using 2 mutexes Ensure that every thread does contend in the contention tests Add baseline test data to measure test overhead Test contention performance for long (10ms) critical sections Add a benchmark for contended and uncontended QMutex performance Removed QMutexPrivate::self() declaration Add QElapsedTimer::nsecsElapsed() const Delay creation of the process manager Make the QRasterPaintEngineState copy constructor cheaper. Micro-optimization for QSpanData::setup() define FSCTL_SET_REPARSE_POINT in test header ...
| * | | Make the QRasterPaintEngineState copy constructor cheaper.Andreas Kling2010-12-201-21/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use initializer syntax to avoid default-constructing a throwaway QBrush and QPen. Reviewed-by: Samuel Rødal
| * | | Micro-optimization for QSpanData::setup()Andreas Kling2010-12-201-1/+2
| |/ / | | | | | | | | | | | | | | | Don't call QColor::rgba() in a macro arg that gets evaluated multiple times. Reviewed-by: Samuel Rødal