本文整理汇总了C++中D_MAGIC_SET函数的典型用法代码示例。如果您正苦于以下问题:C++ D_MAGIC_SET函数的具体用法?C++ D_MAGIC_SET怎么用?C++ D_MAGIC_SET使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了D_MAGIC_SET函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: dfb_colorhash_core_initialize
static DFBResult
dfb_colorhash_core_initialize( CoreDFB *core,
DFBColorHashCore *data,
DFBColorHashCoreShared *shared )
{
D_DEBUG_AT( Core_ColorHash, "dfb_colorhash_core_initialize( %p, %p, %p )\n", core, data, shared );
D_ASSERT( data != NULL );
D_ASSERT( shared != NULL );
core_colorhash = data; /* FIXME */
data->core = core;
data->shared = shared;
data->hash = D_CALLOC( HASH_SIZE, sizeof (Colorhash) );
if (!data->hash)
return D_OOM();
direct_mutex_init( &data->hash_lock );
D_MAGIC_SET( data, DFBColorHashCore );
D_MAGIC_SET( shared, DFBColorHashCoreShared );
return DFB_OK;
}
示例2: mesaInitPool
static DFBResult
mesaInitPool( CoreDFB *core,
CoreSurfacePool *pool,
void *pool_data,
void *pool_local,
void *system_data,
CoreSurfacePoolDescription *ret_desc )
{
MesaPoolData *data = pool_data;
MesaPoolLocalData *local = pool_local;
MesaData *mesa = system_data;
D_DEBUG_AT( Mesa_Surfaces, "%s()\n", __FUNCTION__ );
D_ASSERT( core != NULL );
D_MAGIC_ASSERT( pool, CoreSurfacePool );
D_ASSERT( data != NULL );
D_ASSERT( local != NULL );
D_ASSERT( mesa != NULL );
D_ASSERT( mesa->shared != NULL );
D_ASSERT( ret_desc != NULL );
ret_desc->caps = CSPCAPS_VIRTUAL;
// ret_desc->access[CSAID_CPU] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
ret_desc->access[CSAID_GPU] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
ret_desc->access[CSAID_ACCEL1] = CSAF_READ | CSAF_WRITE | CSAF_SHARED;
ret_desc->types = CSTF_LAYER | CSTF_WINDOW | CSTF_CURSOR | CSTF_FONT | CSTF_SHARED | CSTF_EXTERNAL;
ret_desc->priority = CSPP_DEFAULT;
ret_desc->size = dfb_config->video_length;
/* For hardware layers */
ret_desc->access[CSAID_LAYER0] = CSAF_READ;
ret_desc->access[CSAID_LAYER1] = CSAF_READ;
ret_desc->access[CSAID_LAYER2] = CSAF_READ;
ret_desc->access[CSAID_LAYER3] = CSAF_READ;
ret_desc->access[CSAID_LAYER4] = CSAF_READ;
ret_desc->access[CSAID_LAYER5] = CSAF_READ;
ret_desc->access[CSAID_LAYER6] = CSAF_READ;
ret_desc->access[CSAID_LAYER7] = CSAF_READ;
ret_desc->access[CSAID_LAYER8] = CSAF_READ;
ret_desc->access[CSAID_LAYER9] = CSAF_READ;
ret_desc->access[CSAID_LAYER10] = CSAF_READ;
ret_desc->access[CSAID_LAYER11] = CSAF_READ;
ret_desc->access[CSAID_LAYER12] = CSAF_READ;
ret_desc->access[CSAID_LAYER13] = CSAF_READ;
ret_desc->access[CSAID_LAYER14] = CSAF_READ;
ret_desc->access[CSAID_LAYER15] = CSAF_READ;
snprintf( ret_desc->name, DFB_SURFACE_POOL_DESC_NAME_LENGTH, "Mesa" );
local->mesa = mesa;
D_MAGIC_SET( data, MesaPoolData );
D_MAGIC_SET( local, MesaPoolLocalData );
return DFB_OK;
}
示例3: osdJoinPool
static DFBResult
osdJoinPool( CoreDFB *core,
CoreSurfacePool *pool,
void *pool_data,
void *pool_local,
void *system_data )
{
OSDPoolData *data = pool_data;
OSDPoolLocalData *local = pool_local;
DavinciDriverData *ddrv = dfb_gfxcard_get_driver_data();
DavinciDeviceData *ddev = dfb_gfxcard_get_device_data();
D_DEBUG_AT( OSD_Surfaces, "%s()\n", __FUNCTION__ );
D_ASSERT( core != NULL );
D_MAGIC_ASSERT( pool, CoreSurfacePool );
D_MAGIC_ASSERT( data, OSDPoolData );
D_ASSERT( local != NULL );
(void) data;
local->core = core;
local->mem = ddrv->fb[OSD0].mem;
local->phys = ddev->fix[OSD0].smem_start;
D_MAGIC_SET( local, OSDPoolLocalData );
return DFB_OK;
}
示例4: devmemJoinPool
static DFBResult
devmemJoinPool( CoreDFB *core,
CoreSurfacePool *pool,
void *pool_data,
void *pool_local,
void *system_data )
{
DevMemPoolData *data = pool_data;
DevMemPoolLocalData *local = pool_local;
DevMemData *devmem = system_data;
D_DEBUG_AT( DevMem_Surfaces, "%s()\n", __FUNCTION__ );
D_ASSERT( core != NULL );
D_MAGIC_ASSERT( pool, CoreSurfacePool );
D_MAGIC_ASSERT( data, DevMemPoolData );
D_ASSERT( local != NULL );
D_ASSERT( devmem != NULL );
D_ASSERT( devmem->shared != NULL );
(void) data;
local->core = core;
local->mem = devmem->mem;
D_MAGIC_SET( local, DevMemPoolLocalData );
return DFB_OK;
}
示例5: sh7722AddRegion
static DFBResult
sh7722AddRegion( CoreLayer *layer,
void *driver_data,
void *layer_data,
void *region_data,
CoreLayerRegionConfig *config )
{
int n;
SH7722MultiRegionData *sreg = region_data;
SH7722MultiLayerData *slay = layer_data;
D_DEBUG_AT( SH7722_Layer, "%s()\n", __FUNCTION__ );
if (slay->added == 0xF)
return DFB_LIMITEXCEEDED;
for (n=0; n<4; n++)
if (! (slay->added & (1 << n)))
break;
D_ASSERT( n < 4 );
sreg->config = *config;
slay->added |= 1 << n;
D_MAGIC_SET( sreg, SH7722MultiRegionData );
return DFB_OK;
}
示例6: dfb_font_create
CoreFont *
dfb_font_create( CoreDFB *core )
{
CoreFont *font;
font = (CoreFont *) D_CALLOC( 1, sizeof(CoreFont) );
font->core = core;
direct_util_recursive_pthread_mutex_init( &font->lock );
/* the proposed pixel_format, may be changed by the font provider */
font->pixel_format = dfb_config->font_format ? : DSPF_A8;
/* the state used to blit the glyphs, may be changed by the font
provider */
dfb_state_init( &font->state );
font->state.blittingflags = DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_COLORIZE;
font->glyph_infos = direct_tree_new();
D_MAGIC_SET( font, CoreFont );
return font;
}
示例7: ImageProviderDispatch_Create
DFBResult
ImageProviderDispatch_Create( IDirectFB *idirectfb,
IDirectFBDataBuffer *buffer,
IDirectFBImageProvider *provider,
ImageProviderDispatch **ret_dispatch )
{
ImageProviderDispatch *dispatch;
dispatch = (ImageProviderDispatch*) D_CALLOC( 1, sizeof(ImageProviderDispatch) );
if (!dispatch)
return (DFBResult) D_OOM();
dispatch->idirectfb = idirectfb;
dispatch->buffer = buffer;
dispatch->provider = provider;
ImageProvider_Init_Dispatch( core_dfb, dispatch, &dispatch->call );
fusion_call_add_permissions( &dispatch->call, Core_GetIdentity(), FUSION_CALL_PERMIT_EXECUTE );
Core_Resource_AddCleanup( Core_GetIdentity(), ImageProviderDispatch_cleanup, dispatch, NULL, &dispatch->cleanup );
D_MAGIC_SET( dispatch, ImageProviderDispatch );
*ret_dispatch = dispatch;
return DFB_OK;
}
示例8: OneTarget_New
int
OneTarget_New( OneTarget_InitFunc Init,
void *ctx,
size_t data_size,
OneTarget **ret_target )
{
int ret;
OneTarget *target;
ONE_DEBUG( "%s()\n", __FUNCTION__ );
target = one_core_malloc( one_core, sizeof(OneTarget) + data_size );
if (!target)
return -ENOMEM;
memset( target, 0, sizeof(OneTarget) + data_size );
target->data = target + 1;
ret = Init( target, ctx );
if (ret) {
one_core_free( one_core, target );
return ret;
}
D_MAGIC_SET( target, OneTarget );
*ret_target = target;
return 0;
}
示例9: direct_thread_add_init_handler
DirectThreadInitHandler *
direct_thread_add_init_handler( DirectThreadInitFunc func,
void *arg )
{
DirectThreadInitHandler *handler;
handler = D_CALLOC( 1, sizeof(DirectThreadInitHandler) );
if (!handler) {
D_WARN( "out of memory" );
return NULL;
}
handler->func = func;
handler->arg = arg;
D_MAGIC_SET( handler, DirectThreadInitHandler );
pthread_mutex_lock( &handler_lock );
direct_list_append( &handlers, &handler->link );
pthread_mutex_unlock( &handler_lock );
return handler;
}
示例10: direct_thread_self
DirectThread *
direct_thread_self( void )
{
DirectThread *thread;
direct_once( &thread_init_once, init_once );
thread = pthread_getspecific( thread_key );
// D_MAGIC_ASSERT_IF( thread, DirectThread );
/* Support this function for non-direct threads. */
if (!thread) {
// D_DEBUG_AT( Direct_Thread, " -> attaching unknown thread %d\n", direct_gettid() );
thread = direct_calloc( 1, sizeof(DirectThread) );
if (!thread) {
D_OOM();
return NULL;
}
thread->handle.thread = pthread_self();
thread->tid = direct_gettid();
D_MAGIC_SET( thread, DirectThread );
pthread_setspecific( thread_key, thread );
}
return thread;
}
示例11: stmfbdevJoinPool
static DFBResult
stmfbdevJoinPool (CoreDFB *core,
CoreSurfacePool *pool,
void *pool_data,
void *pool_local,
void *system_data)
{
STMfbdevPoolData * const data = pool_data;
STMfbdevPoolLocalData * const local = pool_local;
STMfbdev * const stmfbdev = dfb_system_data ();
D_DEBUG_AT (STMfbdev_Surfaces, "%s()\n", __FUNCTION__);
D_ASSERT (core != NULL);
D_MAGIC_ASSERT (pool, CoreSurfacePool);
D_MAGIC_ASSERT (data, STMfbdevPoolData);
D_ASSERT (local != NULL);
D_MAGIC_ASSERT (stmfbdev, STMfbdev);
(void) data;
D_MAGIC_SET (local, STMfbdevPoolLocalData);
local->mem = stmfbdev->framebuffer_base;
D_ASSERT (local->mem != NULL);
local->core = core;
return DFB_OK;
}
示例12: split_chunk
static Chunk* split_chunk( Chunk *c, int length )
{
Chunk *newchunk;
D_MAGIC_ASSERT( c, _Chunk_ );
if (c->length == length) /* does not need be splitted */
return c;
newchunk = (Chunk*) SHCALLOC( 1, sizeof(Chunk) );
/* calculate offsets and lengths of resulting chunks */
newchunk->offset = c->offset + c->length - length;
newchunk->length = length;
c->length -= newchunk->length;
/* insert newchunk after chunk c */
newchunk->prev = c;
newchunk->next = c->next;
if (c->next)
c->next->prev = newchunk;
c->next = newchunk;
D_MAGIC_SET( newchunk, _Chunk_ );
return newchunk;
}
示例13: Call_GetTLS
static CallTLS *
Call_GetTLS( FusionWorld *world )
{
CallTLS *call_tls;
call_tls = direct_tls_get( call_tls_key );
if (!call_tls) {
call_tls = D_CALLOC( 1, sizeof(CallTLS) + sizeof(FusionCallExecute3) * fusion_config->call_bin_max_num + fusion_config->call_bin_max_data );
if (!call_tls) {
D_OOM();
return NULL;
}
DirectThread *self = direct_thread_self();
if (self)
call_tls->dispatcher = fusion_dispatcher_tid( world ) == direct_thread_get_tid( self );
call_tls->world = world;
call_tls->bins = (FusionCallExecute3*) (call_tls + 1);
call_tls->bins_data = (char*) (call_tls->bins + fusion_config->call_bin_max_num);
D_MAGIC_SET( call_tls, CallTLS );
direct_tls_set( call_tls_key, call_tls );
}
D_MAGIC_ASSERT( call_tls, CallTLS );
return call_tls;
}
示例14: direct_signal_handler_add
DirectResult
direct_signal_handler_add( int num,
DirectSignalHandlerFunc func,
void *ctx,
DirectSignalHandler **ret_handler )
{
DirectSignalHandler *handler;
D_ASSERT( func != NULL );
D_ASSERT( ret_handler != NULL );
D_DEBUG_AT( Direct_Signals,
"Adding handler %p for signal %d with context %p...\n", func, num, ctx );
handler = D_CALLOC( 1, sizeof(DirectSignalHandler) );
if (!handler) {
D_WARN( "out of memory" );
return DR_NOLOCALMEMORY;
}
handler->num = num;
handler->func = func;
handler->ctx = ctx;
D_MAGIC_SET( handler, DirectSignalHandler );
direct_mutex_lock( &handlers_lock );
direct_list_append( &handlers, &handler->link );
direct_mutex_unlock( &handlers_lock );
*ret_handler = handler;
return DR_OK;
}
示例15: fusion_shm_pool_create
DirectResult
fusion_shm_pool_create( FusionWorld *world,
const char *name,
unsigned int max_size,
bool debug,
FusionSHMPoolShared **ret_pool )
{
FusionSHMPoolShared *pool;
#if !DIRECT_BUILD_DEBUGS
debug = false;
#endif
pool = D_CALLOC( 1, sizeof(FusionSHMPoolShared) );
if (!pool)
return D_OOM();
pool->debug = debug;
D_MAGIC_SET( pool, FusionSHMPoolShared );
*ret_pool = pool;
return DR_OK;
}