private void DrawTearingTest() { using (Surface surface = _device.GetRenderTarget(0)) { int left = _tearingPos; int width = surface.Description.Width; int height = surface.Description.Height; Size size = new Size(4, height); Point topLeft = new Point(left, 0); if (topLeft.X + size.Width >= width) { topLeft.X = 0; } Rectangle rcTearing = SharpDXExtensions.CreateRectangle(topLeft, size); _device.ColorFill(surface, rcTearing, ColorConverter.FromArgb(255, 255, 255, 255)); topLeft = new Point((rcTearing.Right + 15) % width, 0); if (topLeft.X + size.Width >= width) { topLeft.X = 0; } rcTearing = SharpDXExtensions.CreateRectangle(topLeft, size); _device.ColorFill(surface, rcTearing, ColorConverter.FromArgb(255, 100, 100, 100)); _tearingPos = (_tearingPos + 7) % width; } }
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); } }