Browse Source
Merge pull request #9558 from Gillibald/fixes/clearTypeRendering
Fix ClearType rendering
pull/9563/head
Benedikt Stebner
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with
10 additions and
8 deletions
-
src/Browser/Avalonia.Browser/Skia/BrowserSkiaGpuRenderSession.cs
-
src/Skia/Avalonia.Skia/FramebufferRenderTarget.cs
-
src/Skia/Avalonia.Skia/Gpu/OpenGl/FboSkiaSurface.cs
-
src/Skia/Avalonia.Skia/Gpu/OpenGl/GlRenderTarget.cs
-
src/Skia/Avalonia.Skia/Gpu/OpenGl/OpenGlBitmapImpl.cs
-
src/Skia/Avalonia.Skia/SurfaceRenderTarget.cs
-
BIN
tests/TestFiles/Skia/Controls/TextBlock/RestrictedHeight_VerticalAlign.expected.png
|
|
|
@ -9,7 +9,8 @@ namespace Avalonia.Browser.Skia |
|
|
|
|
|
|
|
public BrowserSkiaGpuRenderSession(BrowserSkiaSurface browserSkiaSurface, GRBackendRenderTarget renderTarget) |
|
|
|
{ |
|
|
|
_surface = SKSurface.Create(browserSkiaSurface.Context, renderTarget, browserSkiaSurface.Origin, browserSkiaSurface.ColorType); |
|
|
|
_surface = SKSurface.Create(browserSkiaSurface.Context, renderTarget, browserSkiaSurface.Origin, |
|
|
|
browserSkiaSurface.ColorType, new SKSurfaceProperties(SKPixelGeometry.RgbHorizontal)); |
|
|
|
|
|
|
|
GrContext = browserSkiaSurface.Context; |
|
|
|
|
|
|
|
|
|
|
|
@ -90,7 +90,8 @@ namespace Avalonia.Skia |
|
|
|
|
|
|
|
_currentFramebufferAddress = framebuffer.Address; |
|
|
|
|
|
|
|
var surface = SKSurface.Create(desiredImageInfo, _currentFramebufferAddress, framebuffer.RowBytes); |
|
|
|
var surface = SKSurface.Create(desiredImageInfo, _currentFramebufferAddress, |
|
|
|
framebuffer.RowBytes, new SKSurfaceProperties(SKPixelGeometry.RgbHorizontal)); |
|
|
|
|
|
|
|
// If surface cannot be created - try to create a compatibility shim first
|
|
|
|
if (surface == null) |
|
|
|
@ -148,7 +149,7 @@ namespace Avalonia.Skia |
|
|
|
$"Unable to create pixel format shim for conversion from {bitmapColorType} to {destinationInfo.ColorType}"); |
|
|
|
} |
|
|
|
|
|
|
|
Surface = SKSurface.Create(_bitmap.Info, _bitmap.GetPixels(), _bitmap.RowBytes); |
|
|
|
Surface = SKSurface.Create(_bitmap.Info, _bitmap.GetPixels(), _bitmap.RowBytes, new SKSurfaceProperties(SKPixelGeometry.RgbHorizontal)); |
|
|
|
|
|
|
|
if (Surface == null) |
|
|
|
{ |
|
|
|
|
|
|
|
@ -87,7 +87,7 @@ namespace Avalonia.Skia |
|
|
|
var target = new GRBackendRenderTarget(pixelSize.Width, pixelSize.Height, 0, 8, |
|
|
|
new GRGlFramebufferInfo((uint)_fbo, SKColorType.Rgba8888.ToGlSizedFormat())); |
|
|
|
Surface = SKSurface.Create(_grContext, target, |
|
|
|
surfaceOrigin, SKColorType.Rgba8888); |
|
|
|
surfaceOrigin, SKColorType.Rgba8888, new SKSurfaceProperties(SKPixelGeometry.RgbHorizontal)); |
|
|
|
CanBlit = gl.IsBlitFramebufferAvailable; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -91,7 +91,7 @@ namespace Avalonia.Skia |
|
|
|
var renderTarget = new GRBackendRenderTarget(size.Width, size.Height, samples, disp.StencilSize, glInfo); |
|
|
|
var surface = SKSurface.Create(_grContext, renderTarget, |
|
|
|
glSession.IsYFlipped ? GRSurfaceOrigin.TopLeft : GRSurfaceOrigin.BottomLeft, |
|
|
|
colorType); |
|
|
|
colorType, new SKSurfaceProperties(SKPixelGeometry.RgbHorizontal)); |
|
|
|
|
|
|
|
success = true; |
|
|
|
|
|
|
|
|
|
|
|
@ -42,7 +42,7 @@ namespace Avalonia.Skia |
|
|
|
GlConsts.GL_TEXTURE_2D, (uint)_surface.GetTextureId(), |
|
|
|
(uint)_surface.InternalFormat))) |
|
|
|
using (var surface = SKSurface.Create(context.GrContext, backendTexture, GRSurfaceOrigin.BottomLeft, |
|
|
|
SKColorType.Rgba8888)) |
|
|
|
SKColorType.Rgba8888, new SKSurfaceProperties(SKPixelGeometry.RgbHorizontal))) |
|
|
|
{ |
|
|
|
// Again, silently ignore, if something went wrong it's not our fault
|
|
|
|
if (surface == null) |
|
|
|
|
|
|
|
@ -77,8 +77,8 @@ namespace Avalonia.Skia |
|
|
|
{ |
|
|
|
var imageInfo = MakeImageInfo(width, height, format); |
|
|
|
if (gpu != null) |
|
|
|
return SKSurface.Create(gpu, false, imageInfo); |
|
|
|
return SKSurface.Create(imageInfo); |
|
|
|
return SKSurface.Create(gpu, false, imageInfo, new SKSurfaceProperties(SKPixelGeometry.RgbHorizontal)); |
|
|
|
return SKSurface.Create(imageInfo, new SKSurfaceProperties(SKPixelGeometry.RgbHorizontal)); |
|
|
|
} |
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
Width:
|
Height:
|
Size: 532 B
Width:
|
Height:
|
Size: 518 B
|