diff --git a/CPF.Skia/GlView.cs b/CPF.Skia/GlView.cs index 8d290c1..e963d4d 100644 --- a/CPF.Skia/GlView.cs +++ b/CPF.Skia/GlView.cs @@ -43,7 +43,7 @@ namespace CPF.Skia var size = new PixelSize((int)Math.Round(cSize.Width * Root.RenderScaling), (int)Math.Round(cSize.Height * Root.RenderScaling)); var skia = dc as SkiaDrawingContext; - var _gl = skia.GlContext; + var _gl = skia?.GlContext; if (_gl == null) { return; diff --git a/CPF.Skia/SkiaDrawingContext.cs b/CPF.Skia/SkiaDrawingContext.cs index 1541bca..1fa4e87 100644 --- a/CPF.Skia/SkiaDrawingContext.cs +++ b/CPF.Skia/SkiaDrawingContext.cs @@ -126,8 +126,8 @@ namespace CPF.Skia BITMAP BITMAP = new BITMAP(); UnmanagedMethods.GetObject(hbitmap, Marshal.SizeOf(typeof(BITMAP)), BITMAP); - var bitmap = new SKBitmap(BITMAP.bmWidth, BITMAP.bmHeight); - bitmap.SetPixels(BITMAP.bmBits); + var bitmap = new SKBitmap(); + bitmap.InstallPixels(new SKImageInfo(BITMAP.bmWidth, BITMAP.bmHeight, SKImageInfo.PlatformColorType), BITMAP.bmBits, BITMAP.bmWidthBytes); this.bitmap = bitmap; canvas = new SKCanvas(this.bitmap); diff --git a/CPF.Windows/CPF.Windows.csproj b/CPF.Windows/CPF.Windows.csproj index 3e8368f..2609173 100644 --- a/CPF.Windows/CPF.Windows.csproj +++ b/CPF.Windows/CPF.Windows.csproj @@ -52,6 +52,16 @@ + + + 8.0.6 + + + + + 8.0.6 + + Net4 diff --git a/CPF.Windows/GDIPlus/Extension.cs b/CPF.Windows/GDIPlus/Extension.cs index ca58a8f..acb1cf3 100644 --- a/CPF.Windows/GDIPlus/Extension.cs +++ b/CPF.Windows/GDIPlus/Extension.cs @@ -1,4 +1,4 @@ -#if Net4 +//#if Net4 using System; using System.Collections.Generic; using System.Text; @@ -83,4 +83,4 @@ namespace CPF.GDIPlus } } } -#endif \ No newline at end of file +//#endif \ No newline at end of file diff --git a/CPF.Windows/GDIPlus/GDIPlusBitmap.cs b/CPF.Windows/GDIPlus/GDIPlusBitmap.cs index 28dfea2..0b97599 100644 --- a/CPF.Windows/GDIPlus/GDIPlusBitmap.cs +++ b/CPF.Windows/GDIPlus/GDIPlusBitmap.cs @@ -1,4 +1,4 @@ -#if Net4 +//#if Net4 using System; using System.Collections.Generic; using System.IO; @@ -91,4 +91,4 @@ namespace CPF.GDIPlus } } } -#endif \ No newline at end of file +//#endif \ No newline at end of file diff --git a/CPF.Windows/GDIPlus/GDIPlusBitmapLock.cs b/CPF.Windows/GDIPlus/GDIPlusBitmapLock.cs index 6ecfd26..a9a90b9 100644 --- a/CPF.Windows/GDIPlus/GDIPlusBitmapLock.cs +++ b/CPF.Windows/GDIPlus/GDIPlusBitmapLock.cs @@ -1,4 +1,4 @@ -#if Net4 +//#if Net4 using System; using System.Collections.Generic; using System.Text; @@ -166,4 +166,4 @@ namespace CPF.GDIPlus } } } -#endif \ No newline at end of file +//#endif \ No newline at end of file diff --git a/CPF.Windows/GDIPlus/GDIPlusDrawingContext.cs b/CPF.Windows/GDIPlus/GDIPlusDrawingContext.cs index 95850b7..0b9cbc3 100644 --- a/CPF.Windows/GDIPlus/GDIPlusDrawingContext.cs +++ b/CPF.Windows/GDIPlus/GDIPlusDrawingContext.cs @@ -1,4 +1,4 @@ -#if Net4 +//#if Net4 using System; using System.Collections.Generic; using System.Text; @@ -802,4 +802,4 @@ namespace CPF.GDIPlus } -#endif \ No newline at end of file +//#endif \ No newline at end of file diff --git a/CPF.Windows/GDIPlus/GDIPlusDrawingFactory.cs b/CPF.Windows/GDIPlus/GDIPlusDrawingFactory.cs index e75c1a0..7b3cba5 100644 --- a/CPF.Windows/GDIPlus/GDIPlusDrawingFactory.cs +++ b/CPF.Windows/GDIPlus/GDIPlusDrawingFactory.cs @@ -1,4 +1,4 @@ -#if Net4 +//#if Net4 using CPF.Platform; using System; using System.Collections.Generic; @@ -20,7 +20,8 @@ namespace CPF.GDIPlus /// /// GDI+不支持GPU加速 /// - public override bool UseGPU { get => false; set => throw new NotSupportedException("GDI+不支持GPU加速"); } + private bool _useGPU = false; + public override bool UseGPU { get => _useGPU; set => _useGPU = false; } public override IImageImpl ImageFromFile(string path) { @@ -333,4 +334,4 @@ namespace CPF.GDIPlus } } } -#endif \ No newline at end of file +//#endif \ No newline at end of file diff --git a/CPF.Windows/GDIPlus/GDIPlusImage.cs b/CPF.Windows/GDIPlus/GDIPlusImage.cs index e112c92..04d25f0 100644 --- a/CPF.Windows/GDIPlus/GDIPlusImage.cs +++ b/CPF.Windows/GDIPlus/GDIPlusImage.cs @@ -1,4 +1,4 @@ -#if Net4 +//#if Net4 using System; using System.Collections.Generic; using System.Drawing; @@ -255,4 +255,4 @@ namespace CPF.GDIPlus } } } -#endif \ No newline at end of file +//#endif \ No newline at end of file diff --git a/CPF.Windows/GDIPlus/GDIPlusPath.cs b/CPF.Windows/GDIPlus/GDIPlusPath.cs index 37c1dd1..0991415 100644 --- a/CPF.Windows/GDIPlus/GDIPlusPath.cs +++ b/CPF.Windows/GDIPlus/GDIPlusPath.cs @@ -1,4 +1,4 @@ -#if Net4 +//#if Net4 using System; using System.Collections.Generic; using System.Drawing.Drawing2D; @@ -304,4 +304,4 @@ namespace CPF.GDIPlus } } } -#endif \ No newline at end of file +//#endif \ No newline at end of file diff --git a/CPF.Windows/GDIPlus/GDIPlusPathGeometry.cs b/CPF.Windows/GDIPlus/GDIPlusPathGeometry.cs index 79f70b4..a844e13 100644 --- a/CPF.Windows/GDIPlus/GDIPlusPathGeometry.cs +++ b/CPF.Windows/GDIPlus/GDIPlusPathGeometry.cs @@ -1,4 +1,4 @@ -#if Net4 +//#if Net4 using System; using System.Collections.Generic; using System.Text; @@ -70,4 +70,4 @@ namespace CPF.GDIPlus } } -#endif \ No newline at end of file +//#endif \ No newline at end of file