summaryrefslogtreecommitdiff
path: root/libopie2/opiemm
authoralwin <alwin>2005-03-24 21:13:40 (UTC)
committer alwin <alwin>2005-03-24 21:13:40 (UTC)
commitb6fc9840f4fe9bad392167c49dbcfa2acda9ed21 (patch) (side-by-side diff)
tree1d7d1225a9c440f5d0608d8901dfd151db8a6f1c /libopie2/opiemm
parent1e6c3181dcc7ec4edbe99db0d886ce7a9c483056 (diff)
downloadopie-b6fc9840f4fe9bad392167c49dbcfa2acda9ed21.zip
opie-b6fc9840f4fe9bad392167c49dbcfa2acda9ed21.tar.gz
opie-b6fc9840f4fe9bad392167c49dbcfa2acda9ed21.tar.bz2
last bugfixes on opie-eye an imagescrollview. Seems that now all is working
as it should.
Diffstat (limited to 'libopie2/opiemm') (more/less context) (show 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
@@ -192,32 +192,33 @@ bool OImageScrollView::AutoRotate()const
return m_states.testBit(AUTO_ROTATE);
}
void OImageScrollView::setAutoScaleRotate(bool scale, bool rotate)
{
m_states.setBit(AUTO_ROTATE,rotate);
setAutoScale(scale);
}
void OImageScrollView::setAutoScale(bool how)
{
m_states.setBit(AUTO_SCALE,how);
_image_data = QImage();
if (ImageIsJpeg() && how == false && ImageScaledLoaded()==true) {
loadJpeg(true);
}
+ _newImage = true;
generateImage();
}
bool OImageScrollView::AutoScale()const
{
return m_states.testBit(AUTO_SCALE);
}
OImageScrollView::~OImageScrollView()
{
}
void OImageScrollView::rescaleImage(int w, int h)
{
if (_image_data.width()==w && _image_data.height()==h) {
return;
@@ -335,34 +336,36 @@ void OImageScrollView::rotate_into_data(Rotation r)
}
}
break;
default:
dest = _original_data;
break;
}
}
_newImage = true;
_image_data = dest;
}
// yes - sorry - it is NOT gamma it is just BRIGHTNESS. Alwin
void OImageScrollView::apply_gamma(int aValue)
{
- if (!_image_data.size().isValid()) return;
+ if (aValue==0 || !_image_data.size().isValid()) return;
float percent = ((float)aValue/100.0);
+ /* make sure working on a copy */
+ _image_data.detach();
int segColors = _image_data.depth() > 8 ? 256 : _image_data.numColors();
/* must be - otherwise it displays some ... strange colors */
if (segColors<256) segColors=256;
unsigned char *segTbl = new unsigned char[segColors];
int pixels = _image_data.depth()>8?_image_data.width()*_image_data.height() : _image_data.numColors();
bool brighten = (percent >= 0);
if ( percent < 0 ) {
percent = -percent;
}
unsigned int *data = _image_data.depth() > 8 ? (unsigned int *)_image_data.bits() :
(unsigned int *)_image_data.colorTable();