Change in plasma-framework[master]: roundToIconSize(0) should return 0

David Edmundson (Code Review) noreply at kde.org
Wed Dec 10 18:20:04 UTC 2014


David Edmundson has uploaded a new change for review.

  https://gerrit.vesnicky.cesnet.cz/r/213

Change subject: roundToIconSize(0) should return 0
......................................................................

roundToIconSize(0) should return 0

If an invalid icon size is passed to roundToIconSize we should return an
invalid icon size.

This can cause IconItem to load a small pixmap which will never be
shown.

Change-Id: Ia678f2e879b83317e2971069acf8f00d9ce2e052
---
M src/declarativeimports/core/units.cpp
1 file changed, 3 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.vesnicky.cesnet.cz:29418/plasma-framework refs/changes/13/213/1

diff --git a/src/declarativeimports/core/units.cpp b/src/declarativeimports/core/units.cpp
index dfc817a..ba06553 100644
--- a/src/declarativeimports/core/units.cpp
+++ b/src/declarativeimports/core/units.cpp
@@ -107,9 +107,10 @@
 int Units::roundToIconSize(int size)
 {
     /*Do *not* use devicePixelIconSize here, we want to use the sizes of the pixmaps of the smallest icons on the disk. And those are unaffected by dpi*/
-    if (size < KIconLoader::SizeSmall) {
+    if (size <= 0) {
+        return 0;
+    } else if (size < KIconLoader::SizeSmall) {
         return KIconLoader::SizeSmall/2;
-
     } else if (size < KIconLoader::SizeSmallMedium) {
         return KIconLoader::SizeSmall;
 

-- 
To view, visit https://gerrit.vesnicky.cesnet.cz/r/213
To unsubscribe, visit https://gerrit.vesnicky.cesnet.cz/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia678f2e879b83317e2971069acf8f00d9ce2e052
Gerrit-PatchSet: 1
Gerrit-Project: plasma-framework
Gerrit-Branch: master
Gerrit-Owner: David Edmundson <david at davidedmundson.co.uk>
Gerrit-Reviewer: Marco Martin <notmart at gmail.com>


More information about the Plasma-devel mailing list