author | alwin <alwin> | 2004-04-15 07:44:42 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-15 07:44:42 (UTC) |
commit | 41203805fb5e70df84cc2894dbd6e030c6355041 (patch) (unidiff) | |
tree | 3bffe09aeff1a69d9912193c481a2effe990d5db /libopie2 | |
parent | 20175bc18b278426c80ff890853cbf54839f88be (diff) | |
download | opie-41203805fb5e70df84cc2894dbd6e030c6355041.zip opie-41203805fb5e70df84cc2894dbd6e030c6355041.tar.gz opie-41203805fb5e70df84cc2894dbd6e030c6355041.tar.bz2 |
using other values when scaled loading of jpegs
-rw-r--r-- | libopie2/opiemm/oimagescrollview.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiemm/oimagescrollview.cpp b/libopie2/opiemm/oimagescrollview.cpp index 0e86bd0..68b06af 100644 --- a/libopie2/opiemm/oimagescrollview.cpp +++ b/libopie2/opiemm/oimagescrollview.cpp | |||
@@ -51,97 +51,97 @@ OImageScrollView::OImageScrollView (const QImage&img, QWidget * parent, const ch | |||
51 | init(); | 51 | init(); |
52 | } | 52 | } |
53 | 53 | ||
54 | OImageScrollView::OImageScrollView (const QString&img, QWidget * parent, const char * name, WFlags f,bool always_scale,bool rfit) | 54 | OImageScrollView::OImageScrollView (const QString&img, QWidget * parent, const char * name, WFlags f,bool always_scale,bool rfit) |
55 | :QScrollView(parent,name,f|Qt::WRepaintNoErase),_image_data(),_original_data(),m_states(SCROLLVIEW_BITSET_SIZE),m_lastName("") | 55 | :QScrollView(parent,name,f|Qt::WRepaintNoErase),_image_data(),_original_data(),m_states(SCROLLVIEW_BITSET_SIZE),m_lastName("") |
56 | { | 56 | { |
57 | _zoomer = 0; | 57 | _zoomer = 0; |
58 | m_states.resize(SCROLLVIEW_BITSET_SIZE); | 58 | m_states.resize(SCROLLVIEW_BITSET_SIZE); |
59 | m_states[AUTO_SCALE]=always_scale; | 59 | m_states[AUTO_SCALE]=always_scale; |
60 | m_states[AUTO_ROTATE]=rfit; | 60 | m_states[AUTO_ROTATE]=rfit; |
61 | m_states[FIRST_RESIZE_DONE]=false; | 61 | m_states[FIRST_RESIZE_DONE]=false; |
62 | m_states[IMAGE_IS_JPEG]=false; | 62 | m_states[IMAGE_IS_JPEG]=false; |
63 | m_states[IMAGE_SCALED_LOADED]=false; | 63 | m_states[IMAGE_SCALED_LOADED]=false; |
64 | m_states[SHOW_ZOOMER]=true; | 64 | m_states[SHOW_ZOOMER]=true; |
65 | init(); | 65 | init(); |
66 | setImage(img); | 66 | setImage(img); |
67 | } | 67 | } |
68 | 68 | ||
69 | void OImageScrollView::setImage(const QImage&img) | 69 | void OImageScrollView::setImage(const QImage&img) |
70 | { | 70 | { |
71 | _image_data = QImage(); | 71 | _image_data = QImage(); |
72 | _original_data=img; | 72 | _original_data=img; |
73 | _original_data.convertDepth(QPixmap::defaultDepth()); | 73 | _original_data.convertDepth(QPixmap::defaultDepth()); |
74 | _original_data.setAlphaBuffer(false); | 74 | _original_data.setAlphaBuffer(false); |
75 | m_lastName = ""; | 75 | m_lastName = ""; |
76 | setImageIsJpeg(false); | 76 | setImageIsJpeg(false); |
77 | setImageScaledLoaded(false); | 77 | setImageScaledLoaded(false); |
78 | if (FirstResizeDone()) { | 78 | if (FirstResizeDone()) { |
79 | generateImage(); | 79 | generateImage(); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | void OImageScrollView::loadJpeg(bool interncall) | 83 | void OImageScrollView::loadJpeg(bool interncall) |
84 | { | 84 | { |
85 | if (m_lastName.isEmpty()) return; | 85 | if (m_lastName.isEmpty()) return; |
86 | QImageIO iio( m_lastName, 0l ); | 86 | QImageIO iio( m_lastName, 0l ); |
87 | QString param; | 87 | QString param; |
88 | bool real_load = false; | 88 | bool real_load = false; |
89 | if (AutoScale()) { | 89 | if (AutoScale()) { |
90 | if (!interncall) { | 90 | if (!interncall) { |
91 | int wid, hei; | 91 | int wid, hei; |
92 | wid = QApplication::desktop()->width(); | 92 | wid = QApplication::desktop()->width(); |
93 | hei = QApplication::desktop()->height(); | 93 | hei = QApplication::desktop()->height(); |
94 | if (hei>wid) { | 94 | if (hei>wid) { |
95 | wid = hei; | 95 | wid = hei; |
96 | } else { | 96 | } else { |
97 | hei = wid; | 97 | hei = wid; |
98 | } | 98 | } |
99 | param = QString( "Fast Shrink( 7 ) Scale( %1, %2, ScaleFree)" ).arg( wid ).arg( hei ); | 99 | param = QString( "Fast Shrink( 3 ) Scale( %1, %2, ScaleFree)" ).arg( wid ).arg( hei ); |
100 | odebug << "Load jpeg scaled \"" << param << "\"" << oendl; | 100 | odebug << "Load jpeg scaled \"" << param << "\"" << oendl; |
101 | iio.setParameters(param.latin1()); | 101 | iio.setParameters(param.latin1()); |
102 | setImageScaledLoaded(true); | 102 | setImageScaledLoaded(true); |
103 | real_load = true; | 103 | real_load = true; |
104 | } | 104 | } |
105 | } else { | 105 | } else { |
106 | if (ImageScaledLoaded()||!interncall) { | 106 | if (ImageScaledLoaded()||!interncall) { |
107 | odebug << "Load jpeg unscaled" << oendl; | 107 | odebug << "Load jpeg unscaled" << oendl; |
108 | real_load = true; | 108 | real_load = true; |
109 | } | 109 | } |
110 | setImageScaledLoaded(false); | 110 | setImageScaledLoaded(false); |
111 | } | 111 | } |
112 | if (real_load) { | 112 | if (real_load) { |
113 | { | 113 | { |
114 | QCopEnvelope( "QPE/System", "busy()" ); | 114 | QCopEnvelope( "QPE/System", "busy()" ); |
115 | } | 115 | } |
116 | _original_data = iio.read() ? iio.image() : QImage(); | 116 | _original_data = iio.read() ? iio.image() : QImage(); |
117 | { | 117 | { |
118 | QCopEnvelope env( "QPE/System", "notBusy(QString)" ); | 118 | QCopEnvelope env( "QPE/System", "notBusy(QString)" ); |
119 | env << "Image loaded"; | 119 | env << "Image loaded"; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | } | 122 | } |
123 | 123 | ||
124 | void OImageScrollView::setImage( const QString& path ) { | 124 | void OImageScrollView::setImage( const QString& path ) { |
125 | odebug << "load new image " << oendl; | 125 | odebug << "load new image " << oendl; |
126 | if (m_lastName == path) return; | 126 | if (m_lastName == path) return; |
127 | m_lastName = path; | 127 | m_lastName = path; |
128 | QString itype = QImage::imageFormat(m_lastName); | 128 | QString itype = QImage::imageFormat(m_lastName); |
129 | odebug << "Image type = " << itype << oendl; | 129 | odebug << "Image type = " << itype << oendl; |
130 | if (itype == "JPEG") { | 130 | if (itype == "JPEG") { |
131 | setImageIsJpeg(true); | 131 | setImageIsJpeg(true); |
132 | loadJpeg(); | 132 | loadJpeg(); |
133 | } else { | 133 | } else { |
134 | { | 134 | { |
135 | QCopEnvelope( "QPE/System", "busy()" ); | 135 | QCopEnvelope( "QPE/System", "busy()" ); |
136 | } | 136 | } |
137 | setImageIsJpeg(false); | 137 | setImageIsJpeg(false); |
138 | _original_data.load(path); | 138 | _original_data.load(path); |
139 | _original_data.convertDepth(QPixmap::defaultDepth()); | 139 | _original_data.convertDepth(QPixmap::defaultDepth()); |
140 | _original_data.setAlphaBuffer(false); | 140 | _original_data.setAlphaBuffer(false); |
141 | { | 141 | { |
142 | QCopEnvelope env( "QPE/System", "notBusy(QString)" ); | 142 | QCopEnvelope env( "QPE/System", "notBusy(QString)" ); |
143 | env << "Image loaded"; | 143 | env << "Image loaded"; |
144 | } | 144 | } |
145 | } | 145 | } |
146 | _image_data = QImage(); | 146 | _image_data = QImage(); |
147 | if (FirstResizeDone()) { | 147 | if (FirstResizeDone()) { |