本文整理汇总了C++中DisplayPtr类的典型用法代码示例。如果您正苦于以下问题:C++ DisplayPtr类的具体用法?C++ DisplayPtr怎么用?C++ DisplayPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DisplayPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: closeDisplay
/**
* Closes the given display.
*
* @pre disp is a display we know about.
* @post disp has been removed from the list of displays
* (notifyDrawMgr == true) && (drawMgr != NULL) && (disp is active)
* ==> Draw manager has been told to clode the window for the display
*/
int DisplayManager::closeDisplay(DisplayPtr disp, bool notifyDrawMgr)
{
vprASSERT(isMemberDisplay(disp)); // Make sure that display actually exists
vprDEBUG(vrjDBG_DISP_MGR, vprDBG_STATE_LVL)
<< "[vrj::DisplayManager::closeDisplay()] Closing display named '"
<< disp->getName() << "'" << std::endl << vprDEBUG_FLUSH;
// Notify the draw manager to get rid of it
// Note: if it is not active, then the draw manager doesn't know about it
if ((notifyDrawMgr) && (mDrawManager != NULL) && (disp->isActive()))
{
mDrawManager->removeDisplay(disp);
}
// Remove it from local data structures
size_t num_before_close = mActiveDisplays.size() + mInactiveDisplays.size();
mActiveDisplays.erase( std::remove(mActiveDisplays.begin(), mActiveDisplays.end(), disp),
mActiveDisplays.end());
mInactiveDisplays.erase( std::remove(mInactiveDisplays.begin(), mInactiveDisplays.end(), disp),
mInactiveDisplays.end());
vprASSERT(num_before_close == (1+mActiveDisplays.size() + mInactiveDisplays.size()));
boost::ignore_unused_variable_warning(num_before_close);
return 1;
}
示例2: vprASSERT
/**
* Adds the element to the configuration.
*
* @pre configCanHandle(element) == true
* @post (display of same name already loaded) ==> old display closed, new one opened<br>
* (display is new) ==> (new display is added)<br>
* Draw Manager is notified of the display change.
*/
bool DisplayManager::configAddDisplay(jccl::ConfigElementPtr element)
{
vprASSERT(configCanHandle(element)); // We must be able to handle it first of all
vprDEBUG_BEGIN(vrjDBG_DISP_MGR,vprDBG_STATE_LVL) << "------- DisplayManager::configAddDisplay -------\n" << vprDEBUG_FLUSH;
// Find out if we already have a window of this name
// If so, then close it before we open a new one of the same name
// This basically allows re-configuration of a window
DisplayPtr cur_disp = findDisplayNamed(element->getName());
if (cur_disp != NULL) // We have an old display
{
vprDEBUG(vrjDBG_DISP_MGR,vprDBG_CONFIG_LVL) << "Removing old window: " << cur_disp->getName().c_str() << vprDEBUG_FLUSH;
closeDisplay(cur_disp,true); // Close the display and notify the draw manager to close the window
}
// --- Add a display (of the correct type) ---- //
if (element->getID() == std::string("display_window")) // Display window
{
DisplayPtr newDisp = Display::create(); // Create the display
newDisp->config(element);
addDisplay(newDisp,true); // Add it
vprDEBUG(vrjDBG_DISP_MGR,vprDBG_STATE_LVL) << "Adding display: " << newDisp->getName().c_str() << std::endl << vprDEBUG_FLUSH;
vprDEBUG(vrjDBG_DISP_MGR,vprDBG_STATE_LVL) << "Display: " << newDisp << std::endl << vprDEBUG_FLUSH;
}
vprDEBUG_END(vrjDBG_DISP_MGR,vprDBG_STATE_LVL) << "------- DisplayManager::configAddDisplay Done. --------\n" << vprDEBUG_FLUSH;
return true;
}
示例3: addDisplay
// notifyDrawMgr = 0; Defaults to 0
int DisplayManager::addDisplay(DisplayPtr disp, bool notifyDrawMgr)
{
vprDEBUG(vrjDBG_DISP_MGR, vprDBG_VERB_LVL)
<< "vrj::DisplayManager::addDisplay()\n" << vprDEBUG_FLUSH;
// Test if active or not, to determine correct list
// The place it in the list
// --- Update Local Display structures
if (disp->isActive())
{
mActiveDisplays.push_back(disp);
}
else
{
mInactiveDisplays.push_back(disp);
}
// If we are supposed to notify about, and valid draw mgr, and disp is active
if ((notifyDrawMgr) && (mDrawManager != NULL) && (disp->isActive()))
{
mDrawManager->addDisplay(disp);; // Tell Draw Manager to add dislay;
}
return 1;
}
示例4: displaysPlug
IECore::ConstCompoundObjectPtr Displays::computeProcessedGlobals( const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputGlobals ) const
{
const CompoundPlug *dsp = displaysPlug();
if( !dsp->children().size() )
{
return inputGlobals;
}
CompoundObjectPtr result = inputGlobals->copy();
// add our displays to the result
for( InputCompoundPlugIterator it( dsp ); it != it.end(); it++ )
{
const CompoundPlug *displayPlug = *it;
if( displayPlug->getChild<BoolPlug>( "active" )->getValue() )
{
std::string name = displayPlug->getChild<StringPlug>( "name" )->getValue();
std::string type = displayPlug->getChild<StringPlug>( "type" )->getValue();
std::string data = displayPlug->getChild<StringPlug>( "data" )->getValue();
if( name.size() && type.size() && data.size() )
{
DisplayPtr d = new Display( name, type, data );
displayPlug->getChild<CompoundDataPlug>( "parameters" )->fillCompoundData( d->parameters() );
result->members()["display:" + name] = d;
}
}
}
return result;
}
示例5: create
ImagePtr VaapiImage::create(const DisplayPtr& display,
uint32_t format,
uint32_t width, uint32_t height)
{
ImagePtr image;
VAStatus status;
if (!display || !width || !height)
return image;
DEBUG_FOURCC("create image with fourcc: ", format);
const VAImageFormat *vaFormat = display->getVaFormat(format);
if (!vaFormat) {
ERROR("Create image failed, not supported fourcc");
return image;
}
VAImagePtr vaImage(new VAImage);
status = vaCreateImage(display->getID(), vaFormat, width, height, vaImage.get());
if (status != VA_STATUS_SUCCESS ||
vaImage->format.fourcc != vaFormat->fourcc) {
ERROR("fourcc mismatch wated = 0x%x, got = 0x%x", vaFormat->fourcc, vaImage->format.fourcc);
return image;
}
image.reset(new VaapiImage(display, vaImage));
return image;
}
示例6: sim_vp
/**
* Callback when display is added to display manager.
* @pre Must be in kernel controlling thread.
* @note This function can only be called by the display manager
* functioning on behalf of a thread the holds the kernel
* reconfiguration lock.
* This guarantees that we are not rendering currently.
* We will most likely be waiting for a render trigger.
*/
void D3dDrawManager::addDisplay(DisplayPtr disp)
{
vprASSERT(disp != NULL); // Can't add a null display
vprDEBUG(vrjDBG_DRAW_MGR, 0)
<< "========= vrj::D3dDrawManager::addDisplay: " << disp
<< std::endl << vprDEBUG_FLUSH;
// -- Finish Simulator setup
std::vector<vrj::Viewport*>::size_type num_vp(disp->getNumViewports());
std::vector<vrj::Viewport*>::size_type i;
for ( i = 0 ; i < num_vp ; ++i )
{
Viewport* vp = disp->getViewport(i);
if (vp->isSimulator())
{
jccl::ConfigElementPtr vp_element = vp->getConfigElement();
SimViewport* sim_vp(NULL);
sim_vp = dynamic_cast<SimViewport*>(vp);
vprASSERT(NULL != sim_vp);
sim_vp->setDrawSimInterface(DrawSimInterfacePtr());
// Create the simulator stuff
vprASSERT(1 == vp_element->getNum("simulator_plugin") && "You must supply a simulator plugin.");
// Create the simulator stuff
jccl::ConfigElementPtr sim_element =
vp_element->getProperty<jccl::ConfigElementPtr>("simulator_plugin");
vprDEBUG(vrjDBG_DRAW_MGR, vprDBG_CONFIG_LVL)
<< "D3dDrawManager::addDisplay() creating simulator of type '"
<< sim_element->getID() << "'\n" << vprDEBUG_FLUSH;
DrawSimInterfacePtr new_sim_i(
D3dSimInterfaceFactory::instance()->createObject(sim_element->getID())
);
// XXX: Change this to an error once the new simulator loading code is
// more robust. -PH (4/13/2003)
vprASSERT(NULL != new_sim_i.get() &&
"Failed to create draw simulator");
sim_vp->setDrawSimInterface(new_sim_i);
new_sim_i->initialize(sim_vp);
new_sim_i->config(sim_element);
}
}
// -- Create a window for new display
// -- Store the window in the wins vector
// Create the gl window object. NOTE: The glPipe actually "creates" the opengl window and context later
D3dWindow* new_win = new D3dWindow();
new_win->configWindow(disp); // Configure it
mNewWins.push_back(new_win); // Add to our local window list
//vprASSERT(isValidWindow(new_win)); // Make sure it was added to draw manager
}
示例7: createDisplay
DisplayPtr DisplayCache::createDisplay(const NativeDisplay& nativeDisplay)
{
NativeDisplayPtr nativeDisplayObj;
VADisplay vaDisplay = NULL;
DisplayPtr vaapiDisplay;
YamiMediaCodec::AutoLock locker(m_lock);
m_cache.remove_if(expired);
//lockup first
list<weak_ptr<VaapiDisplay> >::iterator it;
for (it = m_cache.begin(); it != m_cache.end(); ++it) {
vaapiDisplay = (*it).lock();
if (vaapiDisplay->isCompatible(nativeDisplay)) {
return vaapiDisplay;
}
}
vaapiDisplay.reset();
//crate new one
DEBUG("nativeDisplay: (type : %d), (handle : 0x%x)", nativeDisplay.type, nativeDisplay.handle);
switch (nativeDisplay.type) {
case NATIVE_DISPLAY_AUTO:
#if __ENABLE_X11__
case NATIVE_DISPLAY_X11:
nativeDisplayObj.reset (new NativeDisplayX11());
if (nativeDisplayObj && nativeDisplayObj->initialize(nativeDisplay))
vaDisplay = vaGetDisplay((Display*)(nativeDisplayObj->nativeHandle()));
if (vaDisplay)
INFO("use vaapi x11 backend");
if(vaDisplay || nativeDisplay.type == NATIVE_DISPLAY_X11)
break;
INFO("try to init va with x11 display (%p) but failed", (Display*)(nativeDisplayObj->nativeHandle()));
// NATIVE_DISPLAY_AUTO continue, no break
#endif
case NATIVE_DISPLAY_DRM:
nativeDisplayObj.reset (new NativeDisplayDrm());
if (nativeDisplayObj && nativeDisplayObj->initialize(nativeDisplay))
vaDisplay = vaGetDisplayDRM(nativeDisplayObj->nativeHandle());
INFO("use vaapi drm backend");
break;
default:
break;
}
if (vaDisplay == NULL) {
ERROR("vaGetDisplay failed.");
return vaapiDisplay;
}
if (vaInit(vaDisplay))
vaapiDisplay.reset(new VaapiDisplay(nativeDisplayObj, vaDisplay));
if (vaapiDisplay) {
weak_ptr<VaapiDisplay> weak(vaapiDisplay);
m_cache.push_back(weak);
}
return vaapiDisplay;
}
示例8: outputsPlug
IECore::ConstCompoundObjectPtr Outputs::computeProcessedGlobals( const Gaffer::Context *context, IECore::ConstCompoundObjectPtr inputGlobals ) const
{
const CompoundPlug *dsp = outputsPlug();
if( !dsp->children().size() )
{
return inputGlobals;
}
IECore::CompoundObjectPtr result = new IECore::CompoundObject;
// Since we're not going to modify any existing members (only add new ones),
// and our result becomes const on returning it, we can directly reference
// the input members in our result without copying. Be careful not to modify
// them though!
result->members() = inputGlobals->members();
// add our outputs to the result
for( InputCompoundPlugIterator it( dsp ); it != it.end(); it++ )
{
const CompoundPlug *outputPlug = it->get();
if( outputPlug->getChild<BoolPlug>( "active" )->getValue() )
{
// backwards compatibility with old plug layout
const StringPlug *namePlug = outputPlug->getChild<StringPlug>( "label" );
if( !namePlug )
{
namePlug = outputPlug->getChild<StringPlug>( "name" );
}
const std::string name = namePlug->getValue();
const StringPlug *fileNamePlug = outputPlug->getChild<StringPlug>( "fileName" );
if( !fileNamePlug )
{
// backwards compatibility with old plug layout
fileNamePlug = outputPlug->getChild<StringPlug>( "name" );
}
const std::string fileName = fileNamePlug->getValue();
const std::string type = outputPlug->getChild<StringPlug>( "type" )->getValue();
const std::string data = outputPlug->getChild<StringPlug>( "data" )->getValue();
if( name.size() && fileName.size() && type.size() && data.size() )
{
DisplayPtr d = new Display( fileName, type, data );
outputPlug->getChild<CompoundDataPlug>( "parameters" )->fillCompoundData( d->parameters() );
result->members()["output:" + name] = d;
}
}
}
return result;
}
示例9: RenderBegin
void DisplayRenderTargetGeometry::RenderBegin()
{
//DevicePtr pDevice = m_rDisplay.GetDevicePtr();
//pDevice->GetStreamSource(0, &m_pPreviousVertexBuffer, &m_uPreviousVBOffset, &m_uPreviousVBStride);
//pDevice->GetVertexDeclaration(&m_pPreviousVertexDecl);
//if (m_pPreviousVertexDecl != m_uVertexDecl)
//{
// pDevice->SetVertexDeclaration(m_uVertexDecl);
//}
DisplayPtr pDisplay = Display::GetInstance();
if (m_uVertexDecl != pDisplay->GetCurrentVertexDeclaration())
{
pDisplay->SetVertexDeclaration(m_uVertexDecl);
}
}
示例10: derive
ImagePtr VaapiImage::derive(const SurfacePtr& surface)
{
ImagePtr image;
if (!surface)
return image;
DisplayPtr display = surface->getDisplay();
VAImagePtr vaImage(new VAImage);
VAStatus status = vaDeriveImage(display->getID(), surface->getID(), vaImage.get());
if (!checkVaapiStatus(status, "vaDeriveImage()")) {
return image;
}
image.reset(new VaapiImage(display, surface, vaImage));
return image;
}
示例11: for_each
void DisplayMaterial::Render()
{
m_pEffect->SetTechnique(m_hTechnique);
#if 0
for_each(m_vRenderList.begin(), m_vRenderList.end(), RenderObjectFunction(this));
#else
DisplayPtr pDisplay = Display::GetInstance();
DisplayStateManagerPtr pStateManager = pDisplay->GetStateManagerInterface();
EffectPtr pEffect = GetEffect()->GetEffect();
size_t uCount = m_vRenderList.size();
UInt uPassCount;
UInt uChangeCount;
UInt uDuplicateCount;
pEffect->Begin(&uPassCount, EFFECT_RENDER_FLAGS);
for (UInt uPass = 0 ; uPass < uPassCount ; ++uPass)
{
pDisplay->MRTRenderBeginPass(uPass);
pStateManager->BeginPass(uPass);
pEffect->BeginPass(uPass);
for (size_t i = 0 ; uCount > i ; ++i)
{
DisplayObjectPtr pDisplayObject = m_vRenderList[i];
pDisplayObject->RenderBegin();
pDisplay->SetCurrentWorldMatrix(pDisplayObject->GetWorldMatrix());
UseParams();
pEffect->CommitChanges();
pDisplayObject->Render();
pDisplayObject->RenderEnd();
}
pEffect->EndPass();
pStateManager->EndPass(uChangeCount, uDuplicateCount);
pDisplay->MRTRenderEndPass();
}
pEffect->End();
#endif
m_vRenderList.clear();
}
示例12: ERROR
BufObjectPtr VaapiBufObject::create(const ContextPtr& context,
VABufferType bufType,
uint32_t size,
const void *data, void **mapped_data)
{
BufObjectPtr buf;
if (size == 0) {
ERROR("buffer size is zero");
return buf;
}
DisplayPtr display = context->getDisplay();
VABufferID bufID;
if (!vaapiCreateBuffer(display->getID(), context->getID(),
bufType, size, data, &bufID, mapped_data)) {
ERROR("create buffer failed");
return buf;
}
void *mapped = mapped_data ? *mapped_data : NULL;
buf.reset(new VaapiBufObject(display, bufID, mapped, size));
return buf;
}
示例13:
VaapiDecSurfacePool::VaapiDecSurfacePool(const DisplayPtr& display, std::vector<SurfacePtr> surfaces):
m_cond(m_lock),
m_flushing(false)
{
size_t size = surfaces.size();
m_surfaces.swap(surfaces);
m_renderBuffers.resize(size);
for (size_t i = 0; i < size; ++i) {
const SurfacePtr& s = m_surfaces[i];
VASurfaceID id = m_surfaces[i]->getID();
m_renderBuffers[i].display = display->getID();
m_renderBuffers[i].surface = id;
m_renderBuffers[i].timeStamp = 0;
m_renderMap[id] = &m_renderBuffers[i];
m_surfaceMap[id] = s.get();
m_freed.push_back(id);
}
}
示例14: create
SurfacePtr VaapiSurface::create(const DisplayPtr& display,
VaapiChromaType chromaType,
uint32_t width,
uint32_t height,
void *surfAttribArray,
uint32_t surfAttribNum)
{
VAStatus status;
uint32_t format, i;
VASurfaceAttrib *surfAttribs = (VASurfaceAttrib *) surfAttribArray;
SurfacePtr surface;
VASurfaceID id;
assert((surfAttribs && surfAttribNum)
|| (!surfAttribs && !surfAttribNum));
format = vaapiChromaToVaChroma(chromaType);
uint32_t externalBufHandle = 0;
status = vaCreateSurfaces(display->getID(), format, width, height,
&id, 1, surfAttribs, surfAttribNum);
if (!checkVaapiStatus(status, "vaCreateSurfacesWithAttribute()"))
return surface;
for (int i = 0; i < surfAttribNum; i++) {
if (surfAttribs[i].type == VASurfaceAttribExternalBufferDescriptor) {
VASurfaceAttribExternalBuffers *surfAttribExtBuf
=
(VASurfaceAttribExternalBuffers *) surfAttribs[i].value.
value.p;
externalBufHandle = surfAttribExtBuf->buffers[0];
break;
}
}
surface.reset(new VaapiSurface(display, id, chromaType,
width, height,externalBufHandle));
return surface;
}
示例15: isCompatible
bool isCompatible(const DisplayPtr display, const NativeDisplay& native) {
return display->isCompatible(native);
}