summaryrefslogtreecommitdiff
authoralwin <alwin>2005-03-24 11:34:36 (UTC)
committer alwin <alwin>2005-03-24 11:34:36 (UTC)
commitc635023dd68edd0cb0cbb2827b926f33e27e0404 (patch) (unidiff)
tree199e63c6e873398696d705c7d44a0854e3d49872
parent108720c1f24c31e67ccc0225073a726d5edd81ae (diff)
downloadopie-c635023dd68edd0cb0cbb2827b926f33e27e0404.zip
opie-c635023dd68edd0cb0cbb2827b926f33e27e0404.tar.gz
opie-c635023dd68edd0cb0cbb2827b926f33e27e0404.tar.bz2
- removed a lot of useless debugoutput
- fixed a small display problem
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--libopie2/opiemm/oimagescrollview.cpp30
1 files changed, 14 insertions, 16 deletions
diff --git a/libopie2/opiemm/oimagescrollview.cpp b/libopie2/opiemm/oimagescrollview.cpp
index 58a9748..10da823 100644
--- a/libopie2/opiemm/oimagescrollview.cpp
+++ b/libopie2/opiemm/oimagescrollview.cpp
@@ -105,7 +105,6 @@ void OImageScrollView::loadJpeg(bool interncall)
105 } 105 }
106 if ( (scanned && (wid<xf.getWidth()||hei<xf.getHeight()))||!scanned ) { 106 if ( (scanned && (wid<xf.getWidth()||hei<xf.getHeight()))||!scanned ) {
107 param = QString( "Fast Shrink( 3 ) Scale( %1, %2, ScaleMin)" ).arg( wid ).arg( hei ); 107 param = QString( "Fast Shrink( 3 ) Scale( %1, %2, ScaleMin)" ).arg( wid ).arg( hei );
108 odebug << "Load jpeg scaled \"" << param << "\"" << oendl;
109 iio.setParameters(param.latin1()); 108 iio.setParameters(param.latin1());
110 setImageScaledLoaded(true); 109 setImageScaledLoaded(true);
111 } 110 }
@@ -114,7 +113,6 @@ void OImageScrollView::loadJpeg(bool interncall)
114 } 113 }
115 } else { 114 } else {
116 if (ImageScaledLoaded()||!interncall) { 115 if (ImageScaledLoaded()||!interncall) {
117 odebug << "Load jpeg unscaled" << oendl;
118 real_load = true; 116 real_load = true;
119 } 117 }
120 setImageScaledLoaded(false); 118 setImageScaledLoaded(false);
@@ -125,13 +123,11 @@ void OImageScrollView::loadJpeg(bool interncall)
125} 123}
126 124
127void OImageScrollView::setImage( const QString& path ) { 125void OImageScrollView::setImage( const QString& path ) {
128 odebug << "load new image " << oendl;
129 if (m_lastName == path) return; 126 if (m_lastName == path) return;
130 m_lastName = path; 127 m_lastName = path;
131 _newImage = true; 128 _newImage = true;
132 _original_data = QImage(); 129 _original_data = QImage();
133 QString itype = QImage::imageFormat(m_lastName); 130 QString itype = QImage::imageFormat(m_lastName);
134 odebug << "Image type = " << itype << oendl;
135 if (itype == "JPEG") { 131 if (itype == "JPEG") {
136 setImageIsJpeg(true); 132 setImageIsJpeg(true);
137 loadJpeg(); 133 loadJpeg();
@@ -151,8 +147,6 @@ void OImageScrollView::setImage( const QString& path ) {
151/* should be called every time the QImage changed it content */ 147/* should be called every time the QImage changed it content */
152void OImageScrollView::init() 148void OImageScrollView::init()
153{ 149{
154 odebug << "init " << oendl;
155
156 /* 150 /*
157 * create the zoomer 151 * create the zoomer
158 * and connect ther various signals 152 * and connect ther various signals
@@ -351,26 +345,34 @@ void OImageScrollView::rotate_into_data(Rotation r)
351 _image_data = dest; 345 _image_data = dest;
352} 346}
353 347
348// yes - sorry - it is NOT gamma it is just BRIGHTNESS. Alwin
354void OImageScrollView::apply_gamma(int aValue) 349void OImageScrollView::apply_gamma(int aValue)
355{ 350{
356 if (!_image_data.size().isValid()) return; 351 if (!_image_data.size().isValid()) return;
357 float percent = ((float)aValue/100); 352 float percent = ((float)aValue/100.0);
358 odebug << "Apply gamma " << percent << oendl; 353
359 int pixels = _image_data.depth()>8?_image_data.width()*_image_data.height() : _image_data.numColors();
360 int segColors = _image_data.depth() > 8 ? 256 : _image_data.numColors(); 354 int segColors = _image_data.depth() > 8 ? 256 : _image_data.numColors();
355 /* must be - otherwise it displays some ... strange colors */
356 if (segColors<256) segColors=256;
357
361 unsigned char *segTbl = new unsigned char[segColors]; 358 unsigned char *segTbl = new unsigned char[segColors];
359 int pixels = _image_data.depth()>8?_image_data.width()*_image_data.height() : _image_data.numColors();
360
361
362 bool brighten = (percent >= 0); 362 bool brighten = (percent >= 0);
363 if ( percent < 0 ) 363 if ( percent < 0 ) {
364 percent = -percent; 364 percent = -percent;
365 }
365 366
366 unsigned int *data = _image_data.depth() > 8 ? (unsigned int *)_image_data.bits() : 367 unsigned int *data = _image_data.depth() > 8 ? (unsigned int *)_image_data.bits() :
367 (unsigned int *)_image_data.colorTable(); 368 (unsigned int *)_image_data.colorTable();
368 369
370 int tmp = 0;
369 371
370 if (brighten) { 372 if (brighten) {
371 for ( int i=0; i < segColors; ++i ) 373 for ( int i=0; i < segColors; ++i )
372 { 374 {
373 int tmp = (int)(i*percent); 375 tmp = (int)(i*percent);
374 if ( tmp > 255 ) 376 if ( tmp > 255 )
375 tmp = 255; 377 tmp = 255;
376 segTbl[i] = tmp; 378 segTbl[i] = tmp;
@@ -378,7 +380,7 @@ void OImageScrollView::apply_gamma(int aValue)
378 } else { 380 } else {
379 for ( int i=0; i < segColors; ++i ) 381 for ( int i=0; i < segColors; ++i )
380 { 382 {
381 int tmp = (int)(i*percent); 383 tmp = (int)(i*percent);
382 if ( tmp < 0 ) 384 if ( tmp < 0 )
383 tmp = 0; 385 tmp = 0;
384 segTbl[i] = tmp; 386 segTbl[i] = tmp;
@@ -458,10 +460,8 @@ void OImageScrollView::generateImage()
458 } 460 }
459 461
460 int twidth,theight; 462 int twidth,theight;
461 odebug << " r = " << r << oendl;
462 if (AutoScale() && (_original_data.width()>width() || _original_data.height() > height()) ) { 463 if (AutoScale() && (_original_data.width()>width() || _original_data.height() > height()) ) {
463 if (!_image_data.size().isValid()||width()>_image_data.width()||height()>_image_data.height()) { 464 if (!_image_data.size().isValid()||width()>_image_data.width()||height()>_image_data.height()) {
464 odebug << "Rescaling data" << oendl;
465 if (r==Rotate0) { 465 if (r==Rotate0) {
466 _image_data = _original_data; 466 _image_data = _original_data;
467 } else { 467 } else {
@@ -514,7 +514,6 @@ void OImageScrollView::generateImage()
514 514
515void OImageScrollView::resizeEvent(QResizeEvent * e) 515void OImageScrollView::resizeEvent(QResizeEvent * e)
516{ 516{
517 odebug << "OImageScrollView resizeEvent (" << e->size() << " - " << e->oldSize() << oendl;
518 QScrollView::resizeEvent(e); 517 QScrollView::resizeEvent(e);
519 if (e->oldSize()==e->size()||!isUpdatesEnabled ()) return; 518 if (e->oldSize()==e->size()||!isUpdatesEnabled ()) return;
520 generateImage(); 519 generateImage();
@@ -595,7 +594,6 @@ void OImageScrollView::viewportMouseMoveEvent(QMouseEvent* e)
595 594
596void OImageScrollView::contentsMousePressEvent ( QMouseEvent * e) 595void OImageScrollView::contentsMousePressEvent ( QMouseEvent * e)
597{ 596{
598 odebug << " X and Y " << e->x() << " " << e->y() << oendl;
599 /* this marks the beginning of a possible mouse move. Due internal reasons of QT 597 /* this marks the beginning of a possible mouse move. Due internal reasons of QT
600 the geometry values here may real differ from that set in MoveEvent (I don't know 598 the geometry values here may real differ from that set in MoveEvent (I don't know
601 why). For getting them in real context, we use the first move-event to set the start 599 why). For getting them in real context, we use the first move-event to set the start