public override void Render(float timePassed) { base.Render(timePassed); //RenderDlg(timePassed); if (null == coverArtTexture) { return; } if (null != imgCoverArt) { float x = (float)imgCoverArt.XPosition; float y = (float)imgCoverArt.YPosition; int width; int height; GUIGraphicsContext.Correct(ref x, ref y); int maxWidth = imgCoverArt.Width; int maxHeight = imgCoverArt.Height; GUIGraphicsContext.GetOutputRect(coverArtTextureWidth, coverArtTextureHeight, maxWidth, maxHeight, out width, out height); GUIFontManager.Present(); Util.Picture.RenderImage(coverArtTexture, (int)x, (int)y, width, height, coverArtTextureWidth, coverArtTextureHeight, 0, 0, true); } }
public static void Render(float timePassed) { if (GUIGraphicsContext.BlankScreen) { return; } int videoLayer = (int)LayerType.Video; if (GUIGraphicsContext.ShowBackground == false) { if (_layers[videoLayer] != null) { if (_layers[videoLayer].ShouldRenderLayer()) { _layers[videoLayer].RenderLayer(timePassed); GUIFontManager.Present(); } } } for (int i = 0; i < MAX_LAYERS; ++i) { if (_layers[i] != null) { if (_layers[i].ShouldRenderLayer()) { if (GUIGraphicsContext.ShowBackground == false && i == videoLayer) { continue; } _layers[i].RenderLayer(timePassed); GUIFontManager.Present(); } } } }
public void RenderDlg(float timePassed) { lock (this) { // render the parent window if (null != m_pParentWindow) { m_pParentWindow.Render(timePassed); } GUIFontManager.Present(); // render this dialog box base.Render(timePassed); } }
public override void Render(float timePassed) { base.Render(timePassed); if (null == m_pTexture) { return; } float x = imgPicture.XPosition; float y = imgPicture.YPosition; int width; int height; GUIGraphicsContext.Correct(ref x, ref y); GUIFontManager.Present(); GUIGraphicsContext.GetOutputRect(m_iTextureWidth, m_iTextureHeight, imgPicture.Width, imgPicture.Height, out width, out height); Util.Picture.RenderImage(m_pTexture, (int)x, (int)y, width, height, m_iTextureWidth, m_iTextureHeight, 0, 0, true); }
public override void PostRender(float timePassed, int iLayer) { if (!m_bEnabled) { return; } if (iLayer != 1) { return; } CheckFocus(); // Check auto hide topbar if (GUIGraphicsContext.TopBarHidden != m_bTopBarHidden) { // Rest to new settings m_bTopBarHidden = GUIGraphicsContext.TopBarHidden; m_bTopBarHide = GUIGraphicsContext.TopBarHidden; m_bTopBarEffect = false; m_iMoveUp = 0; if (m_bTopBarHidden) { m_iMoveUp = m_iTopbarRegion; } foreach (CPosition pos in _listPositions) { int y = (int)pos.YPos - m_iMoveUp; //y += GUIGraphicsContext.OverScanTop; // already done pos.control.SetPosition((int)pos.XPos, y); } } else if (m_bTopBarHidden != m_bTopBarHide) { m_bTopBarEffect = true; } if (GUIGraphicsContext.AutoHideTopBar) { // Check autohide timeout if (m_bFocused) { m_bTopBarHide = false; GUIGraphicsContext.TopBarTimeOut = DateTime.Now; } TimeSpan ts = DateTime.Now - GUIGraphicsContext.TopBarTimeOut; if ((ts.TotalSeconds > m_iAutoHideTimeOut) && !m_bTopBarHide) { // Hide topbar with effect m_bTopBarHide = true; m_iMoveUp = 0; } if (m_bTopBarEffect) { if (m_bTopBarHide) { m_iMoveUp += HIDE_SPEED; if (m_iMoveUp >= m_iTopbarRegion) { m_bTopBarHidden = true; GUIGraphicsContext.TopBarHidden = true; m_bTopBarEffect = false; } } else { m_bTopBarHidden = false; GUIGraphicsContext.TopBarHidden = false; m_iMoveUp = 0; } foreach (CPosition pos in _listPositions) { int y = (int)pos.YPos - m_iMoveUp; //y += GUIGraphicsContext.OverScanTop; // already done pos.control.SetPosition((int)pos.XPos, y); } } } if (GUIGraphicsContext.TopBarHidden) { return; } GUIFontManager.Present(); base.Render(timePassed); }
private void InternalPresentImage(int width, int height, int arWidth, int arHeight, bool isRepaint) { if (_reEntrant) { Log.Error("PlaneScene: re-entrancy in PresentImage"); return; } if (GUIGraphicsContext.CurrentState == GUIGraphicsContext.State.LOST) { return; } try { //Direct3D.Surface backBuffer=null; _debugStep = 0; _reEntrant = true; GUIGraphicsContext.InVmr9Render = true; if (width > 0 && height > 0) { _vmr9Util.VideoWidth = width; _vmr9Util.VideoHeight = height; _vmr9Util.VideoAspectRatioX = arWidth; _vmr9Util.VideoAspectRatioY = arHeight; _arVideoWidth = arWidth; _arVideoHeight = arHeight; } //if we're stopping then just return float timePassed = GUIGraphicsContext.TimePassed; if (_stopPainting) { return; } //sanity checks if (GUIGraphicsContext.DX9Device == null) { return; } if (GUIGraphicsContext.DX9Device.Disposed) { return; } if (GUIWindowManager.IsSwitchingToNewWindow) { return; //dont present video during window transitions } _debugStep = 1; if (_renderTarget != null) { if (!_renderTarget.Disposed) { GUIGraphicsContext.DX9Device.SetRenderTarget(0, _renderTarget); } } _debugStep = 2; //first time, fade in the video in 12 steps int iMaxSteps = 12; if (_fadeFrameCounter < iMaxSteps) { // fade in int iStep = 0xff / iMaxSteps; if (_fadingIn) { _diffuseColor = iStep * _fadeFrameCounter; _diffuseColor <<= 24; _diffuseColor |= 0xffffff; } else { _diffuseColor = (iMaxSteps - iStep) * _fadeFrameCounter; _diffuseColor <<= 24; _diffuseColor |= 0xffffff; } _fadeFrameCounter++; } else { //after 12 steps, just present the video texture _diffuseColor = 0xFFffffff; } _debugStep = 3; //get desired video window if (width > 0 && height > 0 && _textureAddress != 0) { Size nativeSize = new Size(width, height); _shouldRenderTexture = SetVideoWindow(nativeSize); } else { _shouldRenderTexture = false; } //clear screen GUIGraphicsContext.DX9Device.Clear(ClearFlags.Target, Color.Black, 1.0f, 0); _debugStep = 5; GUIGraphicsContext.DX9Device.BeginScene(); try { if (!GUIGraphicsContext.BlankScreen) { // Render GUI + Video surface GUIGraphicsContext.RenderGUI.RenderFrame(timePassed); GUIFontManager.Present(); } } finally { GUIGraphicsContext.DX9Device.EndScene(); } GUIGraphicsContext.DX9Device.Present(); _debugStep = 20; } catch (DeviceLostException) { GUIGraphicsContext.CurrentState = GUIGraphicsContext.State.LOST; Log.Warn("Planescene caught DeviceLostException in InternalPresentImage"); } catch (DirectXException dex) { if (dex.ErrorCode == -2005530508 || // GPU_HUNG dex.ErrorCode == -2005530512) // GPU_REMOVED { Log.Info("Planescene caught GPU_HUNG in InternalPresentImage"); GUIGraphicsContext.CurrentState = GUIGraphicsContext.State.LOST; } } catch (Exception ex) { GUIGraphicsContext.CurrentState = GUIGraphicsContext.State.LOST; Log.Error("Planescene({0},{1},{2},{3},{4},{5},{6}):Unhandled exception in:", width, height, arWidth, arHeight, _textureAddress, isRepaint, _debugStep); Log.Error(ex); } finally { _reEntrant = false; GUIGraphicsContext.InVmr9Render = false; } }