slot for updating view with new image in complex zone
Definition at line 1139 of file aimainwindow.cpp. 01140 { 01141 try 01142 { 01143 QMutex mutex; 01144 mutex.lock(); 01145 { 01146 m_storage.replace( zone->getStartPoint(), zone->image() ); 01147 01148 static int count = 0; 01149 count++; 01150 if ( count == m_startedThreads && m_storage.size() > 0 ) 01151 { 01152 QImage tmp; 01153 //~ if screen is empty create a new empty image 01154 if( m_view->view()->emptyScreen() && m_config->getImageWidth() > 0 && m_config->getImageHeight() > 0 ) 01155 { 01156 tmp = QImage(m_config->getImageWidth(), m_config->getImageHeight(), QImage::Format_RGB32); 01157 tmp.fill(Qt::transparent); 01158 } 01159 else if( (m_config->getImageWidth() == 0 || m_config->getImageHeight() == 0) && m_storage.count() > 0 ) 01160 { 01161 tmp = QImage( m_storage[0].width(), m_storage[0].height(), QImage::Format_RGB32); 01162 tmp.fill(Qt::transparent); 01163 } 01164 else //~ get a current screen image for adding to it, a generated image =) 01165 { 01166 tmp = m_view->view()->image(); 01167 } 01168 01169 QPainter painter( &tmp ); 01170 for( int index = 0 ; index < m_storage.size() ; index++ ) 01171 { 01172 if( index == 0 ) 01173 { 01174 //# set to first thread a deferent compsition mode 01175 painter.setCompositionMode( m_firstCompositionModeIndex ); 01176 } 01177 else 01178 { 01179 painter.setCompositionMode( m_othersCompositionModeIndex ); 01180 } 01181 painter.drawImage(0,0, m_storage[ index ] ); 01182 } 01183 painter.end(); 01184 01185 m_view->view()->makeUpdate( tmp, true ); 01186 m_storage.clear(); 01187 01188 //~ enable tools and change status 01189 this->enabledChilds( true ); 01190 m_statusbar->stopGenerating(); 01191 01192 //~ set to zero for next generation 01193 count = 0; 01194 01195 //~ finally clean threads 01196 for( int index = 0 ; index < m_threads.size() ; index++ ) 01197 { 01198 m_threads[ index ]->stop(); 01199 m_threads[ index ]->wait(); 01200 } 01201 01202 //~ new implementation for "God Mode" 01203 01204 if( !m_serialize ) 01205 { 01206 //~ delete them all 01207 for( int index = 0 ; index < m_threads.size() ; index++ ) 01208 { 01209 delete m_threads[ index ]; 01210 } 01211 m_threads.clear(); 01212 } 01213 01214 //# magic bool 01215 m_serialize = false; 01216 //# 01217 01218 //~ end at 01219 this->m_statusbar->end(); 01220 } 01221 } 01222 mutex.unlock(); 01223 01224 } 01225 catch(const std::exception & exception ) 01226 { 01227 QMessageBox::critical(this, tr("Critical Error!"), tr("Please report this problem to adrabi[at]gmail[dot]com =).")); 01228 } 01229 } |