summaryrefslogtreecommitdiffstats
path: root/src/gui/graphicsview/qgraphicsscene_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove duplicated code for removing an item from the scene.Bjørn Erik Nilsen2009-06-091-2/+3
| | | | | | | | | Before we had almost two identical functions for removing an item from the scene. There was only minor differences depending on whether the item was removed from QGraphicsScene::removeItem or from the item's destructor. Now we have one function that handles both cases just fine. Reviewed-by: Andreas
* Remove one unnecessary argument from the recursive draw function.Andreas Aardal Hanssen2009-06-091-1/+1
| | | | | We don't have to pass optimization flags; we already have a member variable we can test for painter state protection.
* Revert 7aee2a7054d1ca280f6dfc9c46b3fe2ce403ccb3, fix render bugs.Andreas Aardal Hanssen2009-06-091-1/+0
| | | | | | | | | | This change introduced an unexpected interdependency for scenes with items that enable ItemStacksBehindParent, and that contain children that are transformed. There's a manual test for this, called clippingAndTransformations, which shows this problem. The bug has been fixed and this change also includes an autotest that covers exactly this problem.
* Compatibility fix for QGraphicsScene::sceneRectChanged()/sceneRect().Bjørn Erik Nilsen2009-06-091-1/+4
| | | | | | | | | | | | | We have to keep the growingItemsBoundingRect up-to-date if there's no scene rect. The only difference now is that sceneRectChanged will not be emitted before entering the event-loop, but the documentation only states it'll be emitted when the scene rect changes, so we consider it harmless. Makes tst_QGraphicsView::sceneRect_growing and tst_QGrahicsScene::sceneRect happy. Reviewed-by: Andreas
* Speed up processing of dirty items when ancestor clips children.Bjørn Erik Nilsen2009-06-091-1/+1
| | | | | | This patch also contains a bug fix where a child item didn't update due to a bit not being properly set. No more rendering artifacts :)
* Avoid constructing empty temporary QTransforms.Andreas Aardal Hanssen2009-06-091-0/+1
| | | | This is a microoptimization.
* Cache QGrahicsItem's scene transform.Bjørn Erik Nilsen2009-06-091-3/+2
| | | | | | | | | | | | | | | | Invalidating the scene transform is just a matter of setting a bit on the item. Then, when we ask for the item's scene transform, we traverse its ancestors recursively and find the top-most dirty item. The algorithm then backtracks to that item and start calculating the scene transform for the item itself and all its children in the call stack. If the item itself and all its ancestors are "clean", nothing is calculated, only traversed. We use this approach when processing dirty items / drawing items as well. That way we ensure the scene transform is only calculated once when absolutely needed. G'night :)
* A faster item discovery function for rectangles (recursive).Andreas Aardal Hanssen2009-06-091-0/+4
| | | | | | | | | | This function works much faster than the last one, but still it can be much faster. The main expense right now it seems is the transform calculations, and the item->collidesWithPath call. There's still much to gain here. This function does not make use of the BSP tree's fast lookup so it makes lookups slower in (e.g.) the chip demo.
* Don't construct new style option objects in a tight loop.Andreas Aardal Hanssen2009-06-091-0/+3
| | | | | | | | The QStyleOption constructor is expensive, as it allocates a QFont, a QPalette and a QFontMetrics. By simply reusing a temporary style option object instead we carve away wasted cycles. Reviewed-by: Ariya
* Graphics View cleanup: Remove iterative processing of dirty items.Bjørn Erik Nilsen2009-06-091-14/+0
| | | | | The recursive approach is faster and fits better into the new scene transform cache we'll do later.
* Fix sorting bug and ensure render functions work. Make direct default.Andreas Aardal Hanssen2009-06-091-1/+1
| | | | | | | | | | Mark the children list for sorting when the Z value for items changes. Change the signature of the recursive draw function slightly so that the expose region is optional, and ensure we don't intersect with this region if it's not available. This change also flips the direct painting so that the default is to use the recursive approach.
* Fix QGraphicsScene::drawItems() to use the recursive path as well.Andreas Aardal Hanssen2009-06-091-1/+1
| | | | | | This change also changes the direct painting path to be opt-in as a temporary testing measure to see what's broken when using the old code path.
* Avoid calling QGraphicsItem::effectiveOpacity() when rendering - insteadAndreas Aardal Hanssen2009-06-091-1/+2
| | | | | | just calculate it top-down. Reviewed-by: bnilsen
* Remove siblingIndex and use stable sorting instead.Andreas Aardal Hanssen2009-06-091-0/+1
| | | | | | | To avoid sorting siblings in real-time, ensure we lazily sort the list in place when needed. Reviewed-by: bnilsen
* More re-factoring of Graphics View's update mechanism.Bjørn Erik Nilsen2009-06-091-0/+4
| | | | | | | | | This time with a recursive approach of processing dirty items. I've kept the previous approach using a dirty list, but the recursive one is now the default. Use QT_GV_USE_DIRTY_LIST=1 to swap. I've also cached the item's device transform in both cases so that we can re-use it later when drawing the item.
* Remove scene transform cache from QGraphicsItem.Andreas Aardal Hanssen2009-06-091-4/+0
| | | | | | | | | Now that we have a recursive painting algorithm these types of optimizations are no longer necessary. In fact they only cause more problems and clutter up the code unnecessarily. Removing this also removes extra overhead from moving and transforming items. Reviewed-by: Lars
* Massive re-factoring of Graphics View's update mechanism.Bjørn Erik Nilsen2009-06-091-4/+26
| | | | | | | | | | | This is work-in-progress, so don't expect everything to work perfectly. Most of the auto-test pass and examples and demos seem to run fine. Unfortunately I'm too tired to write about the actual update mehanism now, but it's faster than the old approach (if that helps:)). There's more to optimize, but I'll come back to that later. I need some sleep now :) To be continued.
* Further optimizations, from the simple canvas rendering logics.Andreas Aardal Hanssen2009-06-091-1/+2
|
* Fix optimization flags and opacity.Andreas Aardal Hanssen2009-06-091-1/+2
|
* Add recursive drawing method to QGraphicsScene. For now it's opt-in, butAndreas Aardal Hanssen2009-06-091-0/+3
| | | | | | the important thing is by effectively implementing Simple Canvas' approach to drawing, we're in theory (and in practise measured on the desktop) as fast as Simple Canvas when rendering.
* Disable mouse tracking in QGraphicsView if possible.Bjoern Erik Nilsen2009-04-071-0/+3
| | | | | | | | | | | | | | | | | | | | We don't need mouse tracking unless there are items in the scene that either accept hover events or have a cursor set. This cut-off is extremely efficient in the common case since all items ignore hover events and use the standard cursor by default. We no longer dig for items and do lots of intersection and calculating just for fun :-) We even get rid of the overhead of 2 x QCoreApplication::sendEvent! The next step is to optimize the items(*) functions to simply check for hasCursor()/acceptsHoverEvents() before we do complex checks like intersects/collidesWithPath() etc. Auto test included. Reviewed-by: Andreas
* Merge commit 'origin/4.5'Bjoern Erik Nilsen2009-04-071-0/+4
|\ | | | | | | | | | | | | | | Conflicts: src/gui/graphicsview/qgraphicsitem.cpp src/gui/graphicsview/qgraphicsitem_p.h src/gui/graphicsview/qgraphicsscene.cpp src/gui/painting/qtransform.cpp
| * Optimise QGraphicsScene/View::items(const QPointF &pos)Lars Knoll2009-04-061-0/+4
| | | | | | | | | | Implement specialized (and more efficient versions) of item_helper() and child_helper() that test for QPointF in the scene.
| * Long live Qt 4.5!Lars Knoll2009-03-231-0/+265
|
* Long live Qt!Lars Knoll2009-03-231-0/+268