aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickanchors.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2012-02-10 10:15:13 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-13 01:36:13 +0100
commite99c5a3f113bbc1b8f8db996b4b0d5715eea2d89 (patch)
tree8a973abb533edd382e1b41169039d6baf518857f /src/quick/items/qquickanchors.cpp
parentbd3307402d9249ab8155546d7e7db6d381b56e85 (diff)
Fix anchor jitters that could occur during animation.
The anchors were using a different definition of center than the actual center (9337c140cab7db1285f893b66d0e56423a74c253). With this change center-anchored Rectangles may sometimes have fuzzy antialiasing again. Task-number: QTBUG-12441 Task-number: QTBUG-21730 Change-Id: Iaf61409c7c523510d0d657fe7ba96f29a8610090 Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'src/quick/items/qquickanchors.cpp')
-rw-r--r--src/quick/items/qquickanchors.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/src/quick/items/qquickanchors.cpp b/src/quick/items/qquickanchors.cpp
index 2d852f708d..2df304e15d 100644
--- a/src/quick/items/qquickanchors.cpp
+++ b/src/quick/items/qquickanchors.cpp
@@ -51,24 +51,14 @@ QT_BEGIN_NAMESPACE
//TODO: should we cache relationships, so we don't have to check each time (parent-child or sibling)?
//TODO: support non-parent, non-sibling (need to find lowest common ancestor)
-static qreal hcenter(QQuickItem *item)
+static inline qreal hcenter(QQuickItem *item)
{
- qreal width = item->width();
- int iw = width;
- if (iw % 2)
- return (width + 1) / 2;
- else
- return width / 2;
+ return item->width() / 2;
}
-static qreal vcenter(QQuickItem *item)
+static inline qreal vcenter(QQuickItem *item)
{
- qreal height = item->height();
- int ih = height;
- if (ih % 2)
- return (height + 1) / 2;
- else
- return height / 2;
+ return item->height() / 2;
}
//### const item?