void Widget_remove( Widget* widget ) { for( u32 i = 0; i < widget->childrenCount; ++i ) Widget_remove( widget->children[i] ); if( widget->children ) DEL_PTR( widget->children ); DEL_PTR( widget ); }
void Anim_loadFromFile( Anim *a, const char *file ) { char *file_contents = NULL; cJSON *root = NULL; Byte_ReadFile( &file_contents, file ); check( file_contents, " " ); root = cJSON_Parse( file_contents ); check( root, "JSON parse error [%s] before :\n%s\n", file, cJSON_GetErrorPtr() ); cJSON *frames = cJSON_GetObjectItem( root, "frames" ); check( frames, "Animation '%s' does not have any frame!\n", file ); cJSON *frame_times = cJSON_GetObjectItem( root, "frame_times" ); check( frame_times, "Animation '%s' does not have any frame times!\n", file ); a->frame_n = cJSON_GetArraySize( frames ); int frame_t_n = cJSON_GetArraySize( frame_times ); check( a->frame_n > 0, "Animation '%s' does not have any frame!\n", file ); check( a->frame_n == frame_t_n, "Animation '%s' : entries 'frames' and 'frame_times' must have the same size!\n", file ); a->frames = byte_alloc( a->frame_n * sizeof(vec2) ); a->frame_t = byte_alloc( a->frame_n * sizeof(f32) ); for( int i = 0; i < a->frame_n; ++i ) { cJSON *frame = cJSON_GetArrayItem( frames, i ); cJSON *frame_t = cJSON_GetArrayItem( frame_times, i ); // frames positions are position on a 2048^2 texture. find their relative pos to it : if( frame ) { a->frames[i] = (vec2){ cJSON_GetArrayItem( frame, 0 )->valuedouble / 2048.f, cJSON_GetArrayItem( frame, 1 )->valuedouble / 2048.f }; a->frame_t[i] = frame_t->valuedouble; } } a->curr_t = 0.f; a->curr_n = 0; a->running = false; DEL_PTR( file_contents ); if( root ) cJSON_Delete( root ); return; error: Anim_destroy( a ); DEL_PTR( file_contents ); if( root ) cJSON_Delete( root ); }
void StudySeries::ReleaseSeriesBlankImageObjs() { for (BlankStudyImagesVIt it = m_AllocatedBSIList.begin(); it != m_AllocatedBSIList.end(); it ++) { DEL_PTR(*it); } m_AllocatedBSIList.clear(); }
void StudySeries::ReleaseSeriesCells() { for (StudySeriesCellPosObjMapMapIt it = m_AllocatedSCellPosObjMap.begin(); it != m_AllocatedSCellPosObjMap.end(); it ++) { DEL_PTR (it->second); } m_AllocatedSCellPosObjMap.clear(); }
void SiteWorkRenderTask::ProcessQueue(ACE_Message_Queue<ACE_MT_SYNCH> *pQueue) { if (pQueue == NULL) return; ACE_Time_Value cur;; ACE_Time_Value secds(0); ACE_Message_Block *mb = NULL; const IStudyImage *pIStudyImage = NULL; ImageRenderTaskArgs *pImageRenderTaskArgs = NULL; while (pQueue->is_empty() == false) { cur = ACE_OS::gettimeofday(); cur += secds; int res = pQueue->dequeue_head(mb, &cur); if (res >= 0 && mb) { memcpy(&pImageRenderTaskArgs, mb->rd_ptr(), sizeof(pImageRenderTaskArgs)); pIStudyImage = pImageRenderTaskArgs->pImageOwner; if (pIStudyImage) { if ((pImageRenderTaskArgs->taskFlags) & OPTYPE_RENDER) { pIStudyImage->SyncRenderImageOut(); } if ((pImageRenderTaskArgs->taskFlags) & OPTYPE_REPORT_POSTRENDER_MSG) { IStudyImage *pModStudyImage = const_cast<IStudyImage *>(pIStudyImage); if (pModStudyImage) { ImageStatusMsgNotifier *pMsgNotifier = dynamic_cast<ImageStatusMsgNotifier *>(pModStudyImage); if (pMsgNotifier) { pMsgNotifier->SendPostRenderStatusMsgs(); } } } } DEL_PTR(pImageRenderTaskArgs); mb->release(); } else { break; } } }
void EventManager_destroy() { if( em ) { ListenerArray_destroy( &em->key_listeners ); ListenerArray_destroy( &em->mouse_listeners ); ListenerArray_destroy( &em->resize_listeners ); EventArray_destroy( &em->frame_key_events ); EventArray_destroy( &em->frame_mouse_events ); EventArray_destroy( &em->frame_resize_events ); DEL_PTR( em ); } }
void Renderer_destroy() { if( renderer ) { MeshArray_destroy( &renderer->mMeshes ); TextureArray_destroy( &renderer->mTextures ); ShaderArray_destroy( &renderer->mShaders ); FontArray_destroy( &renderer->mFonts ); SpritesArray_destroy( &renderer->sprites ); StaticsArray_destroy( &renderer->statics ); DEL_PTR( renderer ); } }
void StudySeries::ReleaseSeriesImageObjects() { m_CellAssignedSIMap.clear(); for (StudyImageNameObjMapIt it = m_AllocatedSINameObjsMap.begin(); it != m_AllocatedSINameObjsMap.end(); it ++) { DEL_PTR (it->second); } m_AllocatedSINameObjsMap.clear(); }
void SiteWorkTask::StopTask() { if (_pSiteRenderTask) { _pSiteRenderTask->StopTask(); DEL_PTR(_pSiteRenderTask); } m_bStopped = true; ACE_Message_Block *mb = new ACE_Message_Block(); mb->msg_type( ACE_Message_Block::MB_STOP ); this->putq( mb ); }
inline void Anim_destroy( Anim *a ) { if( a ) { DEL_PTR( a->frame_t ); DEL_PTR( a->frames ); } }
void StudySeries::RearrangeCellImagesOnPersist(int firstCellImageIndex, int cellsCount, int width, int height, bool bCellImageChg) { std::stringstream ssLog; // we need to IStudySeriesImageCell *pImageCell = NULL; std::string strDicomFileName; DicomImageDescription *pDicomImageInfo = NULL; StudyImage *pStudyImage = NULL; BlankStudyImage *pBlankStudyImage = NULL; IStudyImage *pIStudyImage = NULL; DicomImageFrameId dicomImageFrameId; BlankStudyImagesV freeBlankImages = m_AllocatedBSIList; StudyImagePosObjMap oldActiveCellsImages = m_CellAssignedSIMap; m_CellAssignedSIMap.clear(); int curImageIndex = 0; for (int i = 0; i < cellsCount; i ++) { pImageCell = FindImageCellObj(i); if (pImageCell == NULL) return; curImageIndex = NormalizeImageIndex(firstCellImageIndex + i, cellsCount); pDicomImageInfo = m_dicomSeriesDbInfo.QueryDicomImageDescription(curImageIndex); if (pDicomImageInfo == NULL) { if (freeBlankImages.size() > 0) { pIStudyImage = *(freeBlankImages.begin()); if (pIStudyImage == NULL) { continue; } pImageCell->AssignNewStudyImage(pIStudyImage, pDicomImageInfo, width, height); freeBlankImages.erase(freeBlankImages.begin()); continue; } else { pIStudyImage = NewStudyImageObj(i, true); pBlankStudyImage = dynamic_cast<BlankStudyImage *>(pIStudyImage); if (pBlankStudyImage == NULL) { DEL_PTR(pIStudyImage); continue; } pImageCell->AssignNewStudyImage(pIStudyImage, pDicomImageInfo, width, height); m_AllocatedBSIList.push_back(pBlankStudyImage); } } else { strDicomFileName = pDicomImageInfo->FilePath(); dicomImageFrameId.set(strDicomFileName, pDicomImageInfo->DicomFrameIndex()); StudyImageNameObjMapIt findStudyImageIt = m_AllocatedSINameObjsMap.find(dicomImageFrameId); if (findStudyImageIt != m_AllocatedSINameObjsMap.end()) { pIStudyImage = findStudyImageIt->second; if (pIStudyImage == NULL) continue; pImageCell->AssignNewStudyImage(pIStudyImage, pDicomImageInfo, width, height); bool bFound = false; for (StudyImagePosObjMapIt it = oldActiveCellsImages.begin(); it != oldActiveCellsImages.end(); it ++) { if (it->second == pIStudyImage) { bFound = true; oldActiveCellsImages.erase(it); break; } } if (bFound == false) { pIStudyImage->OnShowActive(); } } else { pIStudyImage = NewStudyImageObj(i, false); pStudyImage = dynamic_cast<StudyImage *>(pIStudyImage); if (pStudyImage == NULL) { DEL_PTR(pIStudyImage); continue; } m_AllocatedSINameObjsMap[dicomImageFrameId] = pStudyImage; pImageCell->AssignNewStudyImage(pIStudyImage, pDicomImageInfo, width, height); } ssLog.str(""); ssLog << std::hex << pImageCell << "(" << i << ") " << " to host " << pStudyImage; LOG_DEBUG(ssLog.str()); } m_CellAssignedSIMap[i] = pIStudyImage; } for (StudyImagePosObjMapIt it = oldActiveCellsImages.begin(); it != oldActiveCellsImages.end(); it ++) { it->second->OnShowDeactive(); } OnRearrangeCellImagesDone(bCellImageChg); }