VirtualBox-5.0.0/src/VBox/Main/src-client/DisplayImpl.cpp
/**
 * Initializes the display object.
 *
 * @returns COM result indicator
 * @param parent          handle of our parent object
 * @param qemuConsoleData address of common console data structure
 */
Initializes the display object.
@returns COM result indicator
@param parent          handle of our parent object
@param qemuConsoleData address of common console data structure
Initializes the display object . @returns COM result indicator @param parent handle of our parent object @param qemuConsoleData address of common console data structure
HRESULT Display::init(Console *aParent)
{
    ComAssertRet(aParent, E_INVALIDARG);
    AutoInitSpan autoInitSpan(this);
    AssertReturn(autoInitSpan.isOk(), E_FAIL);
    unconst(mParent) = aParent;
    mfSourceBitmapEnabled = true;
    fVGAResizing = false;
    ULONG ul;
    mParent->i_machine()->COMGETTER(MonitorCount)(&ul);
    mcMonitors = ul;
    xInputMappingOrigin = 0;
    yInputMappingOrigin = 0;
    cxInputMapping = 0;
    cyInputMapping = 0;
    for (ul = 0; ul < mcMonitors; ul++)
    {
        maFramebuffers[ul].u32Offset = 0;
        maFramebuffers[ul].u32MaxFramebufferSize = 0;
        maFramebuffers[ul].u32InformationSize = 0;
        maFramebuffers[ul].pFramebuffer = NULL;
        maFramebuffers[ul].fDisabled = ul > 0;
        maFramebuffers[ul].u32Caps = 0;
        maFramebuffers[ul].updateImage.pu8Address = NULL;
        maFramebuffers[ul].updateImage.cbLine = 0;
        maFramebuffers[ul].xOrigin = 0;
        maFramebuffers[ul].yOrigin = 0;
        maFramebuffers[ul].w = 0;
        maFramebuffers[ul].h = 0;
        maFramebuffers[ul].flags = maFramebuffers[ul].fDisabled? VBVA_SCREEN_F_DISABLED: 0;
        maFramebuffers[ul].u16BitsPerPixel = 0;
        maFramebuffers[ul].pu8FramebufferVRAM = NULL;
        maFramebuffers[ul].u32LineSize = 0;
        maFramebuffers[ul].pHostEvents = NULL;
        maFramebuffers[ul].fDefaultFormat = false;
#ifdef VBOX_WITH_HGSMI
        maFramebuffers[ul].fVBVAEnabled = false;
        maFramebuffers[ul].fVBVAForceResize = false;
        maFramebuffers[ul].fRenderThreadMode = false;
        maFramebuffers[ul].pVBVAHostFlags = NULL;
#endif 
#ifdef VBOX_WITH_CROGL
        RT_ZERO(maFramebuffers[ul].pendingViewportInfo);
#endif
    }
    {
        ComPtr<IEventSource> es;
        mParent->COMGETTER(EventSource)(es.asOutParam());
        com::SafeArray<VBoxEventType_T> eventTypes;
        eventTypes.push_back(VBoxEventType_OnStateChanged);
        es->RegisterListener(this, ComSafeArrayAsInParam(eventTypes), true);
    }
    BOOL fIs3DEnabled = FALSE;
    mParent->i_machine()->COMGETTER(Accelerate3DEnabled)(&fIs3DEnabled);
    GraphicsControllerType_T enmGpuType = (GraphicsControllerType_T)GraphicsControllerType_VBoxVGA;
    mParent->i_machine()->COMGETTER(GraphicsControllerType)(&enmGpuType);
    mfIsCr3DEnabled = fIs3DEnabled && enmGpuType == GraphicsControllerType_VBoxVGA;
    autoInitSpan.setSucceeded();
    return S_OK;
}
HRESULT Display :: init ( Console * aParent ) { ComAssertRet ( aParent , E_INVALIDARG ) ; AutoInitSpan autoInitSpan ( this ) ; AssertReturn ( autoInitSpan . isOk ( ) , E_FAIL ) ; unconst ( mParent ) = aParent ; mfSourceBitmapEnabled = true ; fVGAResizing = false ; ULONG ul ; mParent -> i_machine ( ) -> COMGETTER ( MonitorCount ) ( & ul ) ; mcMonitors = ul ; xInputMappingOrigin = 0 ; yInputMappingOrigin = 0 ; cxInputMapping = 0 ; cyInputMapping = 0 ; for ( ul = 0 ; ul < mcMonitors ; ul ++ ) { maFramebuffers [ ul ] . u32Offset = 0 ; maFramebuffers [ ul ] . u32MaxFramebufferSize = 0 ; maFramebuffers [ ul ] . u32InformationSize = 0 ; maFramebuffers [ ul ] . pFramebuffer = NULL ; maFramebuffers [ ul ] . fDisabled = ul > 0 ; maFramebuffers [ ul ] . u32Caps = 0 ; maFramebuffers [ ul ] . updateImage . pu8Address = NULL ; maFramebuffers [ ul ] . updateImage . cbLine = 0 ; maFramebuffers [ ul ] . xOrigin = 0 ; maFramebuffers [ ul ] . yOrigin = 0 ; maFramebuffers [ ul ] . w = 0 ; maFramebuffers [ ul ] . h = 0 ; maFramebuffers [ ul ] . flags = maFramebuffers [ ul ] . fDisabled ? VBVA_SCREEN_F_DISABLED : 0 ; maFramebuffers [ ul ] . u16BitsPerPixel = 0 ; maFramebuffers [ ul ] . pu8FramebufferVRAM = NULL ; maFramebuffers [ ul ] . u32LineSize = 0 ; maFramebuffers [ ul ] . pHostEvents = NULL ; maFramebuffers [ ul ] . fDefaultFormat = false ; #ifdef VBOX_WITH_HGSMI maFramebuffers [ ul ] . fVBVAEnabled = false ; maFramebuffers [ ul ] . fVBVAForceResize = false ; maFramebuffers [ ul ] . fRenderThreadMode = false ; maFramebuffers [ ul ] . pVBVAHostFlags = NULL ; #endif #ifdef VBOX_WITH_CROGL RT_ZERO ( maFramebuffers [ ul ] . pendingViewportInfo ) ; #endif } { ComPtr < IEventSource > es ; mParent -> COMGETTER ( EventSource ) ( es . asOutParam ( ) ) ; com :: SafeArray < VBoxEventType_T > eventTypes ; eventTypes . push_back ( VBoxEventType_OnStateChanged ) ; es -> RegisterListener ( this , ComSafeArrayAsInParam ( eventTypes ) , true ) ; } BOOL fIs3DEnabled = FALSE ; mParent -> i_machine ( ) -> COMGETTER ( Accelerate3DEnabled ) ( & fIs3DEnabled ) ; GraphicsControllerType_T enmGpuType = ( GraphicsControllerType_T ) GraphicsControllerType_VBoxVGA ; mParent -> i_machine ( ) -> COMGETTER ( GraphicsControllerType ) ( & enmGpuType ) ; mfIsCr3DEnabled = fIs3DEnabled && enmGpuType == GraphicsControllerType_VBoxVGA ; autoInitSpan . setSucceeded ( ) ; return S_OK ; }
Initializes the display object.
Initializes the display object .
/* Enclose the state transition NotReady->InInit->Ready */ /* All secondary monitors are disabled at startup. */ /* VBOX_WITH_HGSMI */ // register listener for state change events /* Cache the 3D settings. */ /* Confirm a successful initialization */