void DisplayDevice::SetProjectionInTransactionLocked( /* [in] */ Int32 orientation, /* [in] */ IRect* layerStackRect, /* [in] */ IRect* displayRect) { Boolean isEquals; if (mCurrentOrientation != orientation || mCurrentLayerStackRect == NULL || !(mCurrentLayerStackRect->Equals(layerStackRect, &isEquals), isEquals) || mCurrentDisplayRect == NULL || !(mCurrentDisplayRect->Equals(displayRect, &isEquals), isEquals)) { mCurrentOrientation = orientation; if (mCurrentLayerStackRect == NULL) { ASSERT_SUCCEEDED(CRect::New((IRect**)&mCurrentLayerStackRect)); } mCurrentLayerStackRect->Set(layerStackRect); if (mCurrentDisplayRect == NULL) { ASSERT_SUCCEEDED(CRect::New((IRect**)&mCurrentDisplayRect)); } mCurrentDisplayRect->Set(displayRect); AutoPtr<ISurfaceControlHelper> surfaceControl; CSurfaceControlHelper::AcquireSingleton((ISurfaceControlHelper**)&surfaceControl); surfaceControl->SetDisplayProjection(mDisplayToken, orientation, layerStackRect, displayRect); } }
ID3D12CommandAllocator * CommandAllocatorPool::RequestAllocator(uint64_t CompletedFenceValue) { std::lock_guard<std::mutex> LockGuard(m_AllocatorMutex); ID3D12CommandAllocator* pAllocator = nullptr; if (!m_ReadyAllocators.empty()) { std::pair<uint64_t, ID3D12CommandAllocator*>& AllocatorPair = m_ReadyAllocators.front(); if (AllocatorPair.first <= CompletedFenceValue) { pAllocator = AllocatorPair.second; ASSERT_SUCCEEDED(pAllocator->Reset()); m_ReadyAllocators.pop(); } } // If no allocator's were ready to be reused, create a new one if (pAllocator == nullptr) { ASSERT_SUCCEEDED(m_Device->CreateCommandAllocator(m_cCommandListType, MY_IID_PPV_ARGS(&pAllocator))); wchar_t AllocatorName[32]; swprintf(AllocatorName, 32, L"CommandAllocator %zu", m_AllocatorPool.size()); pAllocator->SetName(AllocatorName); m_AllocatorPool.push_back(pAllocator); } return pAllocator; }
AutoPtr<IClassInfo> Utils::GetClassInfo( /* [in] */ const String& className, /* [in] */ Int32 flag) { if (flag == ELASTOS_DROID_CORE_ECO_FALG) { AutoPtr<IModuleInfo> m; ASSERT_SUCCEEDED(CReflector::AcquireModuleInfo(String("Elastos.Droid.Core.eco"), (IModuleInfo**)&m)); AutoPtr<IClassInfo> classInfo; m->GetClassInfo(className, (IClassInfo**)&classInfo); assert(classInfo != NULL); return classInfo; } if (sModuleInfo == NULL) { ASSERT_SUCCEEDED(CReflector::AcquireModuleInfo(sModulePath, (IModuleInfo**)&sModuleInfo)); assert(sModuleInfo != NULL); } String name = String("C") + className.Substring(className.LastIndexOf('.')); Logger::D(TAG, "the class name is [%s]", name.string()); AutoPtr<IClassInfo> classInfo; sModuleInfo->GetClassInfo(className, (IClassInfo**)&classInfo); assert(classInfo != NULL); return classInfo; }
ECode IconMerger::Init( /* [in] */ IContext* context, /* [in] */ IAttributeSet* attrs) { ASSERT_SUCCEEDED(LinearLayout::Init(context, attrs)); ASSERT_SUCCEEDED(InitIconSize(context, attrs)); return NOERROR; }
CAppWidgetHost::CAppWidgetHost() : mHostId(0) { ASSERT_SUCCEEDED(CApartment::New(TRUE, (IApartment**)&mHandler)); mHandler->Start(ApartmentAttr_New); ASSERT_SUCCEEDED(CAppWidgetHostCallbacks::New((ILocalAppWidgetHost*)this, (IAppWidgetHost**)&mCallbacks)); }
ECode RelativeLayoutLayoutParams::Init( /* [in] */ IContext* c, /* [in] */ IAttributeSet* attrs) { ASSERT_SUCCEEDED(ViewGroupMarginLayoutParams::Init(c, attrs)); ASSERT_SUCCEEDED(InitFromAttributes(c, attrs)); return NOERROR; }
ECode Chronometer::Init( /* [in] */ IContext* context, /* [in] */ IAttributeSet* attrs, /* [in] */ Int32 defStyle) { ASSERT_SUCCEEDED(TextView::Init(context, attrs, defStyle)); ASSERT_SUCCEEDED(InitInternal(context, attrs, defStyle)); return NOERROR; }
void CAnimatedAlphaWindow::Initialize() { UUID myCLSID_UIAnimationManager, myCLSID_UIAnimationTimer, myCLSID_UIAnimationTransitionLibrary; UuidFromString((RPC_WSTR)L"4C1FC63A-695C-47E8-A339-1A194BE3D0B8", &myCLSID_UIAnimationManager); UuidFromString((RPC_WSTR)L"BFCD4A0C-06B6-4384-B768-0DAA792C380E", &myCLSID_UIAnimationTimer); UuidFromString((RPC_WSTR)L"1D6322AD-AA85-4EF5-A828-86D71067D145", &myCLSID_UIAnimationTransitionLibrary); // Initialize WAM objects ASSERT_SUCCEEDED(mAnimMgr.CoCreateInstance(myCLSID_UIAnimationManager)); ASSERT_SUCCEEDED(mAnimTimer.CoCreateInstance(myCLSID_UIAnimationTimer)); ASSERT_SUCCEEDED(mTransLib.CoCreateInstance(myCLSID_UIAnimationTransitionLibrary)); // Connect the animation manager to the timer // UI_ANIMATION_IDLE_BEHAVIOR_DISABLE tells the timer to shut itself off when there is nothing to // animate CComQIPtr<IUIAnimationTimerUpdateHandler> spTimerUpdateHandler(mAnimMgr); ASSERT_SUCCEEDED(mAnimTimer->SetTimerUpdateHandler(spTimerUpdateHandler, UI_ANIMATION_IDLE_BEHAVIOR_DISABLE)); // Now connect the timer to this window CComObject<AnimTimerEventHandler> *evthandler; ASSERT_SUCCEEDED( CComObject<AnimTimerEventHandler>::CreateInstance(&evthandler)); evthandler->Initialize(boost::bind(UpdateCallback, this)); CComQIPtr<IUIAnimationTimerEventHandler> spTimerEventHandler(evthandler); ASSERT_SUCCEEDED(mAnimTimer->SetTimerEventHandler(spTimerEventHandler)); ASSERT_SUCCEEDED(mAnimTimer->SetFrameRateThreshold(300)); // Create animation variable(s) ASSERT_SUCCEEDED(mAnimMgr->CreateAnimationVariable(LARGE, &mAlphaVar)); ASSERT_SUCCEEDED(mAnimMgr->CreateAnimationVariable(mCurrentSweep, &mSweepVar)); }
LogicalDisplay::LogicalDisplay( /* [in] */ Int32 displayId, /* [in] */ Int32 layerStack, /* [in] */ DisplayDevice* primaryDisplayDevice) : mDisplayId(displayId) , mLayerStack(layerStack) , mPrimaryDisplayDevice(primaryDisplayDevice) , mHasContent(FALSE) { ASSERT_SUCCEEDED(CDisplayInfo::New((IDisplayInfo**)&mBaseDisplayInfo)); ASSERT_SUCCEEDED(CRect::New((IRect**)&mTempLayerStackRect)); ASSERT_SUCCEEDED(CRect::New((IRect**)&mTempDisplayRect)); }
ECode FastBitmapDrawable::Init( /* [in] */ IBitmap* bitmap) { mBitmap = bitmap; bitmap->GetWidth(&mWidth); bitmap->GetHeight(&mHeight); SetBounds(0, 0, mWidth, mHeight); ASSERT_SUCCEEDED(CPaint::New((IPaint**)&mPaint)); AutoPtr<IPorterDuffXfermode> mode; ASSERT_SUCCEEDED(CPorterDuffXfermode::New(Elastos::Droid::Graphics::PorterDuffMode_SRC, (IPorterDuffXfermode**)&mode)); mPaint->SetXfermode(mode); return NOERROR; }
ECode RelativeLayoutLayoutParams::Init( /* [in] */ Int32 width, /* [in] */ Int32 height) { ASSERT_SUCCEEDED(ViewGroupMarginLayoutParams::Init(width, height)); return NOERROR; }
ECode CWallpaperManager::SetStream( /* [in] */ IInputStream* data) { if (sGlobals->mService == NULL) { Slogger::W(TAG, "WallpaperService not running"); return NOERROR; } // try { AutoPtr<IParcelFileDescriptor> fd; FAIL_RETURN(sGlobals->mService->SetWallpaper(String(NULL), (IParcelFileDescriptor**)&fd)); if (fd == NULL) { return NOERROR; } AutoPtr<IFileOutputStream> fos; // try { AutoPtr<IFileDescriptor> des; fd->GetFileDescriptor((IFileDescriptor**)&des); ASSERT_SUCCEEDED(CFileOutputStream::New(des, (IFileOutputStream**)&fos)); // fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd); SetWallpaper(data, fos); // } finally { if (fos != NULL) { fos->Close(); } fd->Close(); return NOERROR; // } // } catch (RemoteException e) { // // Ignore // } }
ECode CWallpaperManager::SetBitmap( /* [in] */ IBitmap* bitmap) { if (sGlobals->mService == NULL) { Slogger::W(TAG, "WallpaperService not running"); return NOERROR; } // try { AutoPtr<IParcelFileDescriptor> fd; FAIL_RETURN(sGlobals->mService->SetWallpaper(String(NULL), (IParcelFileDescriptor**)&fd)); if (fd == NULL) { return NOERROR; } AutoPtr<IFileOutputStream> fos; // try { AutoPtr<IFileDescriptor> des; fd->GetFileDescriptor((IFileDescriptor**)&des); ASSERT_SUCCEEDED(CFileOutputStream::New(des, (IFileOutputStream**)&fos)); // fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd); Boolean result; bitmap->Compress(Elastos::Droid::Graphics::BitmapCompressFormat_PNG, 90, fos, &result); // } finally { if (fos != NULL) { fos->Close(); } fd->Close(); return NOERROR; // } // } catch (RemoteException e) { // // Ignore // } }
CWindowManagerLayoutParams::CWindowManagerLayoutParams() : mX(0) , mY(0) , mHorizontalWeight(0.0f) , mVerticalWeight(0.0f) , mType(0) , mMemoryType(0) , mFlags(0) , mPrivateFlags(0) , mSoftInputMode(0) , mGravity(0) , mHorizontalMargin(0.0f) , mVerticalMargin(0.0f) , mFormat(0) , mWindowAnimations(0) , mAlpha(1.0f) , mDimAmount(1.0f) , mScreenBrightness(BRIGHTNESS_OVERRIDE_NONE) , mButtonBrightness(BRIGHTNESS_OVERRIDE_NONE) , mScreenOrientation(IActivityInfo::SCREEN_ORIENTATION_UNSPECIFIED) , mSystemUiVisibility(0) , mSubtreeSystemUiVisibility(0) , mHasSystemUiListeners(FALSE) , mInputFeatures(0) , mUserActivityTimeout(-1) { ASSERT_SUCCEEDED(CString::New(String(""), (ICharSequence**)&mTitle)); }
IconMerger::IconMerger( /* [in] */ IContext* context, /* [in] */ IAttributeSet* attrs) : LinearLayout(context, attrs) , mIconSize(0) { ASSERT_SUCCEEDED(InitIconSize(context, attrs)); }
InsetDrawable::InsetDrawable( /* [in] */ IDrawable* drawable, /* [in] */ Int32 inset) : mMutated(FALSE) { CRect::NewByFriend((CRect**)&mTmpRect); ASSERT_SUCCEEDED(constructor(drawable, inset, inset, inset, inset)); }
ToggleButton::ToggleButton( /* [in] */ IContext* context, /* [in] */ IAttributeSet* attrs, /* [in] */ Int32 defStyle) : CompoundButton(context, attrs, defStyle) , mDisabledAlpha(0) { ASSERT_SUCCEEDED(InitFromAttributes(context, attrs, defStyle)); }
void CWallpaperManager::InitGlobals( /* [in] */ ILooper* looper) { AutoLock lock(sSync); if (sGlobals == NULL) { ASSERT_SUCCEEDED(CGlobalsWallpaperManagerCallback::NewByFriend( looper, (CGlobalsWallpaperManagerCallback**)&sGlobals)); } }
void CAnimatedAlphaWindow::AnimateSweepTo( double newSweep_I ) { // Create a storyboard CComPtr<IUIAnimationStoryboard> storyboard; ASSERT_SUCCEEDED(mAnimMgr->CreateStoryboard(&storyboard)); // Create transitions CComPtr<IUIAnimationTransition> stopTransition; ASSERT_SUCCEEDED(mTransLib->CreateSmoothStopTransition(0.25, newSweep_I, &stopTransition)); // Add the stopTransition ASSERT_SUCCEEDED(storyboard->AddTransition(mSweepVar, stopTransition)); // Schedule the storyboard to animate now UI_ANIMATION_SECONDS timeNow; ASSERT_SUCCEEDED(mAnimTimer->GetTime(&timeNow)); ASSERT_SUCCEEDED(storyboard->Schedule(timeNow)); }
//=================================================================================== // LocalDisplayAdapter //=================================================================================== // Called with SyncRoot lock held. LocalDisplayAdapter::LocalDisplayAdapter( /* [in] */ Object* syncRoot, /* [in] */ IContext* context, /* [in] */ IHandler* handler, /* [in] */ IDisplayAdapterListener* listener) : DisplayAdapter(syncRoot, context, handler, listener, TAG) , mDevices(5) { ASSERT_SUCCEEDED(CPhysicalDisplayInfo::New((IPhysicalDisplayInfo**)&mTempPhys)); }
AbsListViewLayoutParams::AbsListViewLayoutParams( /* [in] */ IContext* c, /* [in] */ IAttributeSet* attrs) : mViewType(0) , mRecycledHeaderFooter(FALSE) , mForceAdd(FALSE) , mScrappedFromPosition(0) , mItemId(-1) { ASSERT_SUCCEEDED(Init(c, attrs)); }
ECode CWallpaperManager::SetResource( /* [in] */ Int32 resid) { if (sGlobals->mService == NULL) { Slogger::W(TAG, "WallpaperService not running"); return NOERROR; } // try { AutoPtr<IResources> resources; ASSERT_SUCCEEDED(mContext->GetResources((IResources**)&resources)); String name; resources->GetResourceName(resid, &name); /* Set the wallpaper to the default values */ AutoPtr<IParcelFileDescriptor> fd; FAIL_RETURN(sGlobals->mService->SetWallpaper( String("res:") + name, (IParcelFileDescriptor**)&fd)); if (fd != NULL) { AutoPtr<IFileOutputStream> fos; // try { // fos = new ParcelFileDescriptor.AutoCloseOutputStream(fd); AutoPtr<IFileDescriptor> des; fd->GetFileDescriptor((IFileDescriptor**)&des); ASSERT_SUCCEEDED(CFileOutputStream::New(des, (IFileOutputStream**)&fos)); AutoPtr<IInputStream> res; ASSERT_SUCCEEDED(resources->OpenRawResource(resid, (IInputStream**)&res)); SetWallpaper(res, fos); if (fos != NULL) { fos->Close(); } fd->Close(); // } finally { // if (fos != null) { // fos.close(); // } // } } // } catch (RemoteException e) { // // Ignore // } return NOERROR; }
ECode CompatModePanel::Init( /* [in] */ IContext* context, /* [in] */ IAttributeSet* attrs) { ASSERT_SUCCEEDED(FrameLayout::Init(context, attrs)); mContext = context; AutoPtr<IInterface> tmpObj; context->GetSystemService(IContext::ACTIVITY_SERVICE, (IInterface**)&tmpObj); mAM = IActivityManager::Probe(tmpObj.Get()); assert(mAM != NULL); return NOERROR; }
void CAnimatedAlphaWindow::OnLButtonUp( UINT nFlags, CPoint point ) { // Create a storyboard CComPtr<IUIAnimationStoryboard> storyboard; ASSERT_SUCCEEDED(mAnimMgr->CreateStoryboard(&storyboard)); // Create transitions CComPtr<IUIAnimationTransition> stopTransition; //ATLTRACE("Animating to %.0f\n", mNextAlphaValue); ASSERT_SUCCEEDED(mTransLib->CreateSmoothStopTransition(0.5, mNextAlphaValue, &stopTransition)); mNextAlphaValue = (mNextAlphaValue == LARGE ? SMALL : LARGE); // Add the stopTransition ASSERT_SUCCEEDED(storyboard->AddTransition(mAlphaVar, stopTransition)); // Schedule the storyboard to animate now UI_ANIMATION_SECONDS timeNow; ASSERT_SUCCEEDED(mAnimTimer->GetTime(&timeNow)); ASSERT_SUCCEEDED(storyboard->Schedule(timeNow)); }
void GpuTimeManager::Initialize(uint32_t MaxNumTimers) { uint64_t GpuFrequency; Graphics::g_CommandManager.GetCommandQueue()->GetTimestampFrequency(&GpuFrequency); sm_GpuTickDelta = 1.0 / static_cast<double>(GpuFrequency); D3D12_HEAP_PROPERTIES HeapProps; HeapProps.Type = D3D12_HEAP_TYPE_READBACK; HeapProps.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN; HeapProps.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN; HeapProps.CreationNodeMask = 1; HeapProps.VisibleNodeMask = 1; D3D12_RESOURCE_DESC BufferDesc; BufferDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER; BufferDesc.Alignment = 0; BufferDesc.Width = sizeof(uint64_t) * MaxNumTimers * 2; BufferDesc.Height = 1; BufferDesc.DepthOrArraySize = 1; BufferDesc.MipLevels = 1; BufferDesc.Format = DXGI_FORMAT_UNKNOWN; BufferDesc.SampleDesc.Count = 1; BufferDesc.SampleDesc.Quality = 0; BufferDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR; BufferDesc.Flags = D3D12_RESOURCE_FLAG_NONE; ASSERT_SUCCEEDED(Graphics::g_Device->CreateCommittedResource( &HeapProps, D3D12_HEAP_FLAG_NONE, &BufferDesc, D3D12_RESOURCE_STATE_COPY_DEST, nullptr, MY_IID_PPV_ARGS(&sm_ReadBackBuffer) )); sm_ReadBackBuffer->SetName(L"GpuTimeStamp Buffer"); D3D12_QUERY_HEAP_DESC QueryHeapDesc; QueryHeapDesc.Count = MaxNumTimers * 2; QueryHeapDesc.NodeMask = 1; QueryHeapDesc.Type = D3D12_QUERY_HEAP_TYPE_TIMESTAMP; ASSERT_SUCCEEDED(Graphics::g_Device->CreateQueryHeap(&QueryHeapDesc, MY_IID_PPV_ARGS(&sm_QueryHeap))); sm_QueryHeap->SetName(L"GpuTimeStamp QueryHeap"); sm_MaxNumTimers = (uint32_t)MaxNumTimers; }
//=================================================================================== // LocalDisplayAdapter::LocalDisplayDevice //=================================================================================== LocalDisplayAdapter::LocalDisplayDevice::LocalDisplayDevice( /* [in] */ LocalDisplayAdapter* owner, /* [in] */ IBinder* displayToken, /* [in] */ Int32 builtInDisplayId, /* [in] */ IPhysicalDisplayInfo* phys) : DisplayDevice(owner, displayToken) , mBuiltInDisplayId(builtInDisplayId) , mHavePendingChanges(FALSE) , mBlanked(FALSE) , mHost(owner) { ASSERT_SUCCEEDED(CPhysicalDisplayInfo::New(phys, (IPhysicalDisplayInfo**)&mPhys)); }
void CommandListManager::CreateNewCommandList( D3D12_COMMAND_LIST_TYPE Type, ID3D12GraphicsCommandList** List, ID3D12CommandAllocator** Allocator ) { ASSERT(Type != D3D12_COMMAND_LIST_TYPE_BUNDLE, "Bundles are not yet supported"); switch (Type) { case D3D12_COMMAND_LIST_TYPE_DIRECT: *Allocator = m_GraphicsQueue.RequestAllocator(); break; case D3D12_COMMAND_LIST_TYPE_BUNDLE: break; case D3D12_COMMAND_LIST_TYPE_COMPUTE: *Allocator = m_ComputeQueue.RequestAllocator(); break; case D3D12_COMMAND_LIST_TYPE_COPY: *Allocator = m_CopyQueue.RequestAllocator(); break; } ASSERT_SUCCEEDED( m_Device->CreateCommandList(1, Type, *Allocator, nullptr, MY_IID_PPV_ARGS(List)) ); (*List)->SetName(L"CommandList"); }
FakeWindowImpl::FakeWindowImpl( /* [in] */ CWindowManagerService* service, /* [in] */ ILooper* looper, /* [in] */ IInputEventReceiverFactory* inputEventReceiverFactory, /* [in] */ const String& name, /* [in] */ Int32 windowType, /* [in] */ Int32 layoutParamsFlags, /* [in] */ Boolean canReceiveKeys, /* [in] */ Boolean hasFocus, /* [in] */ Boolean touchFullscreen) : mService(service) { AutoPtr<IInputChannelHelper> helper; ASSERT_SUCCEEDED(CInputChannelHelper::AcquireSingleton( (IInputChannelHelper**)&helper)); helper->OpenInputChannelPair(name, (IInputChannel**)&mServerChannel, (IInputChannel**)&mClientChannel); mService->mInputManager->RegisterInputChannel(mServerChannel, NULL); inputEventReceiverFactory->CreateInputEventReceiver( mClientChannel, looper, (IInputEventReceiver**)&mInputEventReceiver); mApplicationHandle = new InputApplicationHandle(NULL); mApplicationHandle->mName = name; mApplicationHandle->mDispatchingTimeoutNanos = CWindowManagerService::DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS; mWindowHandle = new InputWindowHandle(mApplicationHandle, NULL, IDisplay::DEFAULT_DISPLAY); mWindowHandle->mName = name; mWindowHandle->mInputChannel = mServerChannel; mWindowLayer = GetLayerLw(windowType); mWindowHandle->mLayer = mWindowLayer; mWindowHandle->mLayoutParamsFlags = layoutParamsFlags; mWindowHandle->mLayoutParamsType = windowType; mWindowHandle->mDispatchingTimeoutNanos = CWindowManagerService::DEFAULT_INPUT_DISPATCHING_TIMEOUT_NANOS; mWindowHandle->mVisible = TRUE; mWindowHandle->mCanReceiveKeys = canReceiveKeys; mWindowHandle->mHasFocus = hasFocus; mWindowHandle->mHasWallpaper = FALSE; mWindowHandle->mPaused = FALSE; mWindowHandle->mOwnerPid = Process::MyPid(); mWindowHandle->mOwnerUid = Process::MyUid(); mWindowHandle->mInputFeatures = 0; mWindowHandle->mScaleFactor = 1.0f; mTouchFullscreen = touchFullscreen; }
uint64_t CommandQueue::ExecuteCommandList( ID3D12CommandList* List ) { std::lock_guard<std::mutex> LockGuard(m_FenceMutex); ASSERT_SUCCEEDED(((ID3D12GraphicsCommandList*)List)->Close()); // Kickoff the command list m_CommandQueue->ExecuteCommandLists(1, &List); // Signal the next fence value (with the GPU) m_CommandQueue->Signal(m_pFence, m_NextFenceValue); // And increment the fence value. return m_NextFenceValue++; }
Chronometer::Chronometer( /* [in] */ IContext* context, /* [in] */ IAttributeSet* attrs, /* [in] */ Int32 defStyle) : TextView(context, attrs, defStyle) , mBase(0) , mVisible(FALSE) , mStarted(FALSE) , mRunning(FALSE) , mLogged(FALSE) , mRecycle(8) { mFormatterArgs = ArrayOf<IInterface*>::Alloc(1); mHandler = new MyHandler(this); ASSERT_SUCCEEDED(InitInternal(context, attrs, defStyle)); }