void GLU_APIENTRY gluTessVertex(GLUtesselator* tess, GLfloat coords[3], void* data) { int i; int tooLarge=FALSE; GLfloat x, clamped[3]; RequireState(tess, T_IN_CONTOUR); if (tess->emptyCache) { if (!EmptyCache(tess)) { CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY ); return; } tess->lastEdge=NULL; } for (i=0; i<3; ++i) { x=coords[i]; if (x<-GLU_TESS_MAX_COORD) { x=-GLU_TESS_MAX_COORD; tooLarge=TRUE; } if (x>GLU_TESS_MAX_COORD) { x=GLU_TESS_MAX_COORD; tooLarge=TRUE; } clamped[i]=x; } if (tooLarge) { CALL_ERROR_OR_ERROR_DATA(GLU_TESS_COORD_TOO_LARGE); } if (tess->mesh==NULL) { if (tess->cacheCount<TESS_MAX_CACHE) { CacheVertex(tess, clamped, data); return; } if (!EmptyCache(tess)) { CALL_ERROR_OR_ERROR_DATA(GLU_OUT_OF_MEMORY); return; } } if (!AddVertex(tess, clamped, data)) { CALL_ERROR_OR_ERROR_DATA(GLU_OUT_OF_MEMORY); } }
void REGALWRATH_GLU_CALL wrath_gluTessVertex( wrath_GLUtesselator *tess, const double coords[3], void *data ) { int i, tooLarge = FALSE; double x, clamped[3]; RequireState( tess, T_IN_CONTOUR ); if( tess->emptyCache ) { if ( !EmptyCache( tess ) ) { CALL_ERROR_OR_ERROR_DATA( WRATH_GLU_OUT_OF_MEMORY ); return; } tess->lastEdge = NULL; } for( i = 0; i < 3; ++i ) { x = coords[i]; if( x < - WRATH_GLU_TESS_MAX_COORD ) { x = - WRATH_GLU_TESS_MAX_COORD; tooLarge = TRUE; } if( x > WRATH_GLU_TESS_MAX_COORD ) { x = WRATH_GLU_TESS_MAX_COORD; tooLarge = TRUE; } clamped[i] = x; } if( tooLarge ) { CALL_ERROR_OR_ERROR_DATA( WRATH_GLU_TESS_COORD_TOO_LARGE ); } if( tess->mesh == NULL ) { if( tess->cacheCount < TESS_MAX_CACHE ) { CacheVertex( tess, clamped, data ); return; } if ( !EmptyCache( tess ) ) { CALL_ERROR_OR_ERROR_DATA( WRATH_GLU_OUT_OF_MEMORY ); return; } } if ( !AddVertex( tess, clamped, data ) ) { CALL_ERROR_OR_ERROR_DATA( WRATH_GLU_OUT_OF_MEMORY ); } }
bool localDrive::FindFirst(char * _dir,DOS_DTA & dta,bool fcb_findfirst) { char tempDir[CROSS_LEN]; strcpy(tempDir,basedir); strcat(tempDir,_dir); CROSS_FILENAME(tempDir); if (allocation.mediaid==0xF0 ) { EmptyCache(); //rescan floppie-content on each findfirst } char end[2]={CROSS_FILESPLIT,0}; if (tempDir[strlen(tempDir)-1]!=CROSS_FILESPLIT) strcat(tempDir,end); Bit16u id; if (!dirCache.FindFirst(tempDir,id)) { DOS_SetError(DOSERR_PATH_NOT_FOUND); return false; } strcpy(srchInfo[id].srch_dir,tempDir); dta.SetDirID(id); Bit8u sAttr; dta.GetSearchParams(sAttr,tempDir); if (this->isRemote() && this->isRemovable()) { // cdroms behave a bit different than regular drives if (sAttr == DOS_ATTR_VOLUME) { dta.SetResult(dirCache.GetLabel(),0,0,0,DOS_ATTR_VOLUME); return true; } } else { if (sAttr == DOS_ATTR_VOLUME) { if ( strcmp(dirCache.GetLabel(), "") == 0 ) { // LOG(LOG_DOSMISC,LOG_ERROR)("DRIVELABEL REQUESTED: none present, returned NOLABEL"); // dta.SetResult("NO_LABEL",0,0,0,DOS_ATTR_VOLUME); // return true; DOS_SetError(DOSERR_NO_MORE_FILES); return false; } dta.SetResult(dirCache.GetLabel(),0,0,0,DOS_ATTR_VOLUME); return true; } else if ((sAttr & DOS_ATTR_VOLUME) && (*_dir == 0) && !fcb_findfirst) { //should check for a valid leading directory instead of 0 //exists==true if the volume label matches the searchmask and the path is valid if (WildFileCmp(dirCache.GetLabel(),tempDir)) { dta.SetResult(dirCache.GetLabel(),0,0,0,DOS_ATTR_VOLUME); return true; } } } return FindNext(dta); }
void REGALFASTUIDRAW_GLU_CALL fastuidraw_gluTessVertex( fastuidraw_GLUtesselator *tess, double x, double y, unsigned int data ) { int tooLarge = FALSE; RequireState( tess, T_IN_CONTOUR ); if( tess->emptyCache ) { if ( !EmptyCache( tess ) ) { CALL_ERROR_OR_ERROR_DATA( FASTUIDRAW_GLU_OUT_OF_MEMORY ); return; } tess->lastEdge = NULL; } checkTooLarge(&x, &tooLarge); checkTooLarge(&y, &tooLarge); if( tooLarge ) { CALL_ERROR_OR_ERROR_DATA( FASTUIDRAW_GLU_TESS_COORD_TOO_LARGE ); } if( tess->mesh == NULL ) { if( tess->cacheCount < TESS_MAX_CACHE ) { CacheVertex( tess, x, y, data ); return; } if ( !EmptyCache( tess ) ) { CALL_ERROR_OR_ERROR_DATA( FASTUIDRAW_GLU_OUT_OF_MEMORY ); return; } } if ( !AddVertex( tess, x, y, data ) ) { CALL_ERROR_OR_ERROR_DATA( FASTUIDRAW_GLU_OUT_OF_MEMORY ); } }
void REGALGLU_CALL gluTessEndPolygon( GLUtesselator *tess ) { GLUmesh *mesh; if (setjmp(tess->env) != 0) { /* come back here if out of memory */ CALL_ERROR_OR_ERROR_DATA( GLU_OUT_OF_MEMORY ); return; } RequireState( tess, T_IN_POLYGON ); tess->state = T_DORMANT; if( tess->mesh == NULL ) { if( ! tess->flagBoundary && tess->callMesh == &noMesh ) { /* Try some special code to make the easy cases go quickly * (eg. convex polygons). This code does NOT handle multiple contours, * intersections, edge flags, and of course it does not generate * an explicit mesh either. */ if( __gl_renderCache( tess )) { tess->polygonData= NULL; return; } } if ( !EmptyCache( tess ) ) longjmp(tess->env,1); /* could've used a label*/ } /* Determine the polygon normal and project vertices onto the plane * of the polygon. */ __gl_projectPolygon( tess ); /* __gl_computeInterior( tess ) computes the planar arrangement specified * by the given contours, and further subdivides this arrangement * into regions. Each region is marked "inside" if it belongs * to the polygon, according to the rule given by tess->windingRule. * Each interior region is guaranteed be monotone. */ if ( !__gl_computeInterior( tess ) ) { longjmp(tess->env,1); /* could've used a label */ } mesh = tess->mesh; if( ! tess->fatalError ) { int rc = 1; /* If the user wants only the boundary contours, we throw away all edges * except those which separate the interior from the exterior. * Otherwise we tessellate all the regions marked "inside". */ if( tess->boundaryOnly ) { rc = __gl_meshSetWindingNumber( mesh, 1, TRUE ); } else { rc = __gl_meshTessellateInterior( mesh ); } if (rc == 0) longjmp(tess->env,1); /* could've used a label */ __gl_meshCheckMesh( mesh ); if( tess->callBegin != &noBegin || tess->callEnd != &noEnd || tess->callVertex != &noVertex || tess->callEdgeFlag != &noEdgeFlag || tess->callBeginData != &__gl_noBeginData || tess->callEndData != &__gl_noEndData || tess->callVertexData != &__gl_noVertexData || tess->callEdgeFlagData != &__gl_noEdgeFlagData ) { if( tess->boundaryOnly ) { __gl_renderBoundary( tess, mesh ); /* output boundary contours */ } else { __gl_renderMesh( tess, mesh ); /* output strips and fans */ } } if( tess->callMesh != &noMesh ) { /* Throw away the exterior faces, so that all faces are interior. * This way the user doesn't have to check the "inside" flag, * and we don't need to even reveal its existence. It also leaves * the freedom for an implementation to not generate the exterior * faces in the first place. */ __gl_meshDiscardExterior( mesh ); (*tess->callMesh)( mesh ); /* user wants the mesh itself */ tess->mesh = NULL; tess->polygonData= NULL; return; } } __gl_meshDeleteMesh( mesh ); tess->polygonData= NULL; tess->mesh = NULL; }
void CBOINCBaseView::OnListRender(wxTimerEvent& event) { if (!m_bProcessingListRenderEvent) { m_bProcessingListRenderEvent = true; wxASSERT(m_pListPane); // Remember the key values of currently selected items SaveSelections(); int iDocCount = GetDocCount(); int iCacheCount = GetCacheCount(); if (iDocCount != iCacheCount) { if (0 >= iDocCount) { EmptyCache(); m_pListPane->DeleteAllItems(); } else { int iIndex = 0; int iReturnValue = -1; if (iDocCount > iCacheCount) { for (iIndex = 0; iIndex < (iDocCount - iCacheCount); iIndex++) { iReturnValue = AddCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); m_pListPane->SetItemCount(iDocCount); m_bNeedSort = true; } else { // The virtual ListCtrl keeps a separate its list of selected rows; // make sure it does not reference any rows beyond the new last row. // We can ClearSelections() because we called SaveSelections() above. ClearSelections(); m_pListPane->SetItemCount(iDocCount); for (iIndex = (iCacheCount - 1); iIndex >= iDocCount; --iIndex) { iReturnValue = RemoveCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); m_pListPane->RefreshItems(0, iDocCount - 1); m_bNeedSort = true; } } } if (iDocCount > 0) { SynchronizeCache(); if (iDocCount > 1) { if (_EnsureLastItemVisible() && (iDocCount != iCacheCount)) { m_pListPane->EnsureVisible(iDocCount - 1); } } if (m_pListPane->m_bIsSingleSelection) { // If no item has been selected yet, select the first item. #ifdef __WXMSW__ if ((m_pListPane->GetSelectedItemCount() == 0) && (m_pListPane->GetItemCount() >= 1)) { long desiredstate = wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED; m_pListPane->SetItemState(0, desiredstate, desiredstate); } #else if ((m_pListPane->GetFirstSelected() < 0) && (m_pListPane->GetItemCount() >= 1)) { m_pListPane->SetItemState(0, wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED, wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED); } #endif } } // Find the previously selected items by their key values and reselect them RestoreSelections(); UpdateSelection(); m_bProcessingListRenderEvent = false; } event.Skip(); }
CViewWork::~CViewWork() { EmptyCache(); EmptyTasks(); }
CViewTransfers::~CViewTransfers() { EmptyCache(); EmptyTasks(); }
void CBOINCBaseView::OnListRender(wxTimerEvent& event) { if (!m_bProcessingListRenderEvent) { m_bProcessingListRenderEvent = true; wxASSERT(m_pListPane); // Remember the key values of currently selected items SaveSelections(); int iDocCount = GetDocCount(); int iCacheCount = GetCacheCount(); if (iDocCount != iCacheCount) { if (0 >= iDocCount) { EmptyCache(); m_pListPane->DeleteAllItems(); } else { int iIndex = 0; int iReturnValue = -1; if (iDocCount > iCacheCount) { for (iIndex = 0; iIndex < (iDocCount - iCacheCount); iIndex++) { iReturnValue = AddCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); m_pListPane->SetItemCount(iDocCount); m_bNeedSort = true; } else { // The virtual ListCtrl keeps a separate its list of selected rows; // make sure it does not reference any rows beyond the new last row. // We can ClearSelections() because we called SaveSelections() above. ClearSelections(); m_pListPane->SetItemCount(iDocCount); for (iIndex = (iCacheCount - 1); iIndex >= iDocCount; --iIndex) { iReturnValue = RemoveCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); //fprintf(stderr, "CBOINCBaseView::OnListRender(): m_pListPane->RefreshItems(0, %d)\n", iDocCount - 1); m_pListPane->RefreshItems(0, iDocCount - 1); #ifdef __WXGTK__ // Work around an apparent bug in wxWidgets 3.0 // which drew blank lines at the top and failed // to draw the bottom items. This could happen // if the list was scrolled near the bottom and // the user selected "Show active tasks." m_pListPane->EnsureVisible(iDocCount - 1); #endif m_bNeedSort = true; } } } if (iDocCount > 0) { SynchronizeCache(); if (iDocCount > 1) { if (_EnsureLastItemVisible() && (iDocCount != iCacheCount)) { m_pListPane->EnsureVisible(iDocCount - 1); } } } // Find the previously selected items by their key values and reselect them RestoreSelections(); UpdateSelection(); m_bProcessingListRenderEvent = false; } event.Skip(); }
CViewProjects::~CViewProjects() { EmptyCache(); EmptyTasks(); }
CQSLItemList::~CQSLItemList() { //#ifndef USECACHE EmptyCache(); //#endif }
void CBOINCBaseView::OnListRender(wxTimerEvent& event) { if (!m_bProcessingListRenderEvent) { m_bProcessingListRenderEvent = true; wxASSERT(m_pListPane); // Remember the key values of currently selected items SaveSelections(); int iDocCount = GetDocCount(); int iCacheCount = GetCacheCount(); if (iDocCount != iCacheCount) { if (0 >= iDocCount) { EmptyCache(); m_pListPane->DeleteAllItems(); } else { int iIndex = 0; int iReturnValue = -1; if (iDocCount > iCacheCount) { for (iIndex = 0; iIndex < (iDocCount - iCacheCount); iIndex++) { iReturnValue = AddCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); m_pListPane->SetItemCount(iDocCount); m_bNeedSort = true; } else { // The virtual ListCtrl keeps a separate its list of selected rows; // make sure it does not reference any rows beyond the new last row. // We can ClearSelections() because we called SaveSelections() above. ClearSelections(); m_pListPane->SetItemCount(iDocCount); for (iIndex = (iCacheCount - 1); iIndex >= iDocCount; --iIndex) { iReturnValue = RemoveCacheElement(); wxASSERT(!iReturnValue); } wxASSERT(GetDocCount() == GetCacheCount()); //fprintf(stderr, "CBOINCBaseView::OnListRender(): m_pListPane->RefreshItems(0, %d)\n", iDocCount - 1); m_pListPane->RefreshItems(0, iDocCount - 1); m_bNeedSort = true; } } } if (iDocCount > 0) { SynchronizeCache(); if (iDocCount > 1) { if (_EnsureLastItemVisible() && (iDocCount != iCacheCount)) { m_pListPane->EnsureVisible(iDocCount - 1); } } } // Find the previously selected items by their key values and reselect them RestoreSelections(); UpdateSelection(); m_bProcessingListRenderEvent = false; } event.Skip(); }
CViewStatistics::~CViewStatistics() { EmptyCache(); EmptyTasks(); }