Roll to CanvasKit 0.31.0 (flutter/engine#29772)

* [web] roll CanvasKit to version 0.31.0
This commit is contained in:
Yegor
2021-11-17 15:53:58 -08:00
committed by GitHub
parent 44164d408e
commit 2df67fa9d4
6 changed files with 13 additions and 7 deletions

2
DEPS
View File

@@ -31,7 +31,7 @@ vars = {
# WARNING: DO NOT EDIT canvaskit_cipd_instance MANUALLY
# See `lib/web_ui/README.md` for how to roll CanvasKit to a new version.
'canvaskit_cipd_instance': '1e8cK_8LOs0dz4lqd20LwTUYNqfu_4YL-dFG5yK1xXQC',
'canvaskit_cipd_instance': 'NcwvqeeKK7urddCbEdDvHytdaCiCA_8-4oS_T_ouGfgC',
# When updating the Dart revision, ensure that all entries that are
# dependencies of Dart are also updated to match the entries in the

View File

@@ -1,4 +1,4 @@
# Specifies the version of CanvasKit to use for Flutter Web apps.
#
# See `lib/web_ui/README.md` for how to update this file.
canvaskit_version: "0.30.0"
canvaskit_version: "0.31.0"

View File

@@ -104,6 +104,7 @@ class CanvasKit {
external SkFontMgrNamespace get FontMgr;
external TypefaceFontProviderNamespace get TypefaceFontProvider;
external SkTypefaceFactory get Typeface;
external int GetWebGLContext(
html.CanvasElement canvas, SkWebGLContextOptions options);
external SkGrContext MakeGrContext(int glContext);
@@ -1869,7 +1870,6 @@ class SkTonalColors {
class SkFontMgrNamespace {
// TODO(yjbanov): can this be made non-null? It returns null in our unit-tests right now.
external SkFontMgr? FromData(List<Uint8List> fonts);
external SkFontMgr RefDefault();
}
@JS()
@@ -1877,6 +1877,12 @@ class TypefaceFontProviderNamespace {
external TypefaceFontProvider Make();
}
@JS()
@anonymous
class SkTypefaceFactory {
external SkTypeface? MakeFreeTypeFaceFromData(ByteBuffer fontData);
}
/// Collects Skia objects that are no longer necessary.
abstract class Collector {
/// The production collector implementation.

View File

@@ -222,7 +222,7 @@ class FontFallbackData {
void registerFallbackFont(String family, Uint8List bytes) {
final SkTypeface? typeface =
canvasKit.FontMgr.RefDefault().MakeTypefaceFromData(bytes);
canvasKit.Typeface.MakeFreeTypeFaceFromData(bytes.buffer);
if (typeface == null) {
printWarning('Failed to parse fallback font $family as a font.');
return;

View File

@@ -84,7 +84,7 @@ class SkiaFontCollection {
}
final SkTypeface? typeface =
canvasKit.FontMgr.RefDefault().MakeTypefaceFromData(list);
canvasKit.Typeface.MakeFreeTypeFaceFromData(list.buffer);
if (typeface != null) {
_registeredFonts.add(RegisteredFont(list, fontFamily, typeface));
await ensureFontsLoaded();
@@ -160,7 +160,7 @@ class SkiaFontCollection {
final Uint8List bytes = buffer.asUint8List();
final SkTypeface? typeface =
canvasKit.FontMgr.RefDefault().MakeTypefaceFromData(bytes);
canvasKit.Typeface.MakeFreeTypeFaceFromData(bytes.buffer);
if (typeface != null) {
return RegisteredFont(bytes, family, typeface);
} else {

View File

@@ -32,7 +32,7 @@ import 'package:js/js.dart';
/// The version of CanvasKit used by the web engine by default.
// DO NOT EDIT THE NEXT LINE OF CODE MANUALLY
// See `lib/web_ui/README.md` for how to roll CanvasKit to a new version.
const String _canvaskitVersion = '0.30.0';
const String _canvaskitVersion = '0.31.0';
/// The Web Engine configuration for the current application.
FlutterConfiguration get configuration => _configuration ??= FlutterConfiguration(_jsConfiguration);