public override void Render(RenderContext parentRenderContext) { Effect effect = Effect; if (!IsVisible || effect == null) { return; } RectangleF bounds = ActualBounds; if (bounds.Width <= 0 || bounds.Height <= 0) { return; } Matrix?layoutTransformMatrix = LayoutTransform == null ? new Matrix?() : LayoutTransform.GetTransform(); Matrix?renderTransformMatrix = RenderTransform == null ? new Matrix?() : RenderTransform.GetTransform(); RenderContext localRenderContext = parentRenderContext.Derive(bounds, layoutTransformMatrix, renderTransformMatrix, RenderTransformOrigin, Opacity); _inverseFinalTransform = Matrix.Invert(localRenderContext.Transform); DeviceEx device = SkinContext.Device; Surface backBuffer = device.GetRenderTarget(0); SurfaceDescription desc = backBuffer.Description; SurfaceDescription?textureDesc = _texture == null ? new SurfaceDescription?() : _texture.GetLevelDescription(0); if (!textureDesc.HasValue || textureDesc.Value.Width != desc.Width || textureDesc.Value.Height != desc.Height) { TryDispose(ref _texture); _texture = new Texture(device, desc.Width, desc.Height, 1, Usage.RenderTarget, Format.A8R8G8B8, Pool.Default); } using (Surface destSurfaceRef = _texture.GetSurfaceLevel(0)) device.StretchRectangle(backBuffer, destSurfaceRef, TextureFilter.None); UpdateEffectMask(effect, localRenderContext.OccupiedTransformedBounds, desc.Width, desc.Height, localRenderContext.ZOrder); if (effect.BeginRender(_texture, new RenderContext(Matrix.Identity, 1.0d, bounds, localRenderContext.ZOrder))) { _effectContext.Render(0); effect.EndRender(); } backBuffer.Dispose(); }