コード例 #1
0
ファイル: VPXDecoder.cpp プロジェクト: jld/gecko-dev
RefPtr<MediaDataDecoder::InitPromise> VPXDecoder::Init() {
  if (NS_FAILED(InitContext(&mVPX, mInfo, mCodec, mLowLatency))) {
    return VPXDecoder::InitPromise::CreateAndReject(
        NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__);
  }
  if (mInfo.HasAlpha()) {
    if (NS_FAILED(InitContext(&mVPXAlpha, mInfo, mCodec, mLowLatency))) {
      return VPXDecoder::InitPromise::CreateAndReject(
          NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__);
    }
  }
  return VPXDecoder::InitPromise::CreateAndResolve(TrackInfo::kVideoTrack,
                                                   __func__);
}
コード例 #2
0
ファイル: main.c プロジェクト: poupou9779/zSweeper
int main(int ac, char **av)
{
    context_t context;
    int r;
    if(SDL_Init(SDL_INIT_VIDEO) < 0)
    {
        fprintf(stderr, "Failed to init SDL : '%s'\n", SDL_GetError());
        return EXIT_FAILURE;
    }
    atexit(SDL_Quit);
    SDL_WM_SetCaption("Minesweeper", NULL);
    SDL_WM_SetIcon(SDL_LoadBMP("ico.bmp"), NULL);
    InitContext(&context);
    do
    {
        switch(r = Menu(&context))
        {
        case PLAY:
            Play(&context);
            break;
        case SETTINGS:
            Settings(&context);
            break;
        default:
            break;
        }
    }
    while(r != EXIT);
    FreeContext(&context);
    return 0;
    (void)ac;
    (void)av;
}
コード例 #3
0
void FAnimNode_StateMachine::SetState(const FAnimationBaseContext& Context, int32 NewStateIndex)
{
	if (NewStateIndex != CurrentState)
	{
		const int32 PrevStateIndex = CurrentState;
		if(CurrentState != INDEX_NONE && CurrentState < OnGraphStatesExited.Num())
		{
			OnGraphStatesExited[CurrentState].ExecuteIfBound(*this, CurrentState, NewStateIndex);
		}

		// Determine if the new state is active or not
		const bool bAlreadyActive = GetStateWeight(NewStateIndex) > 0.0f;

		SetStateInternal(NewStateIndex);

		if (!bAlreadyActive && !IsAConduitState(NewStateIndex))
		{
			// Initialize the new state since it's not part of an active transition (and thus not still initialized)
			FAnimationInitializeContext InitContext(Context.AnimInstance);
			StatePoseLinks[NewStateIndex].Initialize(InitContext);

			// Also update BoneCaching.
			FAnimationCacheBonesContext CacheBoneContext(Context.AnimInstance);
			StatePoseLinks[NewStateIndex].CacheBones(CacheBoneContext);
		}

		if(CurrentState != INDEX_NONE && CurrentState < OnGraphStatesEntered.Num())
		{
			OnGraphStatesEntered[CurrentState].ExecuteIfBound(*this, PrevStateIndex, CurrentState);
		}
	}
}
コード例 #4
0
ファイル: main.c プロジェクト: poupou9779/zSokoban
int main(int argc, char **argv)
{
    int tmp;
    context_t context;
    if(SDL_Init(SDL_INIT_VIDEO) < 0)
        return EXIT_FAILURE;
    atexit(SDL_Quit);
    if(!InitContext(&context))
    {
        fprintf(stderr, "Unable to load screen\n");
        return EXIT_FAILURE;
    }
    SDL_ShowCursor(0);
    SDL_WM_SetCaption("Minecraft Sokoban", NULL);
    SDL_WM_SetIcon(SDL_LoadBMP("ico32.bmp"), NULL);
    SDL_EnableKeyRepeat(125, 125);
    do
    {
        SDL_FreeSurface(context.screen);
        context.screen = SDL_SetVideoMode(768, 768, 32, SDL_HWSURFACE|SDL_DOUBLEBUF);
        tmp = Menu(context.screen);
        if(tmp == PLAY)
            Play(&context, 1);
        else if(tmp == EDIT)
            Editor(&context);
        else if(tmp == TILE)
            ChoseTileset(&context);
    }
    while(tmp != EXIT);
    FreeContext(&context);
    return EXIT_SUCCESS;
    (void)argc;
    (void)argv;
}
コード例 #5
0
// TODO(Hanzhang): According to AVOID_CONTENTION_IN_SCAN, we choose the
// strategy. We need finish case(1).
bool PhysicalProjectionScan::Next(SegmentExecStatus* const exec_status,
                                  BlockStreamBase* block) {
  RETURN_IF_CANCELLED(exec_status);

  unsigned long long total_start = curtick();
  if (!block->isIsReference()) {
    block->setIsReference(false);
  }
#ifdef AVOID_CONTENTION_IN_SCAN
  ScanThreadContext* stc = reinterpret_cast<ScanThreadContext*>(GetContext());
  if (NULL == stc) {
    stc = new ScanThreadContext();
    InitContext(stc);
  }
  if (ExpanderTracker::getInstance()->isExpandedThreadCallBack(
          pthread_self())) {
    input_dataset_.AtomicPut(stc->assigned_data_);
    delete stc;
    destorySelfContext();
    kPerfInfo->report_instance_performance_in_millibytes();
    return false;
  }

  if (!stc->assigned_data_.empty()) {
    ChunkReaderIterator::block_accessor* ba = stc->assigned_data_.front();
    stc->assigned_data_.pop_front();

    ba->GetBlock(block);

    // whether delete InMemeryBlockAccessor::target_block_start_address
    // is depend on whether use copy in ba->getBlock(block);
    delete ba;
    kPerfInfo->processed_one_block();
    return true;
  } else {
    if (input_dataset_.AtomicGet(stc->assigned_data_, Config::scan_batch)) {
      // case(1)
      return Next(block);
    } else {
      delete stc;
      destorySelfContext();
      return false;
    }
  }

#else

  if (ExpanderTracker::getInstance()->isExpandedThreadCallBack(
          pthread_self())) {
    return false;
  }
  //  perf_info_->processed_one_block();
  // case(2)
  RETURN_IF_CANCELLED(exec_status);
  return partition_reader_iterator_->NextBlock(block);

#endif
}
コード例 #6
0
STDMETHODIMP CMapiImp::SaveMail(unsigned long aSession, unsigned long ulUIParam,  lpnsMapiMessage lppMessage,
                              unsigned long flFlags, unsigned long ulReserved, LPTSTR lpszMessageID)
{
  MsgMapiListContext *listContext;
  LONG ret = InitContext(aSession, &listContext);
  if (ret != SUCCESS_SUCCESS)
    return ret;
  return S_OK;
}
コード例 #7
0
ファイル: AOMDecoder.cpp プロジェクト: bgrins/gecko-dev
RefPtr<MediaDataDecoder::InitPromise>
AOMDecoder::Init()
{
  if (NS_FAILED(InitContext(&mCodec, mInfo))) {
    return AOMDecoder::InitPromise::CreateAndReject(NS_ERROR_DOM_MEDIA_FATAL_ERR,
                                                    __func__);
  }
  return AOMDecoder::InitPromise::CreateAndResolve(TrackInfo::kVideoTrack,
                                                   __func__);
}
コード例 #8
0
ファイル: NetUser.cpp プロジェクト: jf4210/src2-test
CNetUser::CNetUser(ITcpContext* pTcpContext)
: m_bNoUse(FALSE)
, m_pTcpContext(pTcpContext)
, m_nRecvCount(0)
, m_nSendCount(0)
, m_wPort(0)
{
	m_pNetRecvBuffer = new CNetIoBuffer;
	m_pNetSendBuffer = new CNetIoSendBuffer;
	InitContext(pTcpContext);
}
コード例 #9
0
ファイル: physical_operator.cpp プロジェクト: dase/CLAIMS
ThreadContext* PhysicalOperator::CreateOrReuseContext(context_reuse_mode crm) {
  ThreadContext* target = GetFreeContext(crm);
  if (target != NULL) {
    return target;
  }

  target = CreateContext();
  target->set_locality_(GetCurrentCpuAffinity());
  InitContext(target);
  return target;
}
コード例 #10
0
ファイル: vaapicontext.cpp プロジェクト: mojie126/mythtv
bool VAAPIContext::CreateBuffers(void)
{
    bool ok = true;
    CREATE_CHECK(!m_size.isEmpty(), "Invalid size");
    CREATE_CHECK(InitBuffers(),     "Failed to create buffers.");
    CREATE_CHECK(InitContext(),     "Failed to create context");
    if (ok)
        LOG(VB_PLAYBACK, LOG_INFO, LOC +
            QString("Created %1 buffers").arg(m_numSurfaces));
    return ok;
}
コード例 #11
0
bool CslIrcSession::Connect(const CslIrcContext& context)
{
    m_context=context;

    if (InitContext(&m_context) && CslIrcEngine::GetThread()->Connect(m_context))
    {
        m_state=STATE_CONNECTING;
        return true;
    }

    return false;
}
コード例 #12
0
ファイル: eglglue.c プロジェクト: aosp/gfx_linux_ddk
/***********************************************************************************
 Function Name      : GLES2CreateGC
 Inputs             : psSysContext, psMode, hShareContext
 Outputs            : phContext
 Returns            : Success
 Description        : Called to create an graphics context
 ************************************************************************************/
static IMG_BOOL GLES2CreateGC(SrvSysContext *psSysContext,
							  EGLContextHandle *phContext,
							  EGLcontextMode *psMode,
							  EGLContextHandle hShareContext)
{
	GLES2Context *gc, *psShareContext;

	psShareContext = (GLES2Context *)hShareContext;

	gc = _GLES2CreateContext();

	if (!gc)
	{
		PVR_DPF((PVR_DBG_ERROR,"GLES2CreateGC: Can't alloc memory for the gc"));

		return IMG_FALSE;
	}

	gc->psSysContext = psSysContext;
	gc->ps3DDevData  = &psSysContext->s3D;
	
	if (!InitContext(gc, psShareContext, psMode))
	{
		PVR_DPF((PVR_DBG_ERROR,"GLES2CreateGC: Failed to init the gc"));

		goto Failed_GC_Creation;
	}

#if defined (TIMING) || defined (DEBUG)
	if (!InitMetrics(gc))
	{
		PVR_DPF((PVR_DBG_ERROR,"GLES2CreateGC: Metrics init failed"));

		goto Failed_GC_Creation;
	}

	InitProfileData(gc);
#endif

	*phContext = (EGLContextHandle)gc;

	return IMG_TRUE;


Failed_GC_Creation:

	DeInitContext(gc);

	_GLES2DestroyContext(gc);

	return IMG_FALSE;
}
コード例 #13
0
ファイル: MuPDFDoc.cpp プロジェクト: KhalidElSayed/windows8
HRESULT MuPDFDoc::Init(unsigned char *buffer, int bufferLen, const char *mimeType)
{
	HRESULT result = InitContext();
	if (FAILED(result))
	{
		return result;
	}
	else
	{
		result = InitDocument(buffer, bufferLen, mimeType);
		return result;
	}
}
コード例 #14
0
bool NativeEngine::PrepareToRender() {
    do {
        // if we're missing a surface, context, or display, create them
        if (mEglDisplay == EGL_NO_DISPLAY || mEglSurface == EGL_NO_SURFACE || 
                mEglContext == EGL_NO_CONTEXT) {

            // create display if needed
            if (!InitDisplay()) {
                LOGE("NativeEngine: failed to create display.");
                return false;
            }

            // create surface if needed
            if (!InitSurface()) {
                LOGE("NativeEngine: failed to create surface.");
                return false;
            }

            // create context if needed
            if (!InitContext()) {
                LOGE("NativeEngine: failed to create context.");
                return false;
            }

            LOGD("NativeEngine: binding surface and context (display %p, surface %p, context %p)", 
                    mEglDisplay, mEglSurface, mEglContext);

            // bind them
            if (EGL_FALSE == eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext)) {
                LOGE("NativeEngine: eglMakeCurrent failed, EGL error %d", eglGetError());
                HandleEglError(eglGetError());
            }

            // configure our global OpenGL settings
            ConfigureOpenGL();
        }

        // now that we're sure we have a context and all, if we don't have the OpenGL 
        // objects ready, create them.
        if (!mHasGLObjects) {
            LOGD("NativeEngine: creating OpenGL objects.");
            if (!InitGLObjects()) {
                LOGE("NativeEngine: unable to initialize OpenGL objects.");
                return false;
            }
        }
    } while(0);

    // ready to render
    return true;
}
コード例 #15
0
ファイル: PrintDialogPDE.c プロジェクト: fruitsamples/App
/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	Name:	MyPDEPrologue

	Input Parameters:
		none

	Output Parameters:
		context			:	The plugins context
		creator			: 	The creator type for this plugin
		userOptionKind		: 	The extension kind for the plugin
		title			: 	The title of this plugin.
		maxH			:	Maximum horizontal dimension required by client.
		maxV			:	Maximum vertical dimension required by client.
		err			:	returns the error status

	Description:
		Returns dimensions of content region desired by the client.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
static
OSStatus MyPDEPrologue(		PMPDEContext	*context,
                            OSType 			*creator,
                            CFStringRef		*userOptionKind,
                            CFStringRef 		*title,
                            UInt32 			*maxH,
                            UInt32 			*maxV)
{
    OSStatus err = noErr;
    PrintDialogPDEOnlyContextPtr myContext = NULL;	// Pointer to our context data.

    DebugMessage("PrintDialogPDE MyPDEPrologue called\n");

    err = InitContext(&myContext);

    if (noErr == err)
    {
        *context = (PMPDEContext) myContext;

        // calculate the maximum amount of screen real estate that this plugin needs.
        *maxH = kMAXH;
        *maxV = kMAXV;

        /*
            The semantics of the CFStrings represented by *title and *userOptionKind
            are 'Get' semantics: the caller will retain what it needs to retain.

            This means that we need to release this title string sometime after
            this routine returns. We put our reference to the string into our context
            data so we can release that string when we dispose of the context data.
        */
        myContext->titleStringRef = CopyLocalizedStringFromPlugin(
                                        CFSTR("Sample Application PDE"),
                                        CFSTR("the text of the popup menu"),
                                        myContext->theBundleRef);

        if (myContext->titleStringRef != NULL) {
            *title = myContext->titleStringRef;
        }

        *userOptionKind = kSampleAppUserOptionKindID;
        *creator = kPlugInCreator;
    }
    else
        err = kPMInvalidPDEContext;						// return an error

    DebugPrintErr(err, "PrintDialogPDE Error from MyPDEPrologue returned %d\n");

    return (err);
}
コード例 #16
0
ファイル: querydnsbase.c プロジェクト: kdrx/dnsforwarder
int GetHostsByName(const char *Name, const char *Agent, StringList *out)
{
	ThreadContext Context;

	InitContext(&Context, NULL);

	if( GetAnswersByName(&Context, Name, DNS_TYPE_A, Agent) <= 0 )
	{
		return 0;
	} else {
		return GetHostsByRaw(ExtendableBuffer_GetData(Context.ResponseBuffer), out);
	}

}
コード例 #17
0
STDMETHODIMP CMapiImp::DeleteMail(unsigned long aSession, unsigned long ulUIParam, LPTSTR lpszMessageID,
                              unsigned long flFlags, unsigned long ulReserved)
{
  PRInt32 irv;
  nsCAutoString keyString((char *) lpszMessageID);
  nsMsgKey msgKey = keyString.ToInteger(&irv);
  if (irv)
    return SUCCESS_SUCCESS;
  MsgMapiListContext *listContext;
  LONG ret = InitContext(aSession, &listContext);
  if (ret != SUCCESS_SUCCESS)
    return ret;
  return (listContext->DeleteMessage(msgKey)) ? SUCCESS_SUCCESS : MAPI_E_INVALID_MESSAGE;
}
コード例 #18
0
STDMETHODIMP CMapiImp::DeleteMail(unsigned long aSession, unsigned long ulUIParam, LPTSTR lpszMessageID,
                              unsigned long flFlags, unsigned long ulReserved)
{
  nsresult irv;
  nsAutoCString keyString((char *) lpszMessageID);
  nsMsgKey msgKey = keyString.ToInteger(&irv);
  // XXX Why do we return success on failure?
  if (NS_FAILED(irv))
    return SUCCESS_SUCCESS;
  MsgMapiListContext *listContext;
  LONG ret = InitContext(aSession, &listContext);
  if (ret != SUCCESS_SUCCESS)
    return ret;
  return (listContext->DeleteMessage(msgKey)) ? SUCCESS_SUCCESS : MAPI_E_INVALID_MESSAGE;
}
コード例 #19
0
ファイル: main.c プロジェクト: FredG71/IRC-client
int APIENTRY _tWinMain(
	HINSTANCE hInstance, 
	HINSTANCE hPrevInstance, 
	LPSTR lpCmdLine, 
	int nCmdShow
	)
{
	UNREFERENCED_PARAMETER(hPrevInstance);
	UNREFERENCED_PARAMETER(lpCmdLine);

	MSG msg;
	WNDCLASSEX wcex;
	HWND hParent;
	ATOM LeftKey = 0, RightKey = 0;

	wcex.cbSize = sizeof(WNDCLASSEX);
	wcex.cbClsExtra = 0;
	wcex.cbWndExtra = 0;
	wcex.hbrBackground = (HBRUSH)BLACK_BRUSH;
	wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
	wcex.hIcon = LoadIcon(NULL, IDI_APPLICATION);
	wcex.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
	wcex.hInstance = hInstance;
	wcex.lpfnWndProc = WndProc;
	wcex.lpszClassName = szParentClass;
	wcex.lpszMenuName = NULL;
	wcex.style = CS_VREDRAW | CS_HREDRAW;

	if (!RegisterClassEx(&wcex))
		exit(-1);

	hParent = CreateWindowEx(WS_EX_CLIENTEDGE, szParentClass, TEXT("Garner IRC v0.01"), WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
	assert(hParent);

	ShowWindow(hParent, nCmdShow);
	UpdateWindow(hParent);
	InitContext();
	SetupWindowKeys(hParent, LeftKey, RightKey);
	ContextIRC.hParent = hParent;
	pHash = Hash_Create(pHash, HashTransform);
	ChannelNames = strArray_Init(ChannelNames);
	while (GetMessage(&msg, NULL, 0, 0))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	return msg.wParam;
}
コード例 #20
0
AsynContext* WorldAsynContextManager::NewContext(char* pClassName)
{
	AsynContext* pContext = (AsynContext*)FactoryManager::Instance().New( pClassName );
	if(!pContext)
		return NULL;

	InitContext( pContext );

	if( !InsertContext( pContext ))
	{
		FACTORY_DELOBJ( pContext );
		return NULL;
	}

	return pContext;
}
コード例 #21
0
void FAnimationActiveTransitionEntry::InitializeCustomGraphLinks(const FAnimationUpdateContext& Context, const FBakedStateExitTransition& TransitionRule)
{
	if (TransitionRule.CustomResultNodeIndex != INDEX_NONE)
	{
		const UAnimBlueprintGeneratedClass* AnimBlueprintClass = Context.GetAnimBlueprintClass();
		CustomTransitionGraph.LinkID = AnimBlueprintClass->AnimNodeProperties.Num() - 1 - TransitionRule.CustomResultNodeIndex; //@TODO: Crazysauce
		FAnimationInitializeContext InitContext(Context.AnimInstance);
		CustomTransitionGraph.Initialize(InitContext);

		for (int32 Index = 0; Index < TransitionRule.PoseEvaluatorLinks.Num(); ++Index)
		{
			FAnimNode_TransitionPoseEvaluator* PoseEvaluator = GetNodeFromPropertyIndex<FAnimNode_TransitionPoseEvaluator>(Context.AnimInstance, AnimBlueprintClass, TransitionRule.PoseEvaluatorLinks[Index]);
			PoseEvaluators.Add(PoseEvaluator);
		}
	}
}
コード例 #22
0
ファイル: Engine.cpp プロジェクト: cllpyl/OpenGL-SDL
void Engine::Initialize()
{
    InitContext();

	//Force GLEW to use experimental draw calls, but they are supported by the card
	glewExperimental = true;

	if (glewInit() != GLEW_OK) return;

	if (App)
	{
		App->Init();

	}
    EngineMainLoop();
}
コード例 #23
0
STDMETHODIMP CMapiImp::FindNext(unsigned long aSession, unsigned long ulUIParam, LPTSTR lpszMessageType,
                              LPTSTR lpszSeedMessageID, unsigned long flFlags, unsigned long ulReserved,
                              unsigned char lpszMessageID[64])

{
  //
  // If this is true, then this is the first call to this FindNext function
  // and we should start the enumeration operation.
  //

  *lpszMessageID = '\0';
  nsMAPIConfiguration * pMapiConfig = nsMAPIConfiguration::GetMAPIConfiguration() ;
  if (!pMapiConfig) 
  {
    NS_ASSERTION(PR_FALSE, "failed to get config in findnext");
    return NS_ERROR_FAILURE ;  // get the singelton obj
  }
  MsgMapiListContext *listContext;
  LONG ret = InitContext(aSession, &listContext);
  if (ret != SUCCESS_SUCCESS)
  {
    NS_ASSERTION(PR_FALSE, "init context failed");
    return ret;
  }
  NS_ASSERTION(listContext, "initContext returned null context");
  if (listContext)
  {
//    NS_ASSERTION(PR_FALSE, "find next init context succeeded");
    nsMsgKey nextKey = listContext->GetNext();
    if (nextKey == nsMsgKey_None)
    {
      pMapiConfig->SetMapiListContext(aSession, NULL);
      delete listContext;
      return(MAPI_E_NO_MESSAGES);
    }

//    TRACE("MAPI: ProcessMAPIFindNext() Found message id = %d\n", nextKey);

    sprintf((char *) lpszMessageID, "%d", nextKey);
  }

  PR_LOG(MAPI, PR_LOG_DEBUG, ("CMapiImp::FindNext returning key %s\n", (char *) lpszMessageID));
  return(SUCCESS_SUCCESS);
}
コード例 #24
0
ファイル: GLmain.cpp プロジェクト: Yuriy29/GL2DImageTo3DOOP
int WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow )
{
    UNREFERENCED_PARAMETER( hPrevInstance );
    UNREFERENCED_PARAMETER( lpCmdLine );

	Renderer *render = NULL;

    if( FAILED( InitWindow( hInstance, nCmdShow ) ) )
        return 0;

	if( FAILED( InitCompatibleContext() ) )
		return 0;

	if( FAILED( InitContext() ) )
    {
		render = new Renderer(g_hWnd);
        render->CleanupContext();
        return 0;
    }
	render = new Renderer(g_hWnd);
	render->getScene()->InitGeometryScene();
	

    MSG msg = {0};
    while( WM_QUIT != msg.message )
    {
		 if( PeekMessage( &msg, NULL, 0, 0, PM_REMOVE ) )
			{
				TranslateMessage( &msg );
				DispatchMessage( &msg );
			}
		  else
			{
				render->Render();
			}
    }

    render->CleanupContext();

    return ( int )msg.wParam;
}
コード例 #25
0
STDMETHODIMP CMapiImp::ReadMail(unsigned long aSession, unsigned long ulUIParam, LPTSTR lpszMessageID,
                              unsigned long flFlags, unsigned long ulReserved, lpnsMapiMessage *lppMessage)
{
  PRInt32 irv;
  nsCAutoString keyString((char *) lpszMessageID);
  PR_LOG(MAPI, PR_LOG_DEBUG, ("CMapiImp::ReadMail asking for key %s\n", (char *) lpszMessageID));
  nsMsgKey msgKey = keyString.ToInteger(&irv);
  if (irv)
  {
    NS_ASSERTION(PR_FALSE, "invalid lpszMessageID");
    return MAPI_E_INVALID_MESSAGE;
  }
  MsgMapiListContext *listContext;
  LONG ret = InitContext(aSession, &listContext);
  if (ret != SUCCESS_SUCCESS)
  {
    NS_ASSERTION(PR_FALSE, "init context failed in ReadMail");
    return ret;
  }
  *lppMessage = listContext->GetMessage (msgKey, flFlags);
  NS_ASSERTION(*lppMessage, "get message failed");

  return (*lppMessage) ? SUCCESS_SUCCESS : E_FAIL;
}
コード例 #26
0
ファイル: OpenGLDrv.cpp プロジェクト: JettHuang/JetX
//\brief
//	initialize the gl extension functions address.
static bool InitializeGlew()
{
	GLenum err;
	GLContext ctx;

	/* create OpenGL rendering context */
	InitContext(&ctx);
	if (GL_TRUE == CreateContext(&ctx))
	{
		std::cout << "Error: CreateContext failed" << std::endl;
		DestroyContext(&ctx);
		return false;
	}

	/* initialize GLEW */
	glewExperimental = GL_TRUE;
#ifdef GLEW_MX
	err = glewContextInit(glewGetContext());
#  ifdef _WIN32
	err = err || wglewContextInit(wglewGetContext());
#  elif !defined(__APPLE__) && !defined(__HAIKU__) || defined(GLEW_APPLE_GLX)
	err = err || glxewContextInit(glxewGetContext());
#  endif
#else
	err = glewInit();
#endif
	if (GLEW_OK != err)
	{
		std::cout << "Error [main]: glewInit failed: " << glewGetErrorString(err) << std::endl;
		DestroyContext(&ctx);
		return false;
	}

	DestroyContext(&ctx);
	return true;
}
コード例 #27
0
void FAnimationActiveTransitionEntry::InitializeCustomGraphLinks(const FAnimationUpdateContext& Context, const FBakedStateExitTransition& TransitionRule)
{
	if (TransitionRule.CustomResultNodeIndex != INDEX_NONE)
	{
		const IAnimClassInterface* AnimBlueprintClass = Context.GetAnimClass();
		CustomTransitionGraph.LinkID = AnimBlueprintClass->GetAnimNodeProperties().Num() - 1 - TransitionRule.CustomResultNodeIndex; //@TODO: Crazysauce
		FAnimationInitializeContext InitContext(Context.AnimInstanceProxy);
		CustomTransitionGraph.Initialize(InitContext);

		for (int32 Index = 0; Index < TransitionRule.PoseEvaluatorLinks.Num(); ++Index)
		{
			FAnimNode_TransitionPoseEvaluator* PoseEvaluator = GetNodeFromPropertyIndex<FAnimNode_TransitionPoseEvaluator>(Context.AnimInstanceProxy->GetAnimInstanceObject(), AnimBlueprintClass, TransitionRule.PoseEvaluatorLinks[Index]);
			PoseEvaluators.Add(PoseEvaluator);
		}
	}

	// Initialize blend data if necessary
	if(BlendProfile)
	{
		StateBlendData.AddZeroed(2);
		StateBlendData[0].PerBoneBlendData.AddZeroed(BlendProfile->GetNumBlendEntries());
		StateBlendData[1].PerBoneBlendData.AddZeroed(BlendProfile->GetNumBlendEntries());
	}
}
コード例 #28
0
void UAnimInstance::InitializeAnimation()
{
	// make sure your skeleton is initialized
	// you can overwrite different skeleton
	USkeletalMeshComponent* OwnerComponent = GetSkelMeshComponent();
	if (OwnerComponent->SkeletalMesh != NULL)
	{
		CurrentSkeleton = OwnerComponent->SkeletalMesh->Skeleton;
	}
	else
	{
		CurrentSkeleton = NULL;
	}

	if (UAnimBlueprintGeneratedClass* AnimBlueprintClass = Cast<UAnimBlueprintGeneratedClass>(GetClass()))
	{
		// Grab a pointer to the root node
		if (AnimBlueprintClass->RootAnimNodeProperty != NULL)
		{
			RootNode = AnimBlueprintClass->RootAnimNodeProperty->ContainerPtrToValuePtr<FAnimNode_Base>(this);
		}
		else
		{
			RootNode = NULL;
		}

		// if no mesh, use Blueprint Skeleton
		if (CurrentSkeleton == NULL)
		{
			CurrentSkeleton = AnimBlueprintClass->TargetSkeleton;
		}

#if WITH_EDITORONLY_DATA
		if (UAnimBlueprint* Blueprint = Cast<UAnimBlueprint>(AnimBlueprintClass->ClassGeneratedBy))
		{
			if (Blueprint->Status == BS_Error)
			{
				RootNode = NULL;
			}
		}
#endif

#if WITH_EDITOR
		LifeTimer = 0.0;
		CurrentLifeTimerScrubPosition = 0.0;

		if (UAnimBlueprint* Blueprint = Cast<UAnimBlueprint>(AnimBlueprintClass->ClassGeneratedBy))
		{
			if (Blueprint->GetObjectBeingDebugged() == this)
			{
				// Reset the snapshot buffer
				AnimBlueprintClass->GetAnimBlueprintDebugData().ResetSnapshotBuffer();
			}
		}
#endif
	}

	// before initialize, need to recalculate required bone list
	RecalcRequiredBones();

	// Clear cached list, we're about to re-update it.

	ActiveSlotWeights.Empty();

	ClearMorphTargets();
	NativeInitializeAnimation();
	BlueprintInitializeAnimation();

	if (RootNode != NULL)
	{
		IncrementContextCounter();
		FAnimationInitializeContext InitContext(this);
		RootNode->Initialize(InitContext);
	}
}
コード例 #29
0
int
main (int argc, char** argv)
{
  GLenum err;
  GLContext ctx;

  /* ---------------------------------------------------------------------- */
  /* parse arguments */
  if (GL_TRUE == ParseArgs(argc-1, argv+1))
  {
#if defined(_WIN32)
    fprintf(stderr, "Usage: visualinfo [-a] [-s] [-h] [-pf <id>]\n");
    fprintf(stderr, "        -a: show all visuals\n");
    fprintf(stderr, "        -s: display to stdout instead of visualinfo.txt\n");
    fprintf(stderr, "        -pf <id>: use given pixelformat\n");
    fprintf(stderr, "        -h: this screen\n");
#else
    fprintf(stderr, "Usage: visualinfo [-h] [-display <display>] [-visual <id>]\n");
    fprintf(stderr, "        -h: this screen\n");
    fprintf(stderr, "        -display <display>: use given display\n");
    fprintf(stderr, "        -visual <id>: use given visual\n");
#endif
    return 1;
  }

  /* ---------------------------------------------------------------------- */
  /* create OpenGL rendering context */
  InitContext(&ctx);
  if (GL_TRUE == CreateContext(&ctx))
  {
    fprintf(stderr, "Error: CreateContext failed\n");
    DestroyContext(&ctx);
    return 1;
  }

  /* ---------------------------------------------------------------------- */
  /* initialize GLEW */
  glewExperimental = GL_TRUE;
#ifdef GLEW_MX
  err = glewContextInit(glewGetContext());
#  ifdef _WIN32
  err = err || wglewContextInit(wglewGetContext());
#  elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
  err = err || glxewContextInit(glxewGetContext());
#  endif
#else
  err = glewInit();
#endif
  if (GLEW_OK != err)
  {
    fprintf(stderr, "Error [main]: glewInit failed: %s\n", glewGetErrorString(err));
    DestroyContext(&ctx);
    return 1;
  }

  /* ---------------------------------------------------------------------- */
  /* open file */
#if defined(_WIN32)
  if (!displaystdout)
    file = fopen("visualinfo.txt", "w");
  if (file == NULL)
    file = stdout;
#else
  file = stdout;
#endif

  /* ---------------------------------------------------------------------- */
  /* output header information */
  /* OpenGL extensions */
  fprintf(file, "OpenGL vendor string: %s\n", glGetString(GL_VENDOR));
  fprintf(file, "OpenGL renderer string: %s\n", glGetString(GL_RENDERER));
  fprintf(file, "OpenGL version string: %s\n", glGetString(GL_VERSION));
  fprintf(file, "OpenGL extensions (GL_): \n");
  PrintExtensions((char*)glGetString(GL_EXTENSIONS));
  /* GLU extensions */
  fprintf(file, "GLU version string: %s\n", gluGetString(GLU_VERSION));
  fprintf(file, "GLU extensions (GLU_): \n");
  PrintExtensions((char*)gluGetString(GLU_EXTENSIONS));

  /* ---------------------------------------------------------------------- */
  /* extensions string */
#if defined(_WIN32)
  /* WGL extensions */
  if (WGLEW_ARB_extensions_string || WGLEW_EXT_extensions_string)
  {
    fprintf(file, "WGL extensions (WGL_): \n");
    PrintExtensions(wglGetExtensionsStringARB ?
                    (char*)wglGetExtensionsStringARB(ctx.dc) :
            (char*)wglGetExtensionsStringEXT());
  }
#elif defined(__APPLE__) && !defined(GLEW_APPLE_GLX)

#else
  /* GLX extensions */
  fprintf(file, "GLX extensions (GLX_): \n");
  PrintExtensions(glXQueryExtensionsString(glXGetCurrentDisplay(),
                                           DefaultScreen(glXGetCurrentDisplay())));
#endif

  /* ---------------------------------------------------------------------- */
  /* enumerate all the formats */
  VisualInfo(&ctx);

  /* ---------------------------------------------------------------------- */
  /* release resources */
  DestroyContext(&ctx);
  if (file != stdout)
    fclose(file);
  return 0;
}
コード例 #30
0
ファイル: video_display.cpp プロジェクト: Aegisub/Aegisub
void VideoDisplay::Render() try {
	if (!con->project->VideoProvider() || !InitContext() || (!videoOut && !pending_frame))
		return;

	if (!videoOut)
		videoOut = agi::make_unique<VideoOutGL>();

	if (!tool)
		cmd::call("video/tool/cross", con);

	try {
		if (pending_frame) {
			videoOut->UploadFrameData(*pending_frame);
			pending_frame.reset();
		}
	}
	catch (const VideoOutInitException& err) {
		wxLogError(
			"Failed to initialize video display. Closing other running "
			"programs and updating your video card drivers may fix this.\n"
			"Error message reported: %s",
			err.GetMessage());
		con->project->CloseVideo();
		return;
	}
	catch (const VideoOutRenderException& err) {
		wxLogError(
			"Could not upload video frame to graphics card.\n"
			"Error message reported: %s",
			err.GetMessage());
		return;
	}

	if (videoSize.GetWidth() == 0) videoSize.SetWidth(1);
	if (videoSize.GetHeight() == 0) videoSize.SetHeight(1);

	if (!viewport_height || !viewport_width)
		PositionVideo();

	videoOut->Render(viewport_left, viewport_bottom, viewport_width, viewport_height);
	E(glViewport(0, std::min(viewport_bottom, 0), videoSize.GetWidth(), videoSize.GetHeight()));

	E(glMatrixMode(GL_PROJECTION));
	E(glLoadIdentity());
	E(glOrtho(0.0f, videoSize.GetWidth() / scale_factor, videoSize.GetHeight() / scale_factor, 0.0f, -1000.0f, 1000.0f));

	if (OPT_GET("Video/Overscan Mask")->GetBool()) {
		double ar = con->videoController->GetAspectRatioValue();

		// Based on BBC's guidelines: http://www.bbc.co.uk/guidelines/dq/pdf/tv/tv_standards_london.pdf
		// 16:9 or wider
		if (ar > 1.75) {
			DrawOverscanMask(.1f, .05f);
			DrawOverscanMask(0.035f, 0.035f);
		}
		// Less wide than 16:9 (use 4:3 standard)
		else {
			DrawOverscanMask(.067f, .05f);
			DrawOverscanMask(0.033f, 0.035f);
		}
	}

	if ((mouse_pos || !autohideTools->GetBool()) && tool)
		tool->Draw();

	SwapBuffers();
}
catch (const agi::Exception &err) {
	wxLogError(
		"An error occurred trying to render the video frame on the screen.\n"
		"Error message reported: %s",
		err.GetMessage());
	con->project->CloseVideo();
}