Checking for QUrl equality is not all that expensive, so remove hack.
authorRobin Burchell <robin+qt@viroteck.net>
Sat, 23 Jun 2012 07:34:27 +0000 (09:34 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 26 Jun 2012 07:46:01 +0000 (09:46 +0200)
QUrl's operator== used to perform allocations by comparing normalized URLs, but
even then, this code seemingly would not apply: Qt 4's QUrl still has a fast
path for the case where the URLs are empty, the same as this code implemented.

Change-Id: I69e82c848f47f5e5660bd707bfba0ff7343c8a42
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
src/quick/items/qquickborderimage.cpp
src/quick/items/qquickimagebase.cpp

index 87d423f..abd20c6 100644 (file)
@@ -274,8 +274,8 @@ QQuickBorderImage::~QQuickBorderImage()
 void QQuickBorderImage::setSource(const QUrl &url)
 {
     Q_D(QQuickBorderImage);
-    //equality is fairly expensive, so we bypass for simple, common case
-    if ((d->url.isEmpty() == url.isEmpty()) && url == d->url)
+
+    if (url == d->url)
         return;
 
     if (d->sciReply) {
index 0bdfab6..735910e 100644 (file)
@@ -100,8 +100,8 @@ QUrl QQuickImageBase::source() const
 void QQuickImageBase::setSource(const QUrl &url)
 {
     Q_D(QQuickImageBase);
-    //equality is fairly expensive, so we bypass for simple, common case
-    if ((d->url.isEmpty() == url.isEmpty()) && url == d->url)
+
+    if (url == d->url)
         return;
 
     d->url = url;