Example #1
0
        public void DrawItem(BluRayAPI.OSDTexture item)
        {
            try
            {
                lock (_syncObj)
                {
                    InitTexture(item);
                    if (_combinedOsdSurface != null)
                    {
                        Rectangle sourceRect = new Rectangle(0, 0, item.Width, item.Height);
                        Rectangle dstRect    = new Rectangle(item.X, item.Y, item.Width, item.Height);

                        using (Texture itemTexture = new Texture(item.Texture))
                            _device.StretchRectangle(itemTexture.GetSurfaceLevel(0), sourceRect, _combinedOsdSurface, dstRect, TextureFilter.None);
                    }
                }
            }
            catch (Exception ex)
            {
                BluRayPlayerBuilder.LogError(ex.ToString());
            }

            if (_onTextureInvalidated != null)
            {
                _onTextureInvalidated();
            }
        }
Example #2
0
        public int OnOSDUpdate(BluRayAPI.OSDTexture osdInfo)
        {
            // Copy the passed textures
            _osdRenderer.DrawItem(osdInfo);

            // Override default behavior to force rendering also for still images (EVR doesn't provide new frames)
            _textureInvalid = true;

            if (!_evrDone)
            {
                RenderFrame();
                _evrDone = false;
            }
            return(0);
        }
Example #3
0
        private void InitTexture(BluRayAPI.OSDTexture item)
        {
            if (item.Width == 0 || item.Height == 0 || item.Texture == IntPtr.Zero)
            {
                FreeResources();
                return;
            }

            if (_combinedOsdTexture == null || _combinedOsdTexture.IsDisposed)
            {
                _combinedOsdTexture = new Texture(_device, _fullOsdSize.Width, _fullOsdSize.Height, 1, Usage.RenderTarget, FORMAT, Pool.Default);
                _combinedOsdSurface = _combinedOsdTexture.GetSurfaceLevel(0);

                _sprite = new Sprite(_device);

                Rectangle dstRect = new Rectangle(0, 0, _fullOsdSize.Width, _fullOsdSize.Height);
                _device.ColorFill(_combinedOsdSurface, dstRect, _transparentColor);
            }
        }
Example #4
0
        public void DrawItem(BluRayAPI.OSDTexture item)
        {
            try
            {
                lock (_syncObj)
                {
                    var index = (int)item.Plane;

                    // Dispose old texture only if new texture for plane is different
                    if (_planes[index] != null)
                    {
                        var isNewTexture = _planes[index].NativePointer != item.Texture;
                        if (isNewTexture)
                        {
                            FilterGraphTools.TryDispose(ref _planes[index]);
                        }
                    }

                    if (item.Width == 0 || item.Height == 0 || item.Texture == IntPtr.Zero)
                    {
                        return;
                    }

                    var texture = new Texture(item.Texture);
                    //SaveTexture(texture, index);
                    _planes[index] = texture;
                }
            }
            catch (Exception ex)
            {
                BluRayPlayerBuilder.LogError(ex.ToString());
            }

            if (_onTextureInvalidated != null)
            {
                _onTextureInvalidated();
            }
        }
Example #5
0
 public int OnOSDUpdate(BluRayAPI.OSDTexture osdInfo)
 {
     _osdRenderer.DrawItem(osdInfo);
     return(0);
 }