您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ AddResource函数代码示例

51自学网 2021-06-01 19:41:25
  C++
这篇教程C++ AddResource函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中AddResource函数的典型用法代码示例。如果您正苦于以下问题:C++ AddResource函数的具体用法?C++ AddResource怎么用?C++ AddResource使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了AddResource函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: BeginLoad

	iResourceBase* cImageManager::CreateInFrame(const tString& asName, int alFrameHandle)	{		cResourceImage *pImage = NULL;		tString sPath;		BeginLoad(asName);		pImage = FindImage(asName, sPath);		if(!pImage)		{			if(sPath != "")			{				iBitmap2D *pBmp;				pBmp = mpLowLevelResources->LoadBitmap2D(sPath);				if(pBmp==NULL){					Error("Imagemanager Couldn't load bitmap '%s'/n", sPath.c_str());					EndLoad();					return NULL;				}								pImage = AddToFrame(pBmp, alFrameHandle);				hplDelete(pBmp);				if(pImage==NULL){					Error("Imagemanager couldn't create image '%s'/n", asName.c_str());				}								if(pImage) AddResource(pImage); 			}		}		else		{			//Log("Found '%s' in stock!/n",asName.c_str());		}		if(pImage)pImage->IncUserCount();		else Error("Couldn't load image '%s'/n",asName.c_str());		//Log("Loaded image %s, it has %d users!/n", pImage->GetName().c_str(),pImage->GetUserCount());		//Log(" frame has %d pics/n", pImage->GetFrameTexture()->GetPicCount());		EndLoad();        return pImage;	}
开发者ID:ArchyInf,项目名称:HPL1Engine,代码行数:45,


示例2: J2dTraceLn

// REMIND: this method is currently unused; consider removing it later...HRESULT D3DResourceManager::CreateOSPSurface(UINT width, UINT height,                                         D3DFORMAT fmt,                                         D3DResource** ppSurfaceResource/*out*/){    HRESULT res;    IDirect3DDevice9 *pd3dDevice;    J2dTraceLn(J2D_TRACE_INFO, "D3DRM::CreateOSPSurface");    J2dTraceLn2(J2D_TRACE_VERBOSE, "  w=%d h=%d", width, height);    if (pCtx == NULL || ppSurfaceResource == NULL ||        (pd3dDevice = pCtx->Get3DDevice()) == NULL)    {        return E_FAIL;    }    if (FAILED(res = pd3dDevice->TestCooperativeLevel())) {        return res;    }    // since the off-screen plain surface is intended to be used with    // the UpdateSurface() method, it is essential that it be created    // in the same format as the destination and allocated in the    // SYSTEMMEM pool (otherwise UpdateSurface() will fail)    D3DFORMAT format;    if (fmt == D3DFMT_UNKNOWN) {        format = pCtx->GetPresentationParams()->BackBufferFormat;    } else {        format = fmt;    }    D3DPOOL pool = D3DPOOL_SYSTEMMEM;    IDirect3DSurface9 *pSurface = NULL;    res = pd3dDevice->CreateOffscreenPlainSurface(width, height,                                                  format, pool,                                                  &pSurface, NULL);    if (SUCCEEDED(res)) {        J2dTraceLn1(J2D_TRACE_VERBOSE, "  created OSP Surface: 0x%x ",pSurface);        *ppSurfaceResource = new D3DResource((IDirect3DResource9*)pSurface);        res = AddResource(*ppSurfaceResource);    } else {        DebugPrintD3DError(res, "D3DRM::CreateOSPSurface failed");        ppSurfaceResource = NULL;    }    return res;}
开发者ID:ChenYao,项目名称:jdk7u-jdk,代码行数:46,


示例3: XineramifyXv

void XineramifyXv(void){   XvScreenPtr xvsp0 = dixLookupPrivate(&screenInfo.screens[0]->devPrivates, XvGetScreenKey());   XvAdaptorPtr MatchingAdaptors[MAXSCREENS];   int i, j, k;   XvXRTPort = CreateNewResourceType(XineramaDeleteResource, "XvXRTPort");   if (!xvsp0 || !XvXRTPort) return;   SetResourceTypeErrorValue(XvXRTPort, _XvBadPort);   for(i = 0; i < xvsp0->nAdaptors; i++) {      Bool isOverlay;      XvAdaptorPtr refAdapt = xvsp0->pAdaptors + i;      if(!(refAdapt->type & XvInputMask)) continue;      MatchingAdaptors[0] = refAdapt;      isOverlay = hasOverlay(refAdapt);      FOR_NSCREENS_FORWARD_SKIP(j)	 MatchingAdaptors[j] = matchAdaptor(screenInfo.screens[j], refAdapt, isOverlay);      /* now create a resource for each port */      for(j = 0; j < refAdapt->nPorts; j++) {	 PanoramiXRes *port = malloc(sizeof(PanoramiXRes));	 if(!port)	    break;	 FOR_NSCREENS(k) {	    if(MatchingAdaptors[k] && (MatchingAdaptors[k]->nPorts > j)) 		port->info[k].id = MatchingAdaptors[k]->base_id + j;	    else		port->info[k].id = 0;	 } 	 AddResource(port->info[0].id, XvXRTPort, port);      }   }   /* munge the dispatch vector */   XvProcVector[xv_PutVideo]		= XineramaXvPutVideo;   XvProcVector[xv_PutStill]		= XineramaXvPutStill;   XvProcVector[xv_StopVideo]		= XineramaXvStopVideo;   XvProcVector[xv_SetPortAttribute]	= XineramaXvSetPortAttribute;   XvProcVector[xv_PutImage]		= XineramaXvPutImage;   XvProcVector[xv_ShmPutImage]		= XineramaXvShmPutImage;}
开发者ID:eriytt,项目名称:xserver-xsdl,代码行数:45,


示例4: BeginLoad

	iFontData *cFontManager::CreateFontData(const tString &a_sName, int a_lSize, unsigned short a_lFirstChar,								unsigned short a_lLastChar)	{		tString sPath;		iFontData *pFont;		tString a_sNewName = cString::ToLowerCase(a_sName);		BeginLoad(a_sName);		pFont = static_cast<iFontData*>(this->FindLoadedResource(a_sNewName, sPath));		if (pFont==NULL && sPath!="")		{			pFont = m_pGraphics->GetLowLevel()->CreateFontData(a_sNewName);			pFont->SetUp(m_pGraphics->GetDrawer(), m_pLowLevelResources, m_pGui);			tString sExt = cString::ToLowerCase(cString::GetFileExt(a_sName));			if (sExt == "ttf")			{				if (pFont->CreateFromFontFile(sPath, a_lSize, a_lFirstChar, a_lLastChar)==false)				{					efeDelete(pFont);					EndLoad();					return NULL;				}			}			else			{				Error("Font '%s' has an uknown extension!/n", a_sName.c_str());				efeDelete(pFont);				EndLoad();				return NULL;			}			AddResource(pFont);		}		if (pFont)pFont->IncUserCount();		else Error("Couldn't create font '%s'/n", a_sName.c_str());		EndLoad();		return pFont;	}
开发者ID:MIFOZ,项目名称:EFE-Engine,代码行数:43,


示例5: AddResource

voidResourcesContainer::AssimilateResources(ResourcesContainer &container){	// Resistance is futile! ;-)	int32 newCount = container.CountResources();	for (int32 i = 0; i < newCount; i++) {		ResourceItem *item = container.ResourceAt(i);		if (item->IsLoaded())			AddResource(item);		else {			// That should not happen.			// Delete the item to have a consistent behavior.			delete item;		}	}	container.fResources.MakeEmpty();	container.SetModified(true);	SetModified(true);}
开发者ID:mariuz,项目名称:haiku,代码行数:19,


示例6: CBullet

void CBulletManager::AddBullet(Vect3f &_Position, Vect3f &_Direction, CCharacter* player, float _Speed, float _Damage){	CBillboard *l_pBillboard = CORE->GetBillboardManager()->GetBillboardCore("bLaserHalo");	CBullet * l_pBullet = new CBullet (*l_pBillboard);	std::string l_sBulletName = GetBulletName();	l_pBullet->SetPos(_Position+Vect3f(0.0f, 0.025f, 0.0f));	l_pBullet->SetDirection(_Direction);	l_pBullet->SetBulletSpeed(_Speed);	l_pBullet->SetFirstPos(_Position);	l_pBullet->SetDamage(_Damage);	l_pBullet->SetName(l_sBulletName);	l_pBullet->SetLight(GetLight());	l_pBullet->Init(player);	m_iCounter++;	AddResource(l_sBulletName,l_pBullet);}
开发者ID:ivantarruella,项目名称:TheOtherSide,代码行数:19,


示例7: CRenderableObjectsManager

CRenderableObjectsManager* CLayerManager::AddLayer(CXMLTreeNode &TreeNode){	CRenderableObjectsManager *l_ROManager = new CRenderableObjectsManager();		std::string l_LayerName=TreeNode.GetPszProperty("name","");	if(!AddResource(l_LayerName, l_ROManager))	{		if (l_ROManager != NULL) delete(l_ROManager); l_ROManager = NULL;	}	else 	{		l_ROManager->SetName(l_LayerName);		bool l_Default=TreeNode.GetBoolProperty("default",false);		if(l_Default)					m_DefaultLayer=l_ROManager;	}	return l_ROManager;}
开发者ID:AAnguix,项目名称:TTOD_Engine,代码行数:19,


示例8: RRModeCreate

static RRModePtrRRModeCreate (xRRModeInfo   *modeInfo,              const char    *name,              ScreenPtr	    userScreen){    RRModePtr	mode, *newModes;    if (!RRInit ())        return NULL;    mode = xalloc (sizeof (RRModeRec) + modeInfo->nameLength + 1);    if (!mode)        return NULL;    mode->refcnt = 1;    mode->mode = *modeInfo;    mode->name = (char *) (mode + 1);    memcpy (mode->name, name, modeInfo->nameLength);    mode->name[modeInfo->nameLength] = '/0';    mode->userScreen = userScreen;    if (num_modes)        newModes = xrealloc (modes, (num_modes + 1) * sizeof (RRModePtr));    else        newModes = xalloc (sizeof (RRModePtr));    if (!newModes)    {        xfree (mode);        return NULL;    }    mode->mode.id = FakeClientID(0);    if (!AddResource (mode->mode.id, RRModeType, (pointer) mode))        return NULL;    modes = newModes;    modes[num_modes++] = mode;    /*     * give the caller a reference to this mode     */    ++mode->refcnt;    return mode;}
开发者ID:fenghaitao,项目名称:xserver-with-gl-accelerated-xephyr,代码行数:43,


示例9: AddPassiveGrabToList

/** * Prepend the new grab to the list of passive grabs on the window. * Any previously existing grab that matches the new grab will be removed. * Adding a new grab that would override another client's grab will result in * a BadAccess. *  * @return Success or X error code on failure. */intAddPassiveGrabToList(ClientPtr client, GrabPtr pGrab){    GrabPtr grab;    Mask access_mode = DixGrabAccess;    int rc;    for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next) {        if (GrabMatchesSecond(pGrab, grab, (pGrab->grabtype == CORE))) {            if (CLIENT_BITS(pGrab->resource) != CLIENT_BITS(grab->resource)) {                FreeGrab(pGrab);                return BadAccess;            }        }    }    if (pGrab->keyboardMode == GrabModeSync ||        pGrab->pointerMode == GrabModeSync)        access_mode |= DixFreezeAccess;    rc = XaceHook(XACE_DEVICE_ACCESS, client, pGrab->device, access_mode);    if (rc != Success)        return rc;    /* Remove all grabs that match the new one exactly */    for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next) {        if (GrabsAreIdentical(pGrab, grab)) {            DeletePassiveGrabFromList(grab);            break;        }    }    if (!pGrab->window->optional && !MakeWindowOptional(pGrab->window)) {        FreeGrab(pGrab);        return BadAlloc;    }    pGrab->next = pGrab->window->optional->passiveGrabs;    pGrab->window->optional->passiveGrabs = pGrab;    if (AddResource(pGrab->resource, RT_PASSIVEGRAB, (pointer) pGrab))        return Success;    return BadAlloc;}
开发者ID:dlespiau,项目名称:xserver,代码行数:50,


示例10: GetResource

CTexture* CTextureManager::GetTexture(const std::string &fileName){	CTexture* l_Tex = GetResource(fileName);	if( l_Tex == NULL )	{		l_Tex = new CTexture();		if( l_Tex->Load(fileName) )		{			LOGGER->AddNewLog(ELL_INFORMATION, "CTextureManager::GetTexture->Textura cargada: %s", fileName.c_str() );			AddResource(fileName, l_Tex);		}		else		{			CHECKED_DELETE(l_Tex);			return GetResource(m_NoTextureName);		}	}	return l_Tex;}
开发者ID:kusku,项目名称:red-forest,代码行数:21,


示例11: GetResource

CAnimatedCoreModel* CAnimatedModelManager::GetCore(const std::string &_szName, const std::string &_szPath){  LOGGER->AddNewLog(ELL_INFORMATION,"CAnimatedModelManager::GetCore Carregant la core /"%s/" a /"%s/"",_szName.c_str(),_szPath.c_str());  CAnimatedCoreModel* l_pAnimatedCoreModel = GetResource(_szName);  if(l_pAnimatedCoreModel)  {    LOGGER->AddNewLog(ELL_INFORMATION,"CAnimatedModelManager::GetCore Fent Reload");    l_pAnimatedCoreModel->Reload(_szPath);  } else {    l_pAnimatedCoreModel = new CAnimatedCoreModel(_szName);    if(l_pAnimatedCoreModel->Load(_szPath))    {      LOGGER->AddNewLog(ELL_INFORMATION,"CAnimatedModelManager::GetCore Carregat correctament");      AddResource(_szName,l_pAnimatedCoreModel);    } else {      LOGGER->AddNewLog(ELL_WARNING,"CAnimatedModelManager::GetCore No s'ha pogut carregar, borrant la core");      CHECKED_DELETE(l_pAnimatedCoreModel)    }  }  return l_pAnimatedCoreModel;}
开发者ID:Atridas,项目名称:biogame,代码行数:21,


示例12: SecurityEventSelectForAuthorization

static intSecurityEventSelectForAuthorization(    SecurityAuthorizationPtr pAuth,    ClientPtr client,    Mask mask){    OtherClients *pEventClient;    for (pEventClient = pAuth->eventClients;	 pEventClient;	 pEventClient = pEventClient->next)    {	if (SameClient(pEventClient, client))	{	    if (mask == 0)		FreeResource(pEventClient->resource, RT_NONE);	    else		pEventClient->mask = mask;	    return Success;	}    }        pEventClient = malloc(sizeof(OtherClients));    if (!pEventClient)	return BadAlloc;    pEventClient->mask = mask;    pEventClient->resource = FakeClientID(client->index);    pEventClient->next = pAuth->eventClients;    if (!AddResource(pEventClient->resource, RTEventClient,		     (pointer)pAuth))    {	free(pEventClient);	return BadAlloc;    }    pAuth->eventClients = pEventClient;    return Success;} /* SecurityEventSelectForAuthorization */
开发者ID:OpenInkpot-archive,项目名称:iplinux-xorg-server,代码行数:38,


示例13: ProcXFixesCreateRegionFromPicture

intProcXFixesCreateRegionFromPicture (ClientPtr client){#ifdef RENDER    RegionPtr	pRegion;    PicturePtr	pPicture;    REQUEST (xXFixesCreateRegionFromPictureReq);    REQUEST_SIZE_MATCH (xXFixesCreateRegionFromPictureReq);    LEGAL_NEW_RESOURCE (stuff->region, client);    VERIFY_PICTURE(pPicture, stuff->picture, client, DixReadAccess,		   RenderErrBase + BadPicture);        switch (pPicture->clientClipType) {    case CT_PIXMAP:	pRegion = BITMAP_TO_REGION(pPicture->pDrawable->pScreen,				   (PixmapPtr) pPicture->clientClip);	if (!pRegion)	    return BadAlloc;	break;    case CT_REGION:	pRegion = XFixesRegionCopy ((RegionPtr) pPicture->clientClip);	if (!pRegion)	    return BadAlloc;	break;    default:	return BadImplementation;   /* assume sane server bits */    }        if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))	return BadAlloc;        return(client->noClientException);#else    return BadRequest;#endif}
开发者ID:GrahamCobb,项目名称:maemo-xsisusb,代码行数:38,


示例14: BeginLoad

	iSoundData *cSoundManager::CreateSoundData(const tString &a_sName, bool a_bStream, bool a_bLoopStream)	{		tString sPath;		iSoundData *pSound = NULL;		BeginLoad(a_sName);		pSound = FindData(a_sName, sPath);		if (pSound == NULL && sPath != "")		{			pSound = m_pSound->GetLowLevel()->LoadSoundData(cString::GetFilePath(a_sName),sPath,"", a_bStream,a_bLoopStream);			if (pSound)			{				AddResource(pSound);				pSound->SetSoundManager(m_pResources->GetSoundManager());			}		}		EndLoad();		return pSound;	}
开发者ID:MIFOZ,项目名称:EFE-Engine,代码行数:23,


示例15: Destroy

void CMaterialManager::Load(const std::string &Filename){    m_Filename = Filename;    Destroy();    CXMLTreeNode l_XML;    if (l_XML.LoadFile(Filename.c_str()))    {        CXMLTreeNode l_Input = l_XML["materials"];        if (l_Input.Exists())        {            for (int i = 0; i < l_Input.GetNumChildren(); ++i)            {                CXMLTreeNode l_Element = l_Input(i);                if (l_Element.GetName() == std::string("material"))                {                    AddResource(l_Element.GetPszProperty("name"),new CMaterial(l_Element));                }            }        }    }}
开发者ID:Imdeeo,项目名称:ProjecteMaster,代码行数:23,


示例16: ProcXFixesCreateRegion

intProcXFixesCreateRegion (ClientPtr client){    int		things;    RegionPtr	pRegion;    REQUEST (xXFixesCreateRegionReq);        REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq);    LEGAL_NEW_RESOURCE (stuff->region, client);        things = (client->req_len << 2) - sizeof (xXFixesCreateRegionReq);    if (things & 4)	return BadLength;    things >>= 3;    pRegion = RECTS_TO_REGION(0, things, (xRectangle *) (stuff + 1), CT_UNSORTED);    if (!pRegion)	return BadAlloc;    if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))	return BadAlloc;        return(client->noClientException);}
开发者ID:GrahamCobb,项目名称:maemo-xsisusb,代码行数:23,


示例17: write_setting_s

void write_setting_s(void *handle, char const *key, char const *value) {    int fd = *(int *)handle;    Handle h;    int id;    OSErr error;    Str255 pkey;    UseResFile(fd);    if (ResError() != noErr)        fatalbox("Failed to open saved session (%d)", ResError());    error = PtrToHand(value, &h, strlen(value));    if (error != noErr)	fatalbox("Failed to allocate memory");    /* Put the data in a resource. */    id = Unique1ID(FOUR_CHAR_CODE('TEXT'));    if (ResError() != noErr)	fatalbox("Failed to get ID for resource %s (%d)", key, ResError());    c2pstrcpy(pkey, key);    AddResource(h, FOUR_CHAR_CODE('TEXT'), id, pkey);    if (ResError() != noErr)	fatalbox("Failed to add resource %s (%d)", key, ResError());}
开发者ID:sdottaka,项目名称:cvsnt-sjis,代码行数:23,


示例18: add_reslist

static Bool add_reslist(RESTYPE type, XID id, struct xorg_list *node){	struct xorg_list *list;	void *ptr = NULL;	dixLookupResourceByType(&ptr, id, type, NULL, DixWriteAccess);	list = ptr;	if (!list) {		list = malloc(sizeof *list);		if (!list)			return FALSE;		if (!AddResource(id, type, list)) {			free(list);			return FALSE;		}		xorg_list_init(list);	}	xorg_list_add(node, list);	return TRUE;}
开发者ID:stefan-langenmaier,项目名称:xf86-video-armada,代码行数:24,


示例19: ProcXFixesCreateRegionFromGC

intProcXFixesCreateRegionFromGC (ClientPtr client){    RegionPtr	pRegion, pClip;    GCPtr	pGC;    int 	rc;    REQUEST (xXFixesCreateRegionFromGCReq);    REQUEST_SIZE_MATCH (xXFixesCreateRegionFromGCReq);    LEGAL_NEW_RESOURCE (stuff->region, client);    rc = dixLookupGC(&pGC, stuff->gc, client, DixReadAccess);    if (rc != Success)	return rc;        switch (pGC->clientClipType) {    case CT_PIXMAP:	pRegion = BITMAP_TO_REGION(pGC->pScreen, (PixmapPtr) pGC->clientClip);	if (!pRegion)	    return BadAlloc;	break;    case CT_REGION:	pClip = (RegionPtr) pGC->clientClip;	pRegion = XFixesRegionCopy (pClip);	if (!pRegion)	    return BadAlloc;	break;    default:	return BadImplementation;   /* assume sane server bits */    }        if (!AddResource (stuff->region, RegionResType, (pointer) pRegion))	return BadAlloc;        return(client->noClientException);}
开发者ID:GrahamCobb,项目名称:maemo-xsisusb,代码行数:36,


示例20: ProcXFixesCreateRegion

intProcXFixesCreateRegion(ClientPtr client){    int things;    RegionPtr pRegion;    REQUEST(xXFixesCreateRegionReq);    REQUEST_AT_LEAST_SIZE(xXFixesCreateRegionReq);    LEGAL_NEW_RESOURCE(stuff->region, client);    things = (client->req_len << 2) - sizeof(xXFixesCreateRegionReq);    if (things & 4)        return BadLength;    things >>= 3;    pRegion = RegionFromRects(things, (xRectangle *) (stuff + 1), CT_UNSORTED);    if (!pRegion)        return BadAlloc;    if (!AddResource(stuff->region, RegionResType, (void *) pRegion))        return BadAlloc;    return Success;}
开发者ID:mirror,项目名称:xserver,代码行数:24,


示例21: DeletePassiveGrabFromList

BoolDeletePassiveGrabFromList(GrabPtr pMinuendGrab){    GrabPtr grab;    GrabPtr *deletes, *adds;    Mask ***updates, **details;    int i, ndels, nadds, nups;    Bool ok;    unsigned int any_modifier;    unsigned int any_key;#define UPDATE(mask,exact) /	if (!(details[nups] = DeleteDetailFromMask(mask, exact))) /	  ok = FALSE; /	else /	  updates[nups++] = &(mask)    i = 0;    for (grab = wPassiveGrabs(pMinuendGrab->window); grab; grab = grab->next)        i++;    if (!i)        return TRUE;    deletes = malloc(i * sizeof(GrabPtr));    adds = malloc(i * sizeof(GrabPtr));    updates = malloc(i * sizeof(Mask **));    details = malloc(i * sizeof(Mask *));    if (!deletes || !adds || !updates || !details) {        free(details);        free(updates);        free(adds);        free(deletes);        return FALSE;    }    any_modifier = (pMinuendGrab->grabtype == XI2) ?        (unsigned int) XIAnyModifier : (unsigned int) AnyModifier;    any_key = (pMinuendGrab->grabtype == XI2) ?        (unsigned int) XIAnyKeycode : (unsigned int) AnyKey;    ndels = nadds = nups = 0;    ok = TRUE;    for (grab = wPassiveGrabs(pMinuendGrab->window);         grab && ok; grab = grab->next) {        if ((CLIENT_BITS(grab->resource) != CLIENT_BITS(pMinuendGrab->resource))            || !GrabMatchesSecond(grab, pMinuendGrab, (grab->grabtype == CORE)))            continue;        if (GrabSupersedesSecond(pMinuendGrab, grab)) {            deletes[ndels++] = grab;        }        else if ((grab->detail.exact == any_key)                 && (grab->modifiersDetail.exact != any_modifier)) {            UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact);        }        else if ((grab->modifiersDetail.exact == any_modifier)                 && (grab->detail.exact != any_key)) {            UPDATE(grab->modifiersDetail.pMask,                   pMinuendGrab->modifiersDetail.exact);        }        else if ((pMinuendGrab->detail.exact != any_key)                 && (pMinuendGrab->modifiersDetail.exact != any_modifier)) {            GrabPtr pNewGrab;            GrabParameters param;            UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact);            memset(&param, 0, sizeof(param));            param.ownerEvents = grab->ownerEvents;            param.this_device_mode = grab->keyboardMode;            param.other_devices_mode = grab->pointerMode;            param.modifiers = any_modifier;            pNewGrab = CreateGrab(CLIENT_ID(grab->resource), grab->device,                                  grab->modifierDevice, grab->window,                                  grab->grabtype,                                  (GrabMask *) &grab->eventMask,                                  &param, (int) grab->type,                                  pMinuendGrab->detail.exact,                                  grab->confineTo, grab->cursor);            if (!pNewGrab)                ok = FALSE;            else if (!(pNewGrab->modifiersDetail.pMask =                       DeleteDetailFromMask(grab->modifiersDetail.pMask,                                            pMinuendGrab->modifiersDetail.                                            exact))                     || (!pNewGrab->window->optional &&                         !MakeWindowOptional(pNewGrab->window))) {                FreeGrab(pNewGrab);                ok = FALSE;            }            else if (!AddResource(pNewGrab->resource, RT_PASSIVEGRAB,                                  (pointer) pNewGrab))                ok = FALSE;            else                adds[nadds++] = pNewGrab;        }        else if (pMinuendGrab->detail.exact == any_key) {            UPDATE(grab->modifiersDetail.pMask,                   pMinuendGrab->modifiersDetail.exact);        }        else {            UPDATE(grab->detail.pMask, pMinuendGrab->detail.exact);//.........这里部分代码省略.........
开发者ID:dlespiau,项目名称:xserver,代码行数:101,


示例22: PAS_decodeResource

OSErr PAS_decodeResource(PASEntry *entry, FSSpec *outFile, short inRefNum){	OSErr 			err = noErr;		short			outRefNum;	PASResFork		info;	SInt32			infoSize;	short			oldResFile;		PASResource		pasRes;	SInt32			pasResSize;		long			bufSize;	Handle			buffer;	long			counter=0;		infoSize	=	sizeof(PASResFork);		err = SetFPos(inRefNum, fsFromStart, (*entry).entryOffset );	if (err != noErr)	return err;	err	= FSRead( inRefNum, &infoSize, &info);	if (err != noErr)	return err;	if(infoSize != sizeof(PASResFork))	{		err = -1;		goto error;	}		oldResFile=CurResFile();		outRefNum = FSpOpenResFile(outFile, fsRdWrPerm);	if (outRefNum < noErr)	return outRefNum;					UseResFile(outRefNum);			while (1)	{		pasResSize	=	sizeof(PASResource);		err	= FSRead( inRefNum, &pasResSize, &pasRes);				if (err != noErr)		{			if(err == eofErr)				err = noErr;							break;		}				bufSize	=	pasRes.length;		buffer	=	NewHandle(bufSize);		HLock(buffer);				if(buffer == NULL)		{			/*  if we did not get our memory, try updateresfile */					HUnlock(buffer);			UpdateResFile(outRefNum);			counter=0;						buffer	=	NewHandle(bufSize);			HLock(buffer);						if(buffer == NULL)			{				err = memFullErr;				break;			}		}				err	= FSRead( inRefNum, &bufSize, &(**buffer));		if (err != noErr && err != eofErr)	break;				AddResource(buffer, pasRes.attrType, pasRes.attrID, pasRes.attrName);		WriteResource(buffer);				SetResAttrs(buffer, pasRes.attr);		ChangedResource(buffer);			WriteResource(buffer);				ReleaseResource(buffer);					if (counter++ > 100)		{			UpdateResFile(outRefNum);			counter=0;		}		}error:			UseResFile(oldResFile);		CloseResFile(outRefNum);			return err;//.........这里部分代码省略.........
开发者ID:binoc-software,项目名称:mozilla-cvs,代码行数:101,


示例23: proc_dri3_pixmap_from_buffer

static intproc_dri3_pixmap_from_buffer(ClientPtr client){    REQUEST(xDRI3PixmapFromBufferReq);    int fd;    DrawablePtr drawable;    PixmapPtr pixmap;    int rc;    SetReqFds(client, 1);    REQUEST_SIZE_MATCH(xDRI3PixmapFromBufferReq);    LEGAL_NEW_RESOURCE(stuff->pixmap, client);    rc = dixLookupDrawable(&drawable, stuff->drawable, client, M_ANY, DixGetAttrAccess);    if (rc != Success) {        client->errorValue = stuff->drawable;        return rc;    }    if (!stuff->width || !stuff->height) {        client->errorValue = 0;        return BadValue;    }    if (stuff->width > 32767 || stuff->height > 32767)        return BadAlloc;    if (stuff->depth != 1) {        DepthPtr depth = drawable->pScreen->allowedDepths;        int i;        for (i = 0; i < drawable->pScreen->numDepths; i++, depth++)            if (depth->depth == stuff->depth)                break;        if (i == drawable->pScreen->numDepths) {            client->errorValue = stuff->depth;            return BadValue;        }    }    fd = ReadFdFromClient(client);    if (fd < 0)        return BadValue;    rc = dri3_pixmap_from_fd(&pixmap,                             drawable->pScreen, fd,                             stuff->width, stuff->height,                             stuff->stride, stuff->depth,                             stuff->bpp);    close (fd);    if (rc != Success)        return rc;    pixmap->drawable.id = stuff->pixmap;    /* security creation/labeling check */    rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pixmap, RT_PIXMAP,                  pixmap, RT_NONE, NULL, DixCreateAccess);    if (rc != Success) {        (*drawable->pScreen->DestroyPixmap) (pixmap);        return rc;    }    if (AddResource(stuff->pixmap, RT_PIXMAP, (void *) pixmap))        return Success;    return Success;}
开发者ID:ChristophHaag,项目名称:xserver-prime-sync,代码行数:66,


示例24: dri3_send_config_notify

voiddri3_send_config_notify(WindowPtr window, int x, int y, int w, int h, int bw, WindowPtr sibling){    dri3_window_priv_ptr window_priv = dri3_window_priv(window);    if (window_priv) {        xDRI3ConfigureNotify cn = {            .type = GenericEvent,            .extension = dri3_request,            .length = (sizeof(xDRI3ConfigureNotify) - 32) >> 2,            .evtype = DRI3_ConfigureNotify,            .eid = 0,            .window = window->drawable.id,            .x = x,            .y = y,            .width = w,            .height = h,            .off_x = 0,            .off_y = 0,            .pixmap_width = w,            .pixmap_height = h,            .pixmap_flags = 0        };        dri3_event_ptr event;        dri3_screen_priv_ptr screen_priv = dri3_screen_priv(window->drawable.pScreen);        if (screen_priv->info && screen_priv->info->driver_config)            screen_priv->info->driver_config(window, &cn);        for (event = window_priv->events; event; event = event->next) {            if (event->mask & (1 << DRI3ConfigureNotify)) {                cn.eid = event->id;                WriteEventsToClient(event->client, 1, (xEvent *) &cn);            }        }    }}intdri3_select_input(ClientPtr client, XID eid, WindowPtr window, CARD32 mask){    dri3_window_priv_ptr window_priv = dri3_window_priv(window);    dri3_event_ptr event;    if (!window_priv)        return BadAlloc;    event = calloc (1, sizeof (dri3_event_rec));    if (!event)        return BadAlloc;    event->client = client;    event->window = window;    event->id = eid;    event->mask = mask;    event->next = window_priv->events;    window_priv->events = event;    if (!AddResource(event->id, dri3_event_type, (pointer) event))        return BadAlloc;    return Success;}
开发者ID:dlespiau,项目名称:xserver,代码行数:64,


示例25: compRedirectWindow

/* * Redirect one window for one client */intcompRedirectWindow (ClientPtr pClient, WindowPtr pWin, int update){    CompWindowPtr	cw = GetCompWindow (pWin);    CompClientWindowPtr	ccw;    Bool		wasMapped = pWin->mapped;    CompScreenPtr       cs = GetCompScreen(pWin->drawable.pScreen);        if (pWin == cs->pOverlayWin) {	return Success;    }    if (!pWin->parent)	return BadMatch;    /*     * Only one Manual update is allowed     */    if (cw && update == CompositeRedirectManual)	for (ccw = cw->clients; ccw; ccw = ccw->next)	    if (ccw->update == CompositeRedirectManual)		return BadAccess;        /*     * Allocate per-client per-window structure      * The client *could* allocate multiple, but while supported,     * it is not expected to be common     */    ccw = malloc(sizeof (CompClientWindowRec));    if (!ccw)	return BadAlloc;    ccw->id = FakeClientID (pClient->index);    ccw->update = update;    /*     * Now make sure there's a per-window structure to hang this from     */    if (!cw)    {	cw = malloc(sizeof (CompWindowRec));	if (!cw)	{	    free(ccw);	    return BadAlloc;	}	cw->damage = DamageCreate (compReportDamage,				   compDestroyDamage,				   DamageReportNonEmpty,				   FALSE,				   pWin->drawable.pScreen,				   pWin);	if (!cw->damage)	{	    free(ccw);	    free(cw);	    return BadAlloc;	}	if (wasMapped)	{	    DisableMapUnmapEvents (pWin);	    UnmapWindow (pWin, FALSE);	    EnableMapUnmapEvents (pWin);	}	RegionNull(&cw->borderClip);	cw->borderClipX = 0;	cw->borderClipY = 0;	cw->update = CompositeRedirectAutomatic;	cw->clients = 0;	cw->oldx = COMP_ORIGIN_INVALID;	cw->oldy = COMP_ORIGIN_INVALID;	cw->damageRegistered = FALSE;	cw->damaged = FALSE;	cw->pOldPixmap = NullPixmap;	dixSetPrivate(&pWin->devPrivates, CompWindowPrivateKey, cw);    }    ccw->next = cw->clients;    cw->clients = ccw;    if (!AddResource (ccw->id, CompositeClientWindowType, pWin))	return BadAlloc;    if (ccw->update == CompositeRedirectManual)    {	/* If the window was CompositeRedirectAutomatic, then	 * unmap the window so that the parent clip list will	 * be correctly recomputed.	 */	if (pWin->mapped) 	{	    DisableMapUnmapEvents (pWin);	    UnmapWindow (pWin, FALSE);	    EnableMapUnmapEvents (pWin);	}	if (cw->damageRegistered)	{	    DamageUnregister (&pWin->drawable, cw->damage);	    cw->damageRegistered = FALSE;	}	cw->update = CompositeRedirectManual;//.........这里部分代码省略.........
开发者ID:Agnarr,项目名称:xserver,代码行数:101,


示例26: compRedirectSubwindows

intcompRedirectSubwindows (ClientPtr pClient, WindowPtr pWin, int update){    CompSubwindowsPtr	csw = GetCompSubwindows (pWin);    CompClientWindowPtr	ccw;    WindowPtr		pChild;    /*     * Only one Manual update is allowed     */    if (csw && update == CompositeRedirectManual)	for (ccw = csw->clients; ccw; ccw = ccw->next)	    if (ccw->update == CompositeRedirectManual)		return BadAccess;    /*     * Allocate per-client per-window structure      * The client *could* allocate multiple, but while supported,     * it is not expected to be common     */    ccw = malloc(sizeof (CompClientWindowRec));    if (!ccw)	return BadAlloc;    ccw->id = FakeClientID (pClient->index);    ccw->update = update;    /*     * Now make sure there's a per-window structure to hang this from     */    if (!csw)    {	csw = malloc(sizeof (CompSubwindowsRec));	if (!csw)	{	    free(ccw);	    return BadAlloc;	}	csw->update = CompositeRedirectAutomatic;	csw->clients = 0;	dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, csw);    }    /*     * Redirect all existing windows     */    for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)    {	int ret = compRedirectWindow (pClient, pChild, update);	if (ret != Success)	{	    for (pChild = pChild->nextSib; pChild; pChild = pChild->nextSib)		(void) compUnredirectWindow (pClient, pChild, update);	    if (!csw->clients)	    {		free(csw);		dixSetPrivate(&pWin->devPrivates, CompSubwindowsPrivateKey, 0);	    }	    free(ccw);	    return ret;	}    }    /*     * Hook into subwindows list     */    ccw->next = csw->clients;    csw->clients = ccw;    if (!AddResource (ccw->id, CompositeClientSubwindowsType, pWin))	return BadAlloc;    if (ccw->update == CompositeRedirectManual)    {	csw->update = CompositeRedirectManual;	/* 	 * tell damage extension that damage events for this client are	 * critical output	 */	DamageExtSetCritical (pClient, TRUE);    }    return Success;}
开发者ID:Agnarr,项目名称:xserver,代码行数:76,


示例27: ProcPanoramiXShmCreatePixmap

static intProcPanoramiXShmCreatePixmap(ClientPtr client){    ScreenPtr pScreen = NULL;    PixmapPtr pMap = NULL;    DrawablePtr pDraw;    DepthPtr pDepth;    int i, j, result, rc;    ShmDescPtr shmdesc;    REQUEST(xShmCreatePixmapReq);    unsigned int width, height, depth;    unsigned long size;    PanoramiXRes *newPix;    REQUEST_SIZE_MATCH(xShmCreatePixmapReq);    client->errorValue = stuff->pid;    if (!sharedPixmaps)	return BadImplementation;    LEGAL_NEW_RESOURCE(stuff->pid, client);    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,			   DixGetAttrAccess);    if (rc != Success)	return rc;    VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);    width = stuff->width;    height = stuff->height;    depth = stuff->depth;    if (!width || !height || !depth)    {	client->errorValue = 0;        return BadValue;    }    if (width > 32767 || height > 32767)        return BadAlloc;    if (stuff->depth != 1)    {        pDepth = pDraw->pScreen->allowedDepths;        for (i=0; i<pDraw->pScreen->numDepths; i++, pDepth++)	   if (pDepth->depth == stuff->depth)               goto CreatePmap;	client->errorValue = stuff->depth;        return BadValue;    }CreatePmap:    size = PixmapBytePad(width, depth) * height;    if (sizeof(size) == 4 && BitsPerPixel(depth) > 8) {        if (size < width * height)            return BadAlloc;    }    /* thankfully, offset is unsigned */    if (stuff->offset + size < size)	return BadAlloc;    VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);    if(!(newPix = malloc(sizeof(PanoramiXRes))))	return BadAlloc;    newPix->type = XRT_PIXMAP;    newPix->u.pix.shared = TRUE;    newPix->info[0].id = stuff->pid;    for(j = 1; j < PanoramiXNumScreens; j++)	newPix->info[j].id = FakeClientID(client->index);    result = Success;    FOR_NSCREENS(j) {	ShmScrPrivateRec *screen_priv;	pScreen = screenInfo.screens[j];	screen_priv = ShmGetScreenPriv(pScreen);	pMap = (*screen_priv->shmFuncs->CreatePixmap)(pScreen,				stuff->width, stuff->height, stuff->depth,				shmdesc->addr + stuff->offset);	if (pMap) {	    dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);            shmdesc->refcnt++;	    pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;	    pMap->drawable.id = newPix->info[j].id;	    if (!AddResource(newPix->info[j].id, RT_PIXMAP, (pointer)pMap)) {		(*pScreen->DestroyPixmap)(pMap);		result = BadAlloc;		break;	    }	} else {	   result = BadAlloc;	   break;	}    }    if(result == BadAlloc) {	while(j--) {	    (*pScreen->DestroyPixmap)(pMap);	    FreeResource(newPix->info[j].id, RT_NONE);	}//.........这里部分代码省略.........
开发者ID:Agnarr,项目名称:xserver,代码行数:101,


示例28: ProcShmCreatePixmap

static intProcShmCreatePixmap(ClientPtr client){    PixmapPtr pMap;    DrawablePtr pDraw;    DepthPtr pDepth;    int i, rc;    ShmDescPtr shmdesc;    ShmScrPrivateRec *screen_priv;    REQUEST(xShmCreatePixmapReq);    unsigned int width, height, depth;    unsigned long size;    REQUEST_SIZE_MATCH(xShmCreatePixmapReq);    client->errorValue = stuff->pid;    if (!sharedPixmaps)	return BadImplementation;    LEGAL_NEW_RESOURCE(stuff->pid, client);    rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,			   DixGetAttrAccess);    if (rc != Success)	return rc;    VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client);        width = stuff->width;    height = stuff->height;    depth = stuff->depth;    if (!width || !height || !depth)    {	client->errorValue = 0;        return BadValue;    }    if (width > 32767 || height > 32767)	return BadAlloc;    if (stuff->depth != 1)    {        pDepth = pDraw->pScreen->allowedDepths;        for (i=0; i<pDraw->pScreen->numDepths; i++, pDepth++)	   if (pDepth->depth == stuff->depth)               goto CreatePmap;	client->errorValue = stuff->depth;        return BadValue;    }CreatePmap:    size = PixmapBytePad(width, depth) * height;    if (sizeof(size) == 4 && BitsPerPixel(depth) > 8) {	if (size < width * height)	    return BadAlloc;    }    /* thankfully, offset is unsigned */    if (stuff->offset + size < size)	return BadAlloc;    VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client);    screen_priv = ShmGetScreenPriv(pDraw->pScreen);    pMap = (*screen_priv->shmFuncs->CreatePixmap)(			    pDraw->pScreen, stuff->width,			    stuff->height, stuff->depth,			    shmdesc->addr + stuff->offset);    if (pMap)    {	rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP,		      pMap, RT_NONE, NULL, DixCreateAccess);	if (rc != Success) {	    pDraw->pScreen->DestroyPixmap(pMap);	    return rc;	}	dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc);	shmdesc->refcnt++;	pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;	pMap->drawable.id = stuff->pid;	if (AddResource(stuff->pid, RT_PIXMAP, (pointer)pMap))	{	    return Success;	}	pDraw->pScreen->DestroyPixmap(pMap);    }    return BadAlloc;}
开发者ID:Agnarr,项目名称:xserver,代码行数:82,



注:本文中的AddResource函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ AddRoot函数代码示例
C++ AddRef函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。