Verify Views files against decompiled, extract embedded types
Fixed files: - SkiaImageButton.cs: Added SVG support with multi-path search - SkiaNavigationPage.cs: Added LinuxApplication.IsGtkMode check - SkiaRefreshView.cs: Added ICommand support (Command, CommandParameter) - SkiaTemplatedView.cs: Added missing using statements Extracted embedded types to separate files (matching decompiled pattern): - From SkiaMenuBar.cs: MenuBarItem, MenuItem, SkiaMenuFlyout, MenuItemClickedEventArgs - From SkiaNavigationPage.cs: NavigationEventArgs - From SkiaTabbedPage.cs: TabItem - From SkiaVisualStateManager.cs: SkiaVisualStateGroupList, SkiaVisualStateGroup, SkiaVisualState, SkiaVisualStateSetter - From SkiaSwipeView.cs: SwipeItem, SwipeStartedEventArgs, SwipeEndedEventArgs - From SkiaFlyoutPage.cs: FlyoutLayoutBehavior (already separate) - From SkiaIndicatorView.cs: IndicatorShape (already separate) - From SkiaBorder.cs: SkiaFrame - From SkiaCarouselView.cs: PositionChangedEventArgs - From SkiaCollectionView.cs: SkiaSelectionMode, ItemsLayoutOrientation - From SkiaContentPresenter.cs: LayoutAlignment Verified matching decompiled: - SkiaContextMenu.cs, SkiaFlexLayout.cs, SkiaGraphicsView.cs Build: 0 errors 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -333,17 +333,3 @@ public class GpuRenderingEngine : IDisposable
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// GPU performance statistics.
|
||||
/// </summary>
|
||||
public class GpuStats
|
||||
{
|
||||
public bool IsGpuAccelerated { get; init; }
|
||||
public int MaxTextureSize { get; init; }
|
||||
public long ResourceCacheUsedBytes { get; init; }
|
||||
public long ResourceCacheLimitBytes { get; init; }
|
||||
|
||||
public double ResourceCacheUsedMB => ResourceCacheUsedBytes / (1024.0 * 1024.0);
|
||||
public double ResourceCacheLimitMB => ResourceCacheLimitBytes / (1024.0 * 1024.0);
|
||||
}
|
||||
|
||||
19
Rendering/GpuStats.cs
Normal file
19
Rendering/GpuStats.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
namespace Microsoft.Maui.Platform.Linux.Rendering;
|
||||
|
||||
public class GpuStats
|
||||
{
|
||||
public bool IsGpuAccelerated { get; init; }
|
||||
|
||||
public int MaxTextureSize { get; init; }
|
||||
|
||||
public long ResourceCacheUsedBytes { get; init; }
|
||||
|
||||
public long ResourceCacheLimitBytes { get; init; }
|
||||
|
||||
public double ResourceCacheUsedMB => ResourceCacheUsedBytes / 1048576.0;
|
||||
|
||||
public double ResourceCacheLimitMB => ResourceCacheLimitBytes / 1048576.0;
|
||||
}
|
||||
75
Rendering/LayeredRenderer.cs
Normal file
75
Rendering/LayeredRenderer.cs
Normal file
@@ -0,0 +1,75 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Microsoft.Maui.Platform.Linux.Rendering;
|
||||
|
||||
public class LayeredRenderer : IDisposable
|
||||
{
|
||||
private readonly Dictionary<int, RenderLayer> _layers = new();
|
||||
private readonly object _lock = new();
|
||||
private bool _disposed;
|
||||
|
||||
public RenderLayer GetLayer(int zIndex)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
if (!_layers.TryGetValue(zIndex, out var layer))
|
||||
{
|
||||
layer = new RenderLayer(zIndex);
|
||||
_layers[zIndex] = layer;
|
||||
}
|
||||
return layer;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveLayer(int zIndex)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
if (_layers.TryGetValue(zIndex, out var layer))
|
||||
{
|
||||
layer.Dispose();
|
||||
_layers.Remove(zIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Composite(SKCanvas canvas, SKRect bounds)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
foreach (var layer in _layers.Values.OrderBy(l => l.ZIndex))
|
||||
{
|
||||
layer.DrawTo(canvas, bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void InvalidateAll()
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
foreach (var layer in _layers.Values)
|
||||
{
|
||||
layer.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed) return;
|
||||
_disposed = true;
|
||||
|
||||
lock (_lock)
|
||||
{
|
||||
foreach (var layer in _layers.Values)
|
||||
{
|
||||
layer.Dispose();
|
||||
}
|
||||
_layers.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -236,291 +236,3 @@ public class RenderCache : IDisposable
|
||||
public int AccessCount { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides layered rendering for separating static and dynamic content.
|
||||
/// </summary>
|
||||
public class LayeredRenderer : IDisposable
|
||||
{
|
||||
private readonly Dictionary<int, RenderLayer> _layers = new();
|
||||
private readonly object _lock = new();
|
||||
private bool _disposed;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or creates a render layer.
|
||||
/// </summary>
|
||||
public RenderLayer GetLayer(int zIndex)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
if (!_layers.TryGetValue(zIndex, out var layer))
|
||||
{
|
||||
layer = new RenderLayer(zIndex);
|
||||
_layers[zIndex] = layer;
|
||||
}
|
||||
return layer;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Removes a render layer.
|
||||
/// </summary>
|
||||
public void RemoveLayer(int zIndex)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
if (_layers.TryGetValue(zIndex, out var layer))
|
||||
{
|
||||
layer.Dispose();
|
||||
_layers.Remove(zIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Composites all layers onto the target canvas.
|
||||
/// </summary>
|
||||
public void Composite(SKCanvas canvas, SKRect bounds)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
foreach (var layer in _layers.Values.OrderBy(l => l.ZIndex))
|
||||
{
|
||||
layer.DrawTo(canvas, bounds);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invalidates all layers.
|
||||
/// </summary>
|
||||
public void InvalidateAll()
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
foreach (var layer in _layers.Values)
|
||||
{
|
||||
layer.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed) return;
|
||||
_disposed = true;
|
||||
|
||||
lock (_lock)
|
||||
{
|
||||
foreach (var layer in _layers.Values)
|
||||
{
|
||||
layer.Dispose();
|
||||
}
|
||||
_layers.Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents a single render layer with its own bitmap buffer.
|
||||
/// </summary>
|
||||
public class RenderLayer : IDisposable
|
||||
{
|
||||
private SKBitmap? _bitmap;
|
||||
private SKCanvas? _canvas;
|
||||
private bool _isDirty = true;
|
||||
private SKRect _bounds;
|
||||
private bool _disposed;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Z-index of this layer.
|
||||
/// </summary>
|
||||
public int ZIndex { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets whether this layer needs to be redrawn.
|
||||
/// </summary>
|
||||
public bool IsDirty => _isDirty;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether this layer is visible.
|
||||
/// </summary>
|
||||
public bool IsVisible { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the layer opacity (0-1).
|
||||
/// </summary>
|
||||
public float Opacity { get; set; } = 1f;
|
||||
|
||||
public RenderLayer(int zIndex)
|
||||
{
|
||||
ZIndex = zIndex;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Prepares the layer for rendering.
|
||||
/// </summary>
|
||||
public SKCanvas BeginDraw(SKRect bounds)
|
||||
{
|
||||
if (_bitmap == null || _bounds != bounds)
|
||||
{
|
||||
_bitmap?.Dispose();
|
||||
_canvas?.Dispose();
|
||||
|
||||
int width = Math.Max(1, (int)bounds.Width);
|
||||
int height = Math.Max(1, (int)bounds.Height);
|
||||
|
||||
_bitmap = new SKBitmap(width, height, SKColorType.Rgba8888, SKAlphaType.Premul);
|
||||
_canvas = new SKCanvas(_bitmap);
|
||||
_bounds = bounds;
|
||||
}
|
||||
|
||||
_canvas!.Clear(SKColors.Transparent);
|
||||
_isDirty = false;
|
||||
return _canvas;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Marks the layer as needing redraw.
|
||||
/// </summary>
|
||||
public void Invalidate()
|
||||
{
|
||||
_isDirty = true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Draws this layer to the target canvas.
|
||||
/// </summary>
|
||||
public void DrawTo(SKCanvas canvas, SKRect bounds)
|
||||
{
|
||||
if (!IsVisible || _bitmap == null) return;
|
||||
|
||||
using var paint = new SKPaint
|
||||
{
|
||||
Color = SKColors.White.WithAlpha((byte)(Opacity * 255))
|
||||
};
|
||||
|
||||
canvas.DrawBitmap(_bitmap, bounds.Left, bounds.Top, paint);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed) return;
|
||||
_disposed = true;
|
||||
|
||||
_canvas?.Dispose();
|
||||
_bitmap?.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides text rendering optimization with glyph caching.
|
||||
/// </summary>
|
||||
public class TextRenderCache : IDisposable
|
||||
{
|
||||
private readonly Dictionary<TextCacheKey, SKBitmap> _cache = new();
|
||||
private readonly object _lock = new();
|
||||
private int _maxEntries = 500;
|
||||
private bool _disposed;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the maximum number of cached text entries.
|
||||
/// </summary>
|
||||
public int MaxEntries
|
||||
{
|
||||
get => _maxEntries;
|
||||
set => _maxEntries = Math.Max(10, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a cached text bitmap or creates one.
|
||||
/// </summary>
|
||||
public SKBitmap GetOrCreate(string text, SKPaint paint)
|
||||
{
|
||||
var key = new TextCacheKey(text, paint);
|
||||
|
||||
lock (_lock)
|
||||
{
|
||||
if (_cache.TryGetValue(key, out var cached))
|
||||
{
|
||||
return cached;
|
||||
}
|
||||
|
||||
// Create text bitmap
|
||||
var bounds = new SKRect();
|
||||
paint.MeasureText(text, ref bounds);
|
||||
|
||||
int width = Math.Max(1, (int)Math.Ceiling(bounds.Width) + 2);
|
||||
int height = Math.Max(1, (int)Math.Ceiling(bounds.Height) + 2);
|
||||
|
||||
var bitmap = new SKBitmap(width, height, SKColorType.Rgba8888, SKAlphaType.Premul);
|
||||
using (var canvas = new SKCanvas(bitmap))
|
||||
{
|
||||
canvas.Clear(SKColors.Transparent);
|
||||
canvas.DrawText(text, -bounds.Left + 1, -bounds.Top + 1, paint);
|
||||
}
|
||||
|
||||
// Trim cache if needed
|
||||
if (_cache.Count >= _maxEntries)
|
||||
{
|
||||
var oldest = _cache.First();
|
||||
oldest.Value.Dispose();
|
||||
_cache.Remove(oldest.Key);
|
||||
}
|
||||
|
||||
_cache[key] = bitmap;
|
||||
return bitmap;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears all cached text.
|
||||
/// </summary>
|
||||
public void Clear()
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
foreach (var entry in _cache.Values)
|
||||
{
|
||||
entry.Dispose();
|
||||
}
|
||||
_cache.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed) return;
|
||||
_disposed = true;
|
||||
Clear();
|
||||
}
|
||||
|
||||
private readonly struct TextCacheKey : IEquatable<TextCacheKey>
|
||||
{
|
||||
private readonly string _text;
|
||||
private readonly float _textSize;
|
||||
private readonly SKColor _color;
|
||||
private readonly int _weight;
|
||||
private readonly int _hashCode;
|
||||
|
||||
public TextCacheKey(string text, SKPaint paint)
|
||||
{
|
||||
_text = text;
|
||||
_textSize = paint.TextSize;
|
||||
_color = paint.Color;
|
||||
_weight = paint.Typeface?.FontWeight ?? (int)SKFontStyleWeight.Normal;
|
||||
_hashCode = HashCode.Combine(_text, _textSize, _color, _weight);
|
||||
}
|
||||
|
||||
public bool Equals(TextCacheKey other)
|
||||
{
|
||||
return _text == other._text &&
|
||||
Math.Abs(_textSize - other._textSize) < 0.001f &&
|
||||
_color == other._color &&
|
||||
_weight == other._weight;
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj) => obj is TextCacheKey other && Equals(other);
|
||||
public override int GetHashCode() => _hashCode;
|
||||
}
|
||||
}
|
||||
|
||||
72
Rendering/RenderLayer.cs
Normal file
72
Rendering/RenderLayer.cs
Normal file
@@ -0,0 +1,72 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Microsoft.Maui.Platform.Linux.Rendering;
|
||||
|
||||
public class RenderLayer : IDisposable
|
||||
{
|
||||
private SKBitmap? _bitmap;
|
||||
private SKCanvas? _canvas;
|
||||
private bool _isDirty = true;
|
||||
private SKRect _bounds;
|
||||
private bool _disposed;
|
||||
|
||||
public int ZIndex { get; }
|
||||
|
||||
public bool IsDirty => _isDirty;
|
||||
|
||||
public bool IsVisible { get; set; } = true;
|
||||
|
||||
public float Opacity { get; set; } = 1f;
|
||||
|
||||
public RenderLayer(int zIndex)
|
||||
{
|
||||
ZIndex = zIndex;
|
||||
}
|
||||
|
||||
public SKCanvas BeginDraw(SKRect bounds)
|
||||
{
|
||||
if (_bitmap == null || _bounds != bounds)
|
||||
{
|
||||
_bitmap?.Dispose();
|
||||
_canvas?.Dispose();
|
||||
|
||||
var width = Math.Max(1, (int)bounds.Width);
|
||||
var height = Math.Max(1, (int)bounds.Height);
|
||||
_bitmap = new SKBitmap(width, height, SKColorType.Bgra8888, SKAlphaType.Premul);
|
||||
_canvas = new SKCanvas(_bitmap);
|
||||
_bounds = bounds;
|
||||
}
|
||||
|
||||
_canvas!.Clear(SKColors.Transparent);
|
||||
_isDirty = false;
|
||||
return _canvas;
|
||||
}
|
||||
|
||||
public void Invalidate()
|
||||
{
|
||||
_isDirty = true;
|
||||
}
|
||||
|
||||
public void DrawTo(SKCanvas canvas, SKRect bounds)
|
||||
{
|
||||
if (!IsVisible || _bitmap == null) return;
|
||||
|
||||
using var paint = new SKPaint
|
||||
{
|
||||
Color = SKColors.White.WithAlpha((byte)(Opacity * 255f))
|
||||
};
|
||||
canvas.DrawBitmap(_bitmap, bounds.Left, bounds.Top, paint);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed) return;
|
||||
_disposed = true;
|
||||
|
||||
_canvas?.Dispose();
|
||||
_bitmap?.Dispose();
|
||||
}
|
||||
}
|
||||
43
Rendering/ResourceCache.cs
Normal file
43
Rendering/ResourceCache.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Microsoft.Maui.Platform.Linux.Rendering;
|
||||
|
||||
public class ResourceCache : IDisposable
|
||||
{
|
||||
private readonly Dictionary<string, SKTypeface> _typefaces = new();
|
||||
private bool _disposed;
|
||||
|
||||
public SKTypeface GetTypeface(string fontFamily, SKFontStyle style)
|
||||
{
|
||||
var key = $"{fontFamily}_{style.Weight}_{style.Width}_{style.Slant}";
|
||||
|
||||
if (!_typefaces.TryGetValue(key, out var typeface))
|
||||
{
|
||||
typeface = SKTypeface.FromFamilyName(fontFamily, style) ?? SKTypeface.Default;
|
||||
_typefaces[key] = typeface;
|
||||
}
|
||||
|
||||
return typeface;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
foreach (var typeface in _typefaces.Values)
|
||||
{
|
||||
typeface.Dispose();
|
||||
}
|
||||
_typefaces.Clear();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
Clear();
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -313,31 +313,3 @@ public class SkiaRenderingEngine : IDisposable
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
public class ResourceCache : IDisposable
|
||||
{
|
||||
private readonly Dictionary<string, SKTypeface> _typefaces = new();
|
||||
private bool _disposed;
|
||||
|
||||
public SKTypeface GetTypeface(string fontFamily, SKFontStyle style)
|
||||
{
|
||||
var key = $"{fontFamily}_{style.Weight}_{style.Width}_{style.Slant}";
|
||||
if (!_typefaces.TryGetValue(key, out var typeface))
|
||||
{
|
||||
typeface = SKTypeface.FromFamilyName(fontFamily, style) ?? SKTypeface.Default;
|
||||
_typefaces[key] = typeface;
|
||||
}
|
||||
return typeface;
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
foreach (var tf in _typefaces.Values) tf.Dispose();
|
||||
_typefaces.Clear();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (!_disposed) { Clear(); _disposed = true; }
|
||||
}
|
||||
}
|
||||
|
||||
108
Rendering/TextRenderCache.cs
Normal file
108
Rendering/TextRenderCache.cs
Normal file
@@ -0,0 +1,108 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
|
||||
using SkiaSharp;
|
||||
|
||||
namespace Microsoft.Maui.Platform.Linux.Rendering;
|
||||
|
||||
public class TextRenderCache : IDisposable
|
||||
{
|
||||
private readonly struct TextCacheKey : IEquatable<TextCacheKey>
|
||||
{
|
||||
private readonly string _text;
|
||||
private readonly float _textSize;
|
||||
private readonly SKColor _color;
|
||||
private readonly int _weight;
|
||||
private readonly int _hashCode;
|
||||
|
||||
public TextCacheKey(string text, SKPaint paint)
|
||||
{
|
||||
_text = text;
|
||||
_textSize = paint.TextSize;
|
||||
_color = paint.Color;
|
||||
_weight = paint.Typeface?.FontWeight ?? 400;
|
||||
_hashCode = HashCode.Combine(_text, _textSize, _color, _weight);
|
||||
}
|
||||
|
||||
public bool Equals(TextCacheKey other)
|
||||
{
|
||||
return _text == other._text
|
||||
&& Math.Abs(_textSize - other._textSize) < 0.001f
|
||||
&& _color == other._color
|
||||
&& _weight == other._weight;
|
||||
}
|
||||
|
||||
public override bool Equals(object? obj)
|
||||
{
|
||||
return obj is TextCacheKey other && Equals(other);
|
||||
}
|
||||
|
||||
public override int GetHashCode() => _hashCode;
|
||||
}
|
||||
|
||||
private readonly Dictionary<TextCacheKey, SKBitmap> _cache = new();
|
||||
private readonly object _lock = new();
|
||||
private int _maxEntries = 500;
|
||||
private bool _disposed;
|
||||
|
||||
public int MaxEntries
|
||||
{
|
||||
get => _maxEntries;
|
||||
set => _maxEntries = Math.Max(10, value);
|
||||
}
|
||||
|
||||
public SKBitmap GetOrCreate(string text, SKPaint paint)
|
||||
{
|
||||
var key = new TextCacheKey(text, paint);
|
||||
|
||||
lock (_lock)
|
||||
{
|
||||
if (_cache.TryGetValue(key, out var cached))
|
||||
{
|
||||
return cached;
|
||||
}
|
||||
|
||||
var bounds = new SKRect();
|
||||
paint.MeasureText(text, ref bounds);
|
||||
|
||||
var width = Math.Max(1, (int)Math.Ceiling(bounds.Width) + 2);
|
||||
var height = Math.Max(1, (int)Math.Ceiling(bounds.Height) + 2);
|
||||
|
||||
var bitmap = new SKBitmap(width, height, SKColorType.Bgra8888, SKAlphaType.Premul);
|
||||
using var canvas = new SKCanvas(bitmap);
|
||||
canvas.Clear(SKColors.Transparent);
|
||||
canvas.DrawText(text, -bounds.Left + 1f, -bounds.Top + 1f, paint);
|
||||
|
||||
if (_cache.Count >= _maxEntries)
|
||||
{
|
||||
var first = _cache.First();
|
||||
first.Value.Dispose();
|
||||
_cache.Remove(first.Key);
|
||||
}
|
||||
|
||||
_cache[key] = bitmap;
|
||||
return bitmap;
|
||||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
foreach (var bitmap in _cache.Values)
|
||||
{
|
||||
bitmap.Dispose();
|
||||
}
|
||||
_cache.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (!_disposed)
|
||||
{
|
||||
_disposed = true;
|
||||
Clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user