From b2ff9d346caffa8a6334ab726412b72a1dd1077c Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Sat, 23 Jun 2012 09:34:27 +0200 Subject: [PATCH] Checking for QUrl equality is not all that expensive, so remove hack. 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 Reviewed-by: Michael Brasser --- src/quick/items/qquickborderimage.cpp | 4 ++-- src/quick/items/qquickimagebase.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp index 87d423f..abd20c6 100644 --- a/src/quick/items/qquickborderimage.cpp +++ b/src/quick/items/qquickborderimage.cpp @@ -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) { diff --git a/src/quick/items/qquickimagebase.cpp b/src/quick/items/qquickimagebase.cpp index 0bdfab6..735910e 100644 --- a/src/quick/items/qquickimagebase.cpp +++ b/src/quick/items/qquickimagebase.cpp @@ -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; -- 1.7.2.5