Queue_t * queueDoubleResize(Queue_t * queue, bool freeOld) { Queue_t * newQueue = queueResize(queue, queue->size * 2); if (freeOld) { queueDestroy(queue); } return newQueue; }
QueueClass *queueInit(QueueClass *queue, int elementSize, int elementMaxCount) { mutexInit(&queue->writeMutex); mutexInit(&queue->readMutex); eventSourceInit(&queue->writeEventSource); eventSourceInit(&queue->readEventSource); queue->elementSize = elementSize; queue->elementMaxCount = 0; queue->buffer = NULL; queueResize(queue, elementMaxCount); return queue; }
void CqFramebuffer::disconnect() { Fl::lock(); if(m_associatedImage) { boost::function<void(int,int,int,int)> f; m_associatedImage->setUpdateCallback(f); } //label(""); boost::shared_ptr<CqImage> t; m_associatedImage = t; m_uiImageWidget->setImage(t); queueResize(); Fl::unlock(); }
void CqFramebuffer::connect(boost::shared_ptr<CqImage>& image) { disconnect(); m_associatedImage = image; Fl::lock(); m_uiImageWidget->setImage(image); queueResize(); // update window title boost::function<void(int,int,int,int)> f; f = boost::bind(&CqFramebuffer::update, this, _1, _2, _3, _4); image->setUpdateCallback(f); Fl::unlock(); }
void CqFramebuffer::incSubImage(bool increase) { boost::shared_ptr<Aqsis::CqImage>& image = m_uiImageWidget->image(); if(!image) return; // Reset zoom level for safety. /// \todo Fix this when we get a proper image zooming widget! image->setZoom(1); if(increase) image->loadNextSubImage(); else image->loadPrevSubImage(); m_scroll->redraw(); queueResize(); }
void CqFramebuffer::incZoom(TqInt increment) { boost::shared_ptr<Aqsis::CqImage>& image = m_uiImageWidget->image(); if(!image) return; TqInt newZoom = image->zoom() + increment; // Only zoom if the new image will be "small enough". /// \todo This restriction should be lifted once we fix the zoom support with a proper image zooming widget. if( newZoom > 0 && (increment < 0 || newZoom * image->imageWidth() * image->imageHeight() < 8000*8000) ) { image->setZoom(newZoom); m_scroll->redraw(); queueResize(); } }