author | alwin <alwin> | 2004-11-07 19:37:17 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-11-07 19:37:17 (UTC) |
commit | 9218d2bf841e1f999475c86ba602dc1cd7e338f6 (patch) (unidiff) | |
tree | eb02e9dc2d1d4e8188f2c7cf8260d81298352117 | |
parent | c7eb493b3c2efa871104b27b6abf487da94f33f6 (diff) | |
download | opie-9218d2bf841e1f999475c86ba602dc1cd7e338f6.zip opie-9218d2bf841e1f999475c86ba602dc1cd7e338f6.tar.gz opie-9218d2bf841e1f999475c86ba602dc1cd7e338f6.tar.bz2 |
try to improve the icon scaling
-rw-r--r-- | noncore/graphics/opie-eye/gui/iconview.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/noncore/graphics/opie-eye/gui/iconview.cpp b/noncore/graphics/opie-eye/gui/iconview.cpp index f173ecc..5472ead 100644 --- a/noncore/graphics/opie-eye/gui/iconview.cpp +++ b/noncore/graphics/opie-eye/gui/iconview.cpp | |||
@@ -105,26 +105,29 @@ namespace { | |||
105 | } | 105 | } |
106 | } | 106 | } |
107 | check_pix(); | 107 | check_pix(); |
108 | } | 108 | } |
109 | 109 | ||
110 | inline void IconViewItem::check_pix()const | 110 | inline void IconViewItem::check_pix()const |
111 | { | 111 | { |
112 | if (_dirPix && _dirPix->width()>m_iconsize) { | 112 | if (_dirPix && _dirPix->width()>m_iconsize) { |
113 | QPixmap*Pix = new QPixmap(*_dirPix); | 113 | QImage Pix = _dirPix->convertToImage(); |
114 | Pix->resize(m_iconsize,m_iconsize); | 114 | *_dirPix = Pix.smoothScale(m_iconsize,m_iconsize); |
115 | delete _dirPix; | ||
116 | _dirPix = Pix; | ||
117 | } | 115 | } |
118 | if (!_cpyPix && _unkPix) { | 116 | if (!_cpyPix && _unkPix) { |
119 | if (_unkPix->width()>=m_iconsize) { | 117 | if (_unkPix->width()>=m_iconsize) { |
120 | _cpyPix = new QPixmap(*_unkPix); | 118 | QImage Pix = _unkPix->convertToImage(); |
121 | if (_unkPix->width()>m_iconsize) | 119 | _cpyPix = new QPixmap(); |
122 | _cpyPix->resize(m_iconsize,m_iconsize); | 120 | if (_unkPix->width()>m_iconsize) { |
121 | *_cpyPix = Pix.smoothScale(m_iconsize,m_iconsize); | ||
122 | } else { | ||
123 | _cpyPix->convertFromImage(Pix); | ||
124 | } | ||
125 | |||
123 | } else { | 126 | } else { |
124 | _cpyPix = new QPixmap(m_iconsize,m_iconsize); | 127 | _cpyPix = new QPixmap(m_iconsize,m_iconsize); |
125 | _cpyPix->fill(); | 128 | _cpyPix->fill(); |
126 | QPainter pa(_cpyPix); | 129 | QPainter pa(_cpyPix); |
127 | int offset = (m_iconsize-_unkPix->width())/2; | 130 | int offset = (m_iconsize-_unkPix->width())/2; |
128 | int offy = (m_iconsize-_unkPix->height())/2; | 131 | int offy = (m_iconsize-_unkPix->height())/2; |
129 | if (offy<0) offy=0; | 132 | if (offy<0) offy=0; |
130 | pa.drawPixmap(offset,offy,*_unkPix); | 133 | pa.drawPixmap(offset,offy,*_unkPix); |