summaryrefslogtreecommitdiff
path: root/libopie2/opiemm/oimagescrollview.cpp
Unidiff
Diffstat (limited to 'libopie2/opiemm/oimagescrollview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiemm/oimagescrollview.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/libopie2/opiemm/oimagescrollview.cpp b/libopie2/opiemm/oimagescrollview.cpp
index 10da823..76f50e1 100644
--- a/libopie2/opiemm/oimagescrollview.cpp
+++ b/libopie2/opiemm/oimagescrollview.cpp
@@ -202,12 +202,13 @@ void OImageScrollView::setAutoScale(bool how)
202{ 202{
203 m_states.setBit(AUTO_SCALE,how); 203 m_states.setBit(AUTO_SCALE,how);
204 _image_data = QImage(); 204 _image_data = QImage();
205 if (ImageIsJpeg() && how == false && ImageScaledLoaded()==true) { 205 if (ImageIsJpeg() && how == false && ImageScaledLoaded()==true) {
206 loadJpeg(true); 206 loadJpeg(true);
207 } 207 }
208 _newImage = true;
208 generateImage(); 209 generateImage();
209} 210}
210 211
211bool OImageScrollView::AutoScale()const 212bool OImageScrollView::AutoScale()const
212{ 213{
213 return m_states.testBit(AUTO_SCALE); 214 return m_states.testBit(AUTO_SCALE);
@@ -345,14 +346,16 @@ void OImageScrollView::rotate_into_data(Rotation r)
345 _image_data = dest; 346 _image_data = dest;
346} 347}
347 348
348// yes - sorry - it is NOT gamma it is just BRIGHTNESS. Alwin 349// yes - sorry - it is NOT gamma it is just BRIGHTNESS. Alwin
349void OImageScrollView::apply_gamma(int aValue) 350void OImageScrollView::apply_gamma(int aValue)
350{ 351{
351 if (!_image_data.size().isValid()) return; 352 if (aValue==0 || !_image_data.size().isValid()) return;
352 float percent = ((float)aValue/100.0); 353 float percent = ((float)aValue/100.0);
354 /* make sure working on a copy */
355 _image_data.detach();
353 356
354 int segColors = _image_data.depth() > 8 ? 256 : _image_data.numColors(); 357 int segColors = _image_data.depth() > 8 ? 256 : _image_data.numColors();
355 /* must be - otherwise it displays some ... strange colors */ 358 /* must be - otherwise it displays some ... strange colors */
356 if (segColors<256) segColors=256; 359 if (segColors<256) segColors=256;
357 360
358 unsigned char *segTbl = new unsigned char[segColors]; 361 unsigned char *segTbl = new unsigned char[segColors];