/// <summary> /// Initializes a new instance of the <see cref="CacherRenderContext" /> class. /// </summary> public CacherRenderContext() { this.d2dFactory = new D2DFactory(); this.dwtFactory = new DWFactory(); this.wicFactory = new WICFactory(); this.RendersToScreen = true; }
/// <summary> /// Performs application-defined tasks associated with freeing, releasing, or resetting /// unmanaged resources. /// </summary> public void Dispose() { foreach (var item in this.brushCache.Values) { item.Dispose(); } foreach (var item in this.imageCache.Values) { item.Dispose(); } this.imageCache.Clear(); this.brushCache.Clear(); if (this.renderTarget != null) { this.renderTarget.Dispose(); } foreach (var unit in this.renderUnits) { unit.Dispose(); } this.renderUnits.Clear(); // d2dFactory.Dispose(); this.dwtFactory.Dispose(); this.wicFactory.Dispose(); this.renderTarget = null; this.d2dFactory = null; this.dwtFactory = null; this.wicFactory = null; }