diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-11-10 12:45:49 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2016-11-10 16:14:51 +0000 |
commit | 467b15a20c3d6eb611ea5f6ccffd5fc0df81b0c4 (patch) | |
tree | 1bff11fa019cebd2242c856301b7bd28462a9f6c /src/widgets/styles/qpixmapstyle.cpp | |
parent | 5cff7d2b679d48a247b4630cb9e3d5b04fab0b55 (diff) |
Improve use of QHash to minimize double hashing
Avoid looking up by key twice in a row in various locations, but instead
using iterators and index lookup.
Change-Id: I61a079115199ab9c041ad3a26d36b45ee3f775e0
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/widgets/styles/qpixmapstyle.cpp')
-rw-r--r-- | src/widgets/styles/qpixmapstyle.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/widgets/styles/qpixmapstyle.cpp b/src/widgets/styles/qpixmapstyle.cpp index b51860045d..e973a96a91 100644 --- a/src/widgets/styles/qpixmapstyle.cpp +++ b/src/widgets/styles/qpixmapstyle.cpp @@ -628,10 +628,10 @@ void QPixmapStyle::drawCachedPixmap(QPixmapStyle::ControlDescriptor control, con QPainter *p) const { Q_D(const QPixmapStyle); - if (!d->descriptors.contains(control)) + auto descriptor = d->descriptors.constFind(control); + if (descriptor == d->descriptors.constEnd()) return; - const QPixmapStyleDescriptor &desc = d->descriptors.value(control); - const QPixmap pix = d->getCachedPixmap(control, desc, rect.size()); + const QPixmap pix = d->getCachedPixmap(control, descriptor.value(), rect.size()); Q_ASSERT(!pix.isNull()); p->drawPixmap(rect, pix); } |