summaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Fix tst_QGraphicsView::cursor2() - sorting bug when using BSP tree.Andreas Aardal Hanssen2009-06-091-2/+2
| | | | | | | | | | | | | | | | | | Make sure we don't claim that we have sorted all toplevel items when we are using the BSP tree, as when painting we have only actually sorted a subset of the elements.
* | | Removes odd artifact in the chip demo.Bjørn Erik Nilsen2009-06-092-3/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling repaint() instead of update() is bad when having multiple views (which GV perfectly supports). The result is that e.g. when moving a chip in the chip demo, there's a visible lag between each view. It can also be a performance killer on QWS, where the surface is locked for each repaint(). Instead of calling repaint() we call update() as before, but we also make sure the updates are processed immediately.
* | | Make sure the dirty state of an item is reset when removed from the scene.Bjørn Erik Nilsen2009-06-091-0/+2
| | | | | | | | | | | | Makes tst_QGraphicsItem::paint happy.
* | | Discard updates outside the bounding rect.Bjørn Erik Nilsen2009-06-092-1/+4
| | | | | | | | | | | | Makes tst_QGraphicsItem::cacheMode happy.
* | | Compatibility fix for QGraphicsScene::changed signal.Bjørn Erik Nilsen2009-06-092-3/+22
| | | | | | | | | | | | | | | Makes tst_QGraphicsScene::changedSignal and tst_QGraphicsItem::setMatrix happy.
* | | Make sure we reset the updateAll variable correctly.Bjørn Erik Nilsen2009-06-091-0/+1
| | | | | | | | | | | | Makes tst_QGraphicsScene::update happy.
* | | Compatibility fix for QGraphicsScene::sceneRectChanged()/sceneRect().Bjørn Erik Nilsen2009-06-094-11/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | Avoid falling in the else case when there are no views.Bjørn Erik Nilsen2009-06-091-1/+1
| | | | | | | | | | | | Partially fixes tst_QGraphicsScene::update failure.
* | | Ensure we pass the intersect mode when checking item collisions.Andreas Aardal Hanssen2009-06-091-1/+1
| | | | | | | | | | | | | | | This fixes one of two failures in tst_QGraphicsScene::items_QRectF_2. The other seems unrelated.
* | | Fix stacking order bug, ensure the dirty sort bits are set correctly.Andreas Aardal Hanssen2009-06-091-1/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | The code marked the item's own stacking order as dirty when changing its own Z value, the right thing is however to set the _parent's_ bit. Also added missing code for when the ItemStacksBehindParent flag was toggled. Reviewed-by: bnilsen
* | | Fix rendering of items that ignore parent opacity.Andreas Aardal Hanssen2009-06-091-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | Test if the children ignore the parent's opacity if the current item's opacity is 0.0. If any of the children do ignore the parent then we must continue. Further optimizations are possible: if the item itself is transparent, then don't visit children that don't ignore parent opacity. Reviewed-by: bnilsen
* | | Fix bug in QGraphicsItem::effectiveOpacity() caused by typo.Andreas Aardal Hanssen2009-06-091-2/+3
| | | | | | | | | | | | | | | | | | | | | See change 72842b2d, the patch misplaces 'p' and 'parent'. This fixes the tst_QGraphicsItem::opacity autotests. Reviewed-by: bnilsen
* | | Ensure we can find and draw items whose size is (0x0).Andreas Aardal Hanssen2009-06-091-34/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | This removes a microoptimization we did to avoid processing items whose size was (0x0). Turns out an autotest started failing if we did this - we have to find and draw such items because they are commonly used to draw points (e.g., plot graphs). Reviewed-by: bnilsen
* | | Fix clipping bug, move code to avoid unintentional shadowing.Andreas Aardal Hanssen2009-06-091-14/+14
| | | | | | | | | | | | | | | | | | | | | The children variable tested for clipping was the wrong variable. This broke when the code was moved down as part of a previous cleanup change. Reviewed-by: bnilsen
* | | Add BSP tree support to the recursive drawing algorithm.Andreas Aardal Hanssen2009-06-091-7/+34
| | | | | | | | | | | | | | | The code looks ugly and needs to be refactored, but at least this reintroduces the BSP so the chip demo works fine again.
* | | Add QGraphicsItem::itemChangeEnabled().Andreas Aardal Hanssen2009-06-094-88/+202
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This function allows the user to disable notifications for item changes. In QSimpleCanvasItem, all notifications are disabled by default, and you can enable them one at a time. QGraphicsItem's behavior is to by default enable all notifications. A side effect of this change is that I've removed one optimization in favor of another: by not constructing a QVariant at all when there's no notification we get maximum performance, at the expense of constructing it twice if there is a notification.
* | | Compatibility fix: Updates made on the scene must be processed with a queued ↵Bjørn Erik Nilsen2009-06-091-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | connection This connection was queued in the views before, but we don't do that anymore, instead we re-use the _q_emitUpdated slot and process pending updates on the views there. Makes tst_QGraphicsView::viewportUpdateMode happy again.
* | | Speed up processing of dirty items when ancestor clips children.Bjørn Erik Nilsen2009-06-092-7/+28
| | | | | | | | | | | | | | | | | | 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 :)
* | | Correct minor mistake after re-refactoring.Bjørn Erik Nilsen2009-06-091-1/+1
| | | | | | | | | | | | We don't want to re-calculate the dirty rect for each view.
* | | Avoid constructing empty temporary QTransforms.Andreas Aardal Hanssen2009-06-092-10/+10
| | | | | | | | | | | | This is a microoptimization.
* | | Add QGraphicsView::isTransformed(), and use it to avoid view transforms.Andreas Aardal Hanssen2009-06-093-4/+19
| | | | | | | | | | | | | | | Ensure that we don't ask for or multiply with the view transform if the view is not transformed.
* | | Remove leftover code from merge conflict.Andreas Aardal Hanssen2009-06-091-66/+0
| | |
* | | Cache QGrahicsItem's scene transform.Bjørn Erik Nilsen2009-06-095-39/+109
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 :)
* | | Generalize QGrahicsScenePrivate::processDirtyItemsRecursive.Bjørn Erik Nilsen2009-06-092-47/+58
| | | | | | | | | | | | | | | | | | | | | Add back compatibility support and make it independent of the views. Also store the sceneTransform instead of the deviceTransform. This will later be the item's cached scene transform (coming in another commit).
* | | optimise isFullyTransparent()Lars Knoll2009-06-091-7/+19
| | | | | | | | | | | | | | | This cuts down quite some intructions in some use cases, making esp. discardUpdateRequest() a bit cheaper.
* | | implement equality operator in a more sane wayLars Knoll2009-06-091-5/+9
| | | | | | | | | | | | | | | | | | | | | Using qFuzzyCompare for checking whether two transformations are equal doesn't give us too much and is inconsistent with our other matrix classes. Using simple floating point equality is a lot faster as well.
* | | Optimise effectiveOpacity and make it inlineable.Lars Knoll2009-06-093-18/+28
| | | | | | | | | | | | | | | | | | This cut's off some cycles in discardUpdateRequest() which is called from most places when something in the items changes.
* | | Remove crash, remove item from pending updates when deleted.Andreas Aardal Hanssen2009-06-091-0/+1
| | | | | | | | | | | | This caused a crash in the contacts demo.
* | | A faster item discovery function for rectangles (recursive).Andreas Aardal Hanssen2009-06-092-1/+113
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Microoptimize: make this function inline.Andreas Aardal Hanssen2009-06-092-15/+7
| | | | | | | | | | | | | | | Also change the order of comparisons, as the transformable flags are most likely to fail first.
* | | Don't construct new style option objects in a tight loop.Andreas Aardal Hanssen2009-06-092-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | 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-093-105/+11
| | | | | | | | | | | | | | | 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-094-16/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Refactor QTransform combining code, and mark all code that combines.Andreas Aardal Hanssen2009-06-094-69/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | This change introduces two helper functions in QGraphicsItemPrivate, that combine the item's transform into the current transform, effectively merging the code that calculates any item's combined to-parent transform. This makes the code more readable, and also makes it easier for us to reintroduce the componentized transform API in QGraphicsItem (which was previously reverted).
* | | Fix QGraphicsScene::drawItems() to use the recursive path as well.Andreas Aardal Hanssen2009-06-095-157/+34
| | | | | | | | | | | | | | | | | | 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.
* | | Only repaint in QGraphicsViewPrivate::processPendingUpdates()Andreas Aardal Hanssen2009-06-091-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | Convert some repaint() calls back to updates(). This ensures that any updates triggered before this call are processed normally, while still keeping the synchronous repaint() call intact. Reviewed-by: bnilsen
* | | Avoid recursive repaint by calling update() when there's a full scene update.Andreas Aardal Hanssen2009-06-091-1/+1
| | |
* | | Experimental change: replace all updates with repaints.Andreas Aardal Hanssen2009-06-091-8/+8
| | | | | | | | | | | | | | | This seems to be the only way to get a high frame rate, regardless of the performance of painting and all.
* | | Experimental change - disable itemChange notifications for move and transform.Andreas Aardal Hanssen2009-06-091-0/+18
| | | | | | | | | | | | | | | This change is only to test how much of an impact the itemChange mechanism has on performance. It's easy to revert later on.
* | | Avoid calling QGraphicsItem::effectiveOpacity() when rendering - insteadAndreas Aardal Hanssen2009-06-092-7/+26
| | | | | | | | | | | | | | | | | | just calculate it top-down. Reviewed-by: bnilsen
* | | Remove siblingIndex and use stable sorting instead.Andreas Aardal Hanssen2009-06-094-28/+24
| | | | | | | | | | | | | | | | | | | | | To avoid sorting siblings in real-time, ensure we lazily sort the list in place when needed. Reviewed-by: bnilsen
* | | Simplify the QTransform calculations.Andreas Aardal Hanssen2009-06-091-35/+11
| | |
* | | Ooops. Compile :)Bjørn Erik Nilsen2009-06-091-1/+1
| | |
* | | Only call qgetenv("QGRAPHICSVIEW_DIRECT") once.Bjørn Erik Nilsen2009-06-091-3/+2
| | |
* | | More re-factoring of Graphics View's update mechanism.Bjørn Erik Nilsen2009-06-094-83/+185
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Introduce QGraphicsItem::ItemHasNoContents.Andreas Aardal Hanssen2009-06-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This flag helps optimize the case where an item is used only as a transformation node in a scene graph, and where the item itself doesn't paint anything. This is the default for FxItem (the subclasses that do paint enable the HasContents flag). This lets Graphics View know whether there's any point in setting up the world transform, opacity and other things. Reviewed-by: Lars
* | | fix a small logic bug in childrenCombineOpacityLars Knoll2009-06-091-1/+3
| | | | | | | | | | | | Regression introduced during refactoring earlier today.
* | | remove now unused flagLars Knoll2009-06-091-2/+2
| | |
* | | smaller optimisation in setTransformLars Knoll2009-06-091-8/+2
| | |
* | | simplify opacity handling in QGraphicsItemLars Knoll2009-06-091-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Greatly simplify how we handle opacity and store it as a member in QGraphicsItemPrivate. Remove the caching of effectiveOpacity. It's faster to calculate it on the fly, and the recursive painting algorithm will make even that need go away. Reviewed-by: Andreas