xp_comm_proj/cine/imgcache.c
/* routine: CacheProcessTrigger
 * purpose: Capture new frame if required
 */
CacheProcessTrigger
purpose: Capture new frame if required
CacheProcessTrigger purpose : Capture new frame if required
int CacheProcessTrigger(OMobj_id obj_id, OMevent_mask event_mask, int seq_num)
{
  OMobj_id view_id;
  CacheInfo *cache;
  GDview *view;
  if( (cache = GetCacheInfo( obj_id )) == NULL )
    return( 0 );
  view_id = OMfind_subobj(obj_id, OMstr_to_name("view"), OM_OBJ_RD);
  if( OMis_null_obj(view_id) )
    {
      fprintf( stderr, "CacheUpdate: Unable to get object id for view\n" );
      return( 0 );
    }
  view = (GDview *)GDget_local(view_id, (OMpfi)GDview_init);
  if( view )
    {
      if( cache->capture )
        {
          if( cache->mode == 0 )
            {
              int frame_out = cache->num_frames;
	      CreatePixmap( cache, view, frame_out );
	      SavePixmap( cache, view, frame_out );
              cache->num_frames += 1;
              OMset_name_int_val(obj_id, OMstr_to_name("frame_out"), frame_out);
              OMset_name_int_val(obj_id, OMstr_to_name("num_frames"), cache->num_frames);
            }
          else
            {
              if( cache->pixmaps[cache->frame_in] == NULL )
                {
		  CreatePixmap( cache, view, cache->frame_in );
		  SavePixmap( cache, view, cache->frame_in );
                }
              else
                fprintf( stderr, "CacheProcessTrigger: trigger with pixmap already cached\n" );
            }
        }
    }
  return(1);
}
int CacheProcessTrigger ( OMobj_id obj_id , OMevent_mask event_mask , int seq_num ) { OMobj_id view_id ; CacheInfo * cache ; GDview * view ; if ( ( cache = GetCacheInfo ( obj_id ) ) == NULL ) return ( 0 ) ; view_id = OMfind_subobj ( obj_id , OMstr_to_name ( " " ) , OM_OBJ_RD ) ; if ( OMis_null_obj ( view_id ) ) { fprintf ( stderr , " \n " ) ; return ( 0 ) ; } view = ( GDview * ) GDget_local ( view_id , ( OMpfi ) GDview_init ) ; if ( view ) { if ( cache -> capture ) { if ( cache -> mode == 0 ) { int frame_out = cache -> num_frames ; CreatePixmap ( cache , view , frame_out ) ; SavePixmap ( cache , view , frame_out ) ; cache -> num_frames += 1 ; OMset_name_int_val ( obj_id , OMstr_to_name ( " " ) , frame_out ) ; OMset_name_int_val ( obj_id , OMstr_to_name ( " " ) , cache -> num_frames ) ; } else { if ( cache -> pixmaps [ cache -> frame_in ] == NULL ) { CreatePixmap ( cache , view , cache -> frame_in ) ; SavePixmap ( cache , view , cache -> frame_in ) ; } else fprintf ( stderr , " \n " ) ; } } } return ( 1 ) ; }
routine: CacheProcessTrigger
 purpose: Capture new frame if required
routine : CacheProcessTrigger purpose : Capture new frame if required
/* Get pointer to control structure
   */ /* Get GDview structure
   */ /* Don't do anything without a view connected
   */ /* Mode 0: Capture frame and update frame_out and num_frames
	   */ /* Mode 1: Capture frame
	   */