Sometimes we can't return float, for some reason (#1453)

Fixes #1409
This commit is contained in:
Matthew Leibowitz 2020-08-09 21:44:45 +02:00 коммит произвёл GitHub
Родитель e18d7677f2
Коммит adccd31c4f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 19 добавлений и 3 удалений

Просмотреть файл

@ -31,7 +31,7 @@ Xamarin.Forms reference 4.4.0.991757
# - milestone: the skia milestone determined by Google/Chromium
# - increment: the C API version increment caused by new APIs
libSkiaSharp milestone 80
libSkiaSharp increment 0
libSkiaSharp increment 1
# native sonames
libSkiaSharp soname 80.0.0

Просмотреть файл

@ -315,7 +315,9 @@ namespace SkiaSharp
if (!ValidateTextArgs (text, length, encoding))
return 0;
return SkiaApi.sk_font_measure_text (Handle, text, (IntPtr)length, encoding, bounds, paint?.Handle ?? IntPtr.Zero);
float measuredWidth;
SkiaApi.sk_font_measure_text_no_return (Handle, text, (IntPtr)length, encoding, bounds, paint?.Handle ?? IntPtr.Zero, &measuredWidth);
return measuredWidth;
}
// MeasureText (glyphs)

Просмотреть файл

@ -3945,6 +3945,20 @@ namespace SkiaSharp
(sk_font_measure_text_delegate ??= GetSymbol<Delegates.sk_font_measure_text> ("sk_font_measure_text")).Invoke (font, text, byteLength, encoding, bounds, paint);
#endif
// void sk_font_measure_text_no_return(const sk_font_t* font, const void* text, size_t byteLength, sk_text_encoding_t encoding, sk_rect_t* bounds, const sk_paint_t* paint, float* measuredWidth)
#if !USE_DELEGATES
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]
internal static extern void sk_font_measure_text_no_return (sk_font_t font, void* text, /* size_t */ IntPtr byteLength, SKTextEncoding encoding, SKRect* bounds, sk_paint_t paint, Single* measuredWidth);
#else
private partial class Delegates {
[UnmanagedFunctionPointer (CallingConvention.Cdecl)]
internal delegate void sk_font_measure_text_no_return (sk_font_t font, void* text, /* size_t */ IntPtr byteLength, SKTextEncoding encoding, SKRect* bounds, sk_paint_t paint, Single* measuredWidth);
}
private static Delegates.sk_font_measure_text_no_return sk_font_measure_text_no_return_delegate;
internal static void sk_font_measure_text_no_return (sk_font_t font, void* text, /* size_t */ IntPtr byteLength, SKTextEncoding encoding, SKRect* bounds, sk_paint_t paint, Single* measuredWidth) =>
(sk_font_measure_text_no_return_delegate ??= GetSymbol<Delegates.sk_font_measure_text_no_return> ("sk_font_measure_text_no_return")).Invoke (font, text, byteLength, encoding, bounds, paint, measuredWidth);
#endif
// sk_font_t* sk_font_new()
#if !USE_DELEGATES
[DllImport (SKIA, CallingConvention = CallingConvention.Cdecl)]

2
externals/skia поставляемый

@ -1 +1 @@
Subproject commit 4fa635eb7f02f95ef846642cff42c0f138b849ec
Subproject commit e85c747b9bb4232435b994d5e286ca689ce3ea88