Roll CanvasKit to 0.22 (flutter/engine#23348)
This commit is contained in:
@@ -70,7 +70,7 @@ class CkCanvas {
|
||||
CkImage atlas,
|
||||
Float32List rstTransforms,
|
||||
Float32List rects,
|
||||
List<Float32List>? colors,
|
||||
Uint32List? colors,
|
||||
ui.BlendMode blendMode,
|
||||
) {
|
||||
skCanvas.drawAtlas(
|
||||
@@ -192,10 +192,10 @@ class CkCanvas {
|
||||
skCanvas.drawRect(toSkRect(rect), paint.skiaObject);
|
||||
}
|
||||
|
||||
void drawShadow(CkPath path, ui.Color color, double elevation,
|
||||
bool transparentOccluder) {
|
||||
drawSkShadow(skCanvas, path, color, elevation,
|
||||
transparentOccluder, ui.window.devicePixelRatio);
|
||||
void drawShadow(
|
||||
CkPath path, ui.Color color, double elevation, bool transparentOccluder) {
|
||||
drawSkShadow(skCanvas, path, color, elevation, transparentOccluder,
|
||||
ui.window.devicePixelRatio);
|
||||
}
|
||||
|
||||
void drawVertices(
|
||||
@@ -237,7 +237,8 @@ class CkCanvas {
|
||||
}
|
||||
|
||||
void saveLayerWithFilter(ui.Rect bounds, ui.ImageFilter filter) {
|
||||
final _CkManagedSkImageFilterConvertible convertible = filter as _CkManagedSkImageFilterConvertible;
|
||||
final _CkManagedSkImageFilterConvertible convertible =
|
||||
filter as _CkManagedSkImageFilterConvertible;
|
||||
return skCanvas.saveLayer(
|
||||
null,
|
||||
toSkRect(bounds),
|
||||
@@ -267,8 +268,8 @@ class CkCanvas {
|
||||
|
||||
class RecordingCkCanvas extends CkCanvas {
|
||||
RecordingCkCanvas(SkCanvas skCanvas, ui.Rect bounds)
|
||||
: pictureSnapshot = CkPictureSnapshot(bounds),
|
||||
super(skCanvas);
|
||||
: pictureSnapshot = CkPictureSnapshot(bounds),
|
||||
super(skCanvas);
|
||||
|
||||
@override
|
||||
final CkPictureSnapshot pictureSnapshot;
|
||||
@@ -310,7 +311,8 @@ class RecordingCkCanvas extends CkCanvas {
|
||||
CkPaint paint,
|
||||
) {
|
||||
super.drawArc(oval, startAngle, sweepAngle, useCenter, paint);
|
||||
_addCommand(CkDrawArcCommand(oval, startAngle, sweepAngle, useCenter, paint));
|
||||
_addCommand(
|
||||
CkDrawArcCommand(oval, startAngle, sweepAngle, useCenter, paint));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -319,11 +321,12 @@ class RecordingCkCanvas extends CkCanvas {
|
||||
CkImage atlas,
|
||||
Float32List rstTransforms,
|
||||
Float32List rects,
|
||||
List<Float32List>? colors,
|
||||
Uint32List? colors,
|
||||
ui.BlendMode blendMode,
|
||||
) {
|
||||
super.drawAtlasRaw(paint, atlas, rstTransforms, rects, colors, blendMode);
|
||||
_addCommand(CkDrawAtlasCommand(paint, atlas, rstTransforms, rects, colors, blendMode));
|
||||
_addCommand(CkDrawAtlasCommand(
|
||||
paint, atlas, rstTransforms, rects, colors, blendMode));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -418,10 +421,11 @@ class RecordingCkCanvas extends CkCanvas {
|
||||
}
|
||||
|
||||
@override
|
||||
void drawShadow(CkPath path, ui.Color color, double elevation,
|
||||
bool transparentOccluder) {
|
||||
void drawShadow(
|
||||
CkPath path, ui.Color color, double elevation, bool transparentOccluder) {
|
||||
super.drawShadow(path, color, elevation, transparentOccluder);
|
||||
_addCommand(CkDrawShadowCommand(path, color, elevation, transparentOccluder));
|
||||
_addCommand(
|
||||
CkDrawShadowCommand(path, color, elevation, transparentOccluder));
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -627,7 +631,7 @@ class CkTransformCommand extends CkPaintCommand {
|
||||
@override
|
||||
void apply(SkCanvas canvas) {
|
||||
canvas.concat(toSkMatrixFromFloat32(matrix4));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CkSkewCommand extends CkPaintCommand {
|
||||
@@ -660,7 +664,8 @@ class CkClipRectCommand extends CkPaintCommand {
|
||||
}
|
||||
|
||||
class CkDrawArcCommand extends CkPaintCommand {
|
||||
CkDrawArcCommand(this.oval, this.startAngle, this.sweepAngle, this.useCenter, this.paint);
|
||||
CkDrawArcCommand(
|
||||
this.oval, this.startAngle, this.sweepAngle, this.useCenter, this.paint);
|
||||
|
||||
final ui.Rect oval;
|
||||
final double startAngle;
|
||||
@@ -682,13 +687,14 @@ class CkDrawArcCommand extends CkPaintCommand {
|
||||
}
|
||||
|
||||
class CkDrawAtlasCommand extends CkPaintCommand {
|
||||
CkDrawAtlasCommand(this.paint, this.atlas, this.rstTransforms, this.rects, this.colors, this.blendMode);
|
||||
CkDrawAtlasCommand(this.paint, this.atlas, this.rstTransforms, this.rects,
|
||||
this.colors, this.blendMode);
|
||||
|
||||
final CkPaint paint;
|
||||
final CkImage atlas;
|
||||
final Float32List rstTransforms;
|
||||
final Float32List rects;
|
||||
final List<Float32List>? colors;
|
||||
final Uint32List? colors;
|
||||
final ui.BlendMode blendMode;
|
||||
|
||||
@override
|
||||
@@ -924,7 +930,7 @@ class CkDrawImageCommand extends CkPaintCommand {
|
||||
final CkPaint paint;
|
||||
|
||||
CkDrawImageCommand(CkImage image, this.offset, this.paint)
|
||||
: this.image = image.clone();
|
||||
: this.image = image.clone();
|
||||
|
||||
@override
|
||||
void apply(SkCanvas canvas) {
|
||||
@@ -949,7 +955,7 @@ class CkDrawImageRectCommand extends CkPaintCommand {
|
||||
final CkPaint paint;
|
||||
|
||||
CkDrawImageRectCommand(CkImage image, this.src, this.dst, this.paint)
|
||||
: this.image = image.clone();
|
||||
: this.image = image.clone();
|
||||
|
||||
@override
|
||||
void apply(SkCanvas canvas) {
|
||||
@@ -970,7 +976,7 @@ class CkDrawImageRectCommand extends CkPaintCommand {
|
||||
|
||||
class CkDrawImageNineCommand extends CkPaintCommand {
|
||||
CkDrawImageNineCommand(CkImage image, this.center, this.dst, this.paint)
|
||||
: this.image = image.clone();
|
||||
: this.image = image.clone();
|
||||
|
||||
final CkImage image;
|
||||
final ui.Rect center;
|
||||
@@ -1061,7 +1067,8 @@ class CkSaveLayerWithFilterCommand extends CkPaintCommand {
|
||||
|
||||
@override
|
||||
void apply(SkCanvas canvas) {
|
||||
final _CkManagedSkImageFilterConvertible convertible = filter as _CkManagedSkImageFilterConvertible;
|
||||
final _CkManagedSkImageFilterConvertible convertible =
|
||||
filter as _CkManagedSkImageFilterConvertible;
|
||||
return canvas.saveLayer(
|
||||
null,
|
||||
toSkRect(bounds),
|
||||
|
||||
@@ -30,6 +30,8 @@ class CanvasKit {
|
||||
external SkFilterQualityEnum get FilterQuality;
|
||||
external SkBlurStyleEnum get BlurStyle;
|
||||
external SkTileModeEnum get TileMode;
|
||||
external SkFilterModeEnum get FilterMode;
|
||||
external SkMipmapModeEnum get MipmapMode;
|
||||
external SkFillTypeEnum get FillType;
|
||||
external SkAlphaTypeEnum get AlphaType;
|
||||
external SkColorTypeEnum get ColorType;
|
||||
@@ -49,14 +51,13 @@ class CanvasKit {
|
||||
external SkMaskFilterNamespace get MaskFilter;
|
||||
external SkColorFilterNamespace get ColorFilter;
|
||||
external SkImageFilterNamespace get ImageFilter;
|
||||
external SkPath MakePathFromOp(SkPath path1, SkPath path2, SkPathOp pathOp);
|
||||
external SkPathNamespace get Path;
|
||||
external SkTonalColors computeTonalColors(SkTonalColors inTonalColors);
|
||||
external SkVertices MakeVertices(
|
||||
SkVertexMode mode,
|
||||
List<Float32List> positions,
|
||||
List<Float32List>? textureCoordinates,
|
||||
// TODO(yjbanov): make this Uint32Array when CanvasKit supports it.
|
||||
List<Float32List>? colors,
|
||||
Float32List positions,
|
||||
Float32List? textureCoordinates,
|
||||
Uint32List? colors,
|
||||
Uint16List? indices,
|
||||
);
|
||||
external SkParagraphBuilderNamespace get ParagraphBuilder;
|
||||
@@ -96,25 +97,17 @@ class CanvasKit {
|
||||
external SkSurface MakeSWCanvasSurface(html.CanvasElement canvas);
|
||||
external void setCurrentContext(int glContext);
|
||||
|
||||
/// Creates an [SkPath] using commands obtained from [SkPath.toCmds].
|
||||
// TODO(yjbanov): switch to CanvasKit.Path.MakeFromCmds when it's available.
|
||||
external SkPath MakePathFromCmds(List<dynamic> pathCommands);
|
||||
|
||||
/// Creates an image from decoded pixels represented as a list of bytes.
|
||||
///
|
||||
/// The pixel data must match the [width], [height], [alphaType], [colorType],
|
||||
/// and [colorSpace].
|
||||
/// The pixel data must be encoded according to the image info in [info].
|
||||
///
|
||||
/// Typically pixel data is obtained using [SkImage.readPixels]. The
|
||||
/// parameters specified in [SkImageInfo] passed [SkImage.readPixels] much
|
||||
/// match the arguments passed to this method.
|
||||
/// parameters specified in [SkImageInfo] passed [SkImage.readPixels] must
|
||||
/// match [info].
|
||||
external SkImage MakeImage(
|
||||
Uint8List imageData,
|
||||
int width,
|
||||
int height,
|
||||
SkAlphaType alphaType,
|
||||
SkColorType colorType,
|
||||
ColorSpace colorSpace,
|
||||
SkImageInfo info,
|
||||
Uint8List pixels,
|
||||
int bytesPerRow,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -661,6 +654,29 @@ SkTileMode toSkTileMode(ui.TileMode mode) {
|
||||
return _skTileModes[mode.index];
|
||||
}
|
||||
|
||||
@JS()
|
||||
class SkFilterModeEnum {
|
||||
external SkFilterMode get Nearest;
|
||||
external SkFilterMode get Linear;
|
||||
}
|
||||
|
||||
@JS()
|
||||
class SkFilterMode {
|
||||
external int get value;
|
||||
}
|
||||
|
||||
@JS()
|
||||
class SkMipmapModeEnum {
|
||||
external SkMipmapMode get None;
|
||||
external SkMipmapMode get Nearest;
|
||||
external SkMipmapMode get Linear;
|
||||
}
|
||||
|
||||
@JS()
|
||||
class SkMipmapMode {
|
||||
external int get value;
|
||||
}
|
||||
|
||||
@JS()
|
||||
class SkAlphaTypeEnum {
|
||||
external SkAlphaType get Opaque;
|
||||
@@ -718,12 +734,14 @@ class SkImage {
|
||||
external void delete();
|
||||
external int width();
|
||||
external int height();
|
||||
external SkShader makeShader(
|
||||
external SkShader makeShaderOptions(
|
||||
SkTileMode tileModeX,
|
||||
SkTileMode tileModeY,
|
||||
SkFilterMode filterMode,
|
||||
SkMipmapMode mipmapMode,
|
||||
Float32List? matrix, // 3x3 matrix
|
||||
);
|
||||
external Uint8List readPixels(SkImageInfo imageInfo, int srcX, int srcY);
|
||||
external Uint8List readPixels(int srcX, int srcY, SkImageInfo imageInfo);
|
||||
external SkData encodeToData();
|
||||
external bool isAliasOf(SkImage other);
|
||||
external bool isDeleted();
|
||||
@@ -734,7 +752,7 @@ class SkShaderNamespace {
|
||||
external SkShader MakeLinearGradient(
|
||||
Float32List from, // 2-element array
|
||||
Float32List to, // 2-element array
|
||||
List<Float32List> colors,
|
||||
Uint32List colors,
|
||||
Float32List colorStops,
|
||||
SkTileMode tileMode,
|
||||
);
|
||||
@@ -742,7 +760,7 @@ class SkShaderNamespace {
|
||||
external SkShader MakeRadialGradient(
|
||||
Float32List center, // 2-element array
|
||||
double radius,
|
||||
List<Float32List> colors,
|
||||
Uint32List colors,
|
||||
Float32List colorStops,
|
||||
SkTileMode tileMode,
|
||||
Float32List? matrix, // 3x3 matrix
|
||||
@@ -754,7 +772,7 @@ class SkShaderNamespace {
|
||||
double focalRadius,
|
||||
Float32List center,
|
||||
double radius,
|
||||
List<Float32List> colors,
|
||||
Uint32List colors,
|
||||
Float32List colorStops,
|
||||
SkTileMode tileMode,
|
||||
Float32List? matrix, // 3x3 matrix
|
||||
@@ -764,7 +782,7 @@ class SkShaderNamespace {
|
||||
external SkShader MakeSweepGradient(
|
||||
double cx,
|
||||
double cy,
|
||||
List<Float32List> colors,
|
||||
Uint32List colors,
|
||||
Float32List colorStops,
|
||||
SkTileMode tileMode,
|
||||
Float32List? matrix, // 3x3 matrix
|
||||
@@ -783,7 +801,7 @@ class SkShader {
|
||||
@JS()
|
||||
class SkMaskFilterNamespace {
|
||||
external SkMaskFilter MakeBlur(
|
||||
SkBlurStyle blurStyle, double sigma, bool respectCTM);
|
||||
SkBlurStyle blurStyle, double sigma, bool respectCTM);
|
||||
}
|
||||
|
||||
// This needs to be bound to top-level because SkPaint is initialized
|
||||
@@ -864,6 +882,15 @@ class SkImageFilter {
|
||||
external void delete();
|
||||
}
|
||||
|
||||
@JS()
|
||||
class SkPathNamespace {
|
||||
/// Creates an [SkPath] using commands obtained from [SkPath.toCmds].
|
||||
external SkPath MakeFromCmds(List<dynamic> pathCommands);
|
||||
|
||||
/// Creates an [SkPath] by combining [path1] and [path2] using [pathOp].
|
||||
external SkPath MakeFromOp(SkPath path1, SkPath path2, SkPathOp pathOp);
|
||||
}
|
||||
|
||||
// Mappings from SkMatrix-index to input-index.
|
||||
const List<int> _skMatrixIndexToMatrix4Index = <int>[
|
||||
0, 4, 12, // Row 1
|
||||
@@ -1018,39 +1045,6 @@ Float32List toSharedSkColor3(ui.Color color) {
|
||||
|
||||
final SkFloat32List _sharedSkColor3 = mallocFloat32List(4);
|
||||
|
||||
Uint32List toSkIntColorList(List<ui.Color> colors) {
|
||||
final int len = colors.length;
|
||||
final Uint32List result = Uint32List(len);
|
||||
for (int i = 0; i < len; i++) {
|
||||
result[i] = colors[i].value;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
List<Float32List> toSkFloatColorList(List<ui.Color> colors) {
|
||||
final int len = colors.length;
|
||||
final List<Float32List> result = <Float32List>[];
|
||||
for (int i = 0; i < len; i++) {
|
||||
final Float32List array = Float32List(4);
|
||||
final ui.Color color = colors[i];
|
||||
array[0] = color.red / 255.0;
|
||||
array[1] = color.green / 255.0;
|
||||
array[2] = color.blue / 255.0;
|
||||
array[3] = color.alpha / 255.0;
|
||||
result.add(array);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
List<Float32List> encodeRawColorList(Int32List rawColors) {
|
||||
final int colorCount = rawColors.length;
|
||||
final List<ui.Color> colors = <ui.Color>[];
|
||||
for (int i = 0; i < colorCount; ++i) {
|
||||
colors.add(ui.Color(rawColors[i]));
|
||||
}
|
||||
return toSkFloatColorList(colors);
|
||||
}
|
||||
|
||||
@JS('window.flutterCanvasKit.Path')
|
||||
class SkPath {
|
||||
external SkPath([SkPath? other]);
|
||||
@@ -1183,7 +1177,7 @@ class SkPath {
|
||||
|
||||
/// Serializes the path into a list of commands.
|
||||
///
|
||||
/// The list can be used to create a new [SkPath] using [CanvasKit.MakePathFromCmds].
|
||||
/// The list can be used to create a new [SkPath] using [CanvasKit.Path.MakeFromCmds].
|
||||
external List<dynamic> toCmds();
|
||||
|
||||
external void delete();
|
||||
@@ -1264,32 +1258,23 @@ SkFloat32List toMallocedSkPoints(List<ui.Offset> points) {
|
||||
return skPoints;
|
||||
}
|
||||
|
||||
// TODO(yjbanov): this is inefficient. We should be able to pass points
|
||||
// as Float32List without a conversion.
|
||||
List<Float32List> rawPointsToSkPoints2d(Float32List points) {
|
||||
assert(points.length % 2 == 0);
|
||||
final int pointLength = points.length ~/ 2;
|
||||
final List<Float32List> result = <Float32List>[];
|
||||
for (int i = 0; i < pointLength; i++) {
|
||||
int x = i * 2;
|
||||
int y = x + 1;
|
||||
final Float32List skPoint = Float32List(2);
|
||||
skPoint[0] = points[x];
|
||||
skPoint[1] = points[y];
|
||||
result.add(skPoint);
|
||||
/// Converts a list of [ui.Offset] into a flat list of points.
|
||||
Float32List toFlatSkPoints(List<ui.Offset> points) {
|
||||
final int len = points.length;
|
||||
final Float32List result = Float32List(len * 2);
|
||||
for (int i = 0; i < len; i++) {
|
||||
result[2 * i] = points[i].dx;
|
||||
result[2 * i + 1] = points[i].dy;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
List<Float32List> toSkPoints2d(List<ui.Offset> offsets) {
|
||||
final int len = offsets.length;
|
||||
final List<Float32List> result = <Float32List>[];
|
||||
/// Converts a list of [ui.Color] into a flat list of ints.
|
||||
Uint32List toFlatColors(List<ui.Color> colors) {
|
||||
final int len = colors.length;
|
||||
final Uint32List result = Uint32List(len);
|
||||
for (int i = 0; i < len; i++) {
|
||||
final ui.Offset offset = offsets[i];
|
||||
final Float32List skPoint = Float32List(2);
|
||||
skPoint[0] = offset.dx;
|
||||
skPoint[1] = offset.dy;
|
||||
result.add(skPoint);
|
||||
result[i] = colors[i].value;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -1348,7 +1333,7 @@ class SkCanvas {
|
||||
Float32List rstTransforms,
|
||||
SkPaint paint,
|
||||
SkBlendMode blendMode,
|
||||
List<Float32List>? colors,
|
||||
Uint32List? colors,
|
||||
);
|
||||
external void drawCircle(
|
||||
double x,
|
||||
@@ -1786,7 +1771,8 @@ abstract class Collector {
|
||||
/// Uses timers to delete objects in batches and outside the animation frame.
|
||||
class ProductionCollector implements Collector {
|
||||
ProductionCollector() {
|
||||
_skObjectFinalizationRegistry = SkObjectFinalizationRegistry(js.allowInterop((SkDeletable deletable) {
|
||||
_skObjectFinalizationRegistry =
|
||||
SkObjectFinalizationRegistry(js.allowInterop((SkDeletable deletable) {
|
||||
// This is called when GC decides to collect the wrapper object and
|
||||
// notify us, which may happen after the object is already deleted
|
||||
// explicitly, e.g. when its ref count drops to zero. When that happens
|
||||
@@ -1967,7 +1953,8 @@ bool browserSupportsFinalizationRegistry =
|
||||
|
||||
/// Sets the value of [browserSupportsFinalizationRegistry] to its true value.
|
||||
void debugResetBrowserSupportsFinalizationRegistry() {
|
||||
browserSupportsFinalizationRegistry = _finalizationRegistryConstructor != null;
|
||||
browserSupportsFinalizationRegistry =
|
||||
_finalizationRegistryConstructor != null;
|
||||
}
|
||||
|
||||
@JS()
|
||||
|
||||
@@ -373,11 +373,11 @@ class CanvasKitCanvas implements ui.Canvas {
|
||||
rectBuffer[index3] = rect.bottom;
|
||||
}
|
||||
|
||||
final List<Float32List>? colorBuffer =
|
||||
(colors == null || colors.isEmpty) ? null : toSkFloatColorList(colors);
|
||||
final Uint32List? colorBuffer =
|
||||
(colors == null || colors.isEmpty) ? null : toFlatColors(colors);
|
||||
|
||||
_drawAtlas(
|
||||
paint, atlas, rstTransformBuffer, rectBuffer, colorBuffer, blendMode ?? ui.BlendMode.src);
|
||||
_drawAtlas(paint, atlas, rstTransformBuffer, rectBuffer, colorBuffer,
|
||||
blendMode ?? ui.BlendMode.src);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -406,9 +406,8 @@ class CanvasKitCanvas implements ui.Canvas {
|
||||
throw ArgumentError(
|
||||
'If non-null, "colors" length must be one fourth the length of "rstTransforms" and "rects".');
|
||||
|
||||
final List<Float32List>? colorBuffer = colors == null ? null : encodeRawColorList(colors);
|
||||
|
||||
_drawAtlas(paint, atlas, rstTransforms, rects, colorBuffer, blendMode ?? ui.BlendMode.src);
|
||||
_drawAtlas(paint, atlas, rstTransforms, rects,
|
||||
colors?.buffer.asUint32List(), blendMode ?? ui.BlendMode.src);
|
||||
}
|
||||
|
||||
// TODO(hterkelsen): Pass a cull_rect once CanvasKit supports that.
|
||||
@@ -417,7 +416,7 @@ class CanvasKitCanvas implements ui.Canvas {
|
||||
ui.Image atlas,
|
||||
Float32List rstTransforms,
|
||||
Float32List rects,
|
||||
List<Float32List>? colors,
|
||||
Uint32List? colors,
|
||||
ui.BlendMode blendMode,
|
||||
) {
|
||||
_canvas.drawAtlasRaw(
|
||||
|
||||
@@ -46,12 +46,10 @@ Future<ui.Codec> skiaInstantiateWebImageCodec(
|
||||
}
|
||||
|
||||
request.onError.listen((html.ProgressEvent event) {
|
||||
completer.completeError(ImageCodecException(
|
||||
'$_kNetworkImageMessage\n'
|
||||
'Image URL: $url\n'
|
||||
'Trying to load an image from another domain? Find answers at:\n'
|
||||
'https://flutter.dev/docs/development/platform-integration/web-images'
|
||||
));
|
||||
completer.completeError(ImageCodecException('$_kNetworkImageMessage\n'
|
||||
'Image URL: $url\n'
|
||||
'Trying to load an image from another domain? Find answers at:\n'
|
||||
'https://flutter.dev/docs/development/platform-integration/web-images'));
|
||||
});
|
||||
|
||||
request.onLoad.listen((html.ProgressEvent event) {
|
||||
@@ -63,10 +61,10 @@ Future<ui.Codec> skiaInstantiateWebImageCodec(
|
||||
final bool success = accepted || fileUri || notModified || unknownRedirect;
|
||||
|
||||
if (!success) {
|
||||
completer.completeError(ImageCodecException(
|
||||
'$_kNetworkImageMessage\n'
|
||||
'Image URL: $url\n'
|
||||
'Server response code: $status'),
|
||||
completer.completeError(
|
||||
ImageCodecException('$_kNetworkImageMessage\n'
|
||||
'Image URL: $url\n'
|
||||
'Server response code: $status'),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -88,7 +86,8 @@ Future<ui.Codec> skiaInstantiateWebImageCodec(
|
||||
/// The CanvasKit implementation of [ui.Codec].
|
||||
///
|
||||
/// Wraps `SkAnimatedImage`.
|
||||
class CkAnimatedImage extends ManagedSkiaObject<SkAnimatedImage> implements ui.Codec {
|
||||
class CkAnimatedImage extends ManagedSkiaObject<SkAnimatedImage>
|
||||
implements ui.Codec {
|
||||
/// Decodes an image from a list of encoded bytes.
|
||||
CkAnimatedImage.decodeFromBytes(this._bytes, this.src);
|
||||
|
||||
@@ -97,7 +96,8 @@ class CkAnimatedImage extends ManagedSkiaObject<SkAnimatedImage> implements ui.C
|
||||
|
||||
@override
|
||||
SkAnimatedImage createDefault() {
|
||||
final SkAnimatedImage? animatedImage = canvasKit.MakeAnimatedImageFromEncoded(_bytes);
|
||||
final SkAnimatedImage? animatedImage =
|
||||
canvasKit.MakeAnimatedImageFromEncoded(_bytes);
|
||||
if (animatedImage == null) {
|
||||
throw ImageCodecException(
|
||||
'Failed to decode image data.\n'
|
||||
@@ -183,13 +183,15 @@ class CkImage implements ui.Image, StackTraceDebugger {
|
||||
final int originalHeight = skImage.height();
|
||||
box = SkiaObjectBox<CkImage, SkImage>.resurrectable(this, skImage, () {
|
||||
return canvasKit.MakeImage(
|
||||
originalBytes.buffer.asUint8List(),
|
||||
originalWidth,
|
||||
originalHeight,
|
||||
canvasKit.AlphaType.Premul,
|
||||
canvasKit.ColorType.RGBA_8888,
|
||||
SkColorSpaceSRGB,
|
||||
);
|
||||
SkImageInfo(
|
||||
alphaType: canvasKit.AlphaType.Premul,
|
||||
colorType: canvasKit.ColorType.RGBA_8888,
|
||||
colorSpace: SkColorSpaceSRGB,
|
||||
width: originalWidth,
|
||||
height: originalHeight,
|
||||
),
|
||||
originalBytes.buffer.asUint8List(),
|
||||
4 * originalWidth);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -300,7 +302,7 @@ class CkImage implements ui.Image, StackTraceDebugger {
|
||||
width: skImage.width(),
|
||||
height: skImage.height(),
|
||||
);
|
||||
bytes = skImage.readPixels(imageInfo, 0, 0);
|
||||
bytes = skImage.readPixels(0, 0, imageInfo);
|
||||
} else {
|
||||
final SkData skData = skImage.encodeToData(); //defaults to PNG 100%
|
||||
// make a copy that we can return
|
||||
|
||||
@@ -11,8 +11,7 @@ part of engine;
|
||||
external String? get requestedRendererType;
|
||||
|
||||
/// Whether to use CanvasKit as the rendering backend.
|
||||
bool get useCanvasKit =>
|
||||
_autoDetect ? _detectRenderer() : _useSkia;
|
||||
bool get useCanvasKit => _autoDetect ? _detectRenderer() : _useSkia;
|
||||
|
||||
/// Returns true if CanvasKit is used.
|
||||
///
|
||||
@@ -42,8 +41,9 @@ const bool _useSkia =
|
||||
bool.fromEnvironment('FLUTTER_WEB_USE_SKIA', defaultValue: false);
|
||||
|
||||
// If set to true, forces CPU-only rendering (i.e. no WebGL).
|
||||
const bool canvasKitForceCpuOnly =
|
||||
bool.fromEnvironment('FLUTTER_WEB_CANVASKIT_FORCE_CPU_ONLY', defaultValue: false);
|
||||
const bool canvasKitForceCpuOnly = bool.fromEnvironment(
|
||||
'FLUTTER_WEB_CANVASKIT_FORCE_CPU_ONLY',
|
||||
defaultValue: false);
|
||||
|
||||
/// The URL to use when downloading the CanvasKit script and associated wasm.
|
||||
///
|
||||
@@ -52,7 +52,7 @@ const bool canvasKitForceCpuOnly =
|
||||
/// NPM, update this URL to `https://unpkg.com/canvaskit-wasm@0.34.0/bin/`.
|
||||
const String canvasKitBaseUrl = String.fromEnvironment(
|
||||
'FLUTTER_WEB_CANVASKIT_URL',
|
||||
defaultValue: 'https://unpkg.com/canvaskit-wasm@0.19.0/bin/',
|
||||
defaultValue: 'https://unpkg.com/canvaskit-wasm@0.22.0/bin/',
|
||||
);
|
||||
|
||||
/// Initialize CanvasKit.
|
||||
@@ -63,8 +63,10 @@ Future<void> initializeCanvasKit() {
|
||||
late StreamSubscription<html.Event> loadSubscription;
|
||||
loadSubscription = domRenderer.canvasKitScript!.onLoad.listen((_) {
|
||||
loadSubscription.cancel();
|
||||
final CanvasKitInitPromise canvasKitInitPromise = CanvasKitInit(CanvasKitInitOptions(
|
||||
locateFile: js.allowInterop((String file, String unusedBase) => canvasKitBaseUrl + file),
|
||||
final CanvasKitInitPromise canvasKitInitPromise =
|
||||
CanvasKitInit(CanvasKitInitOptions(
|
||||
locateFile: js.allowInterop(
|
||||
(String file, String unusedBase) => canvasKitBaseUrl + file),
|
||||
));
|
||||
canvasKitInitPromise.then(js.allowInterop((CanvasKit ck) {
|
||||
canvasKit = ck;
|
||||
|
||||
@@ -265,7 +265,7 @@ class CkPath extends ManagedSkiaObject<SkPath> implements ui.Path {
|
||||
) {
|
||||
final CkPath path1 = uiPath1 as CkPath;
|
||||
final CkPath path2 = uiPath2 as CkPath;
|
||||
final SkPath newPath = canvasKit.MakePathFromOp(
|
||||
final SkPath newPath = canvasKit.Path.MakeFromOp(
|
||||
path1.skiaObject,
|
||||
path2.skiaObject,
|
||||
toSkPathOp(operation),
|
||||
@@ -320,7 +320,7 @@ class CkPath extends ManagedSkiaObject<SkPath> implements ui.Path {
|
||||
|
||||
@override
|
||||
SkPath resurrect() {
|
||||
final SkPath path = canvasKit.MakePathFromCmds(_cachedCommands!);
|
||||
final SkPath path = canvasKit.Path.MakeFromCmds(_cachedCommands!);
|
||||
path.setFillType(toSkFillType(_fillType));
|
||||
return path;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,8 @@
|
||||
// @dart = 2.12
|
||||
part of engine;
|
||||
|
||||
abstract class CkShader extends ManagedSkiaObject<SkShader> implements ui.Shader {
|
||||
abstract class CkShader extends ManagedSkiaObject<SkShader>
|
||||
implements ui.Shader {
|
||||
@override
|
||||
void delete() {
|
||||
rawSkiaObject?.delete();
|
||||
@@ -39,7 +40,7 @@ class CkGradientSweep extends CkShader implements ui.Gradient {
|
||||
return canvasKit.Shader.MakeSweepGradient(
|
||||
center.dx,
|
||||
center.dy,
|
||||
toSkFloatColorList(colors),
|
||||
toFlatColors(colors),
|
||||
toSkColorStops(colorStops),
|
||||
toSkTileMode(tileMode),
|
||||
matrix4 != null ? toSkMatrixFromFloat32(matrix4!) : null,
|
||||
@@ -87,7 +88,7 @@ class CkGradientLinear extends CkShader implements ui.Gradient {
|
||||
return canvasKit.Shader.MakeLinearGradient(
|
||||
toSkPoint(from),
|
||||
toSkPoint(to),
|
||||
toSkFloatColorList(colors),
|
||||
toFlatColors(colors),
|
||||
toSkColorStops(colorStops),
|
||||
toSkTileMode(tileMode),
|
||||
);
|
||||
@@ -115,7 +116,7 @@ class CkGradientRadial extends CkShader implements ui.Gradient {
|
||||
return canvasKit.Shader.MakeRadialGradient(
|
||||
toSkPoint(center),
|
||||
radius,
|
||||
toSkFloatColorList(colors),
|
||||
toFlatColors(colors),
|
||||
toSkColorStops(colorStops),
|
||||
toSkTileMode(tileMode),
|
||||
matrix4 != null ? toSkMatrixFromFloat32(matrix4!) : null,
|
||||
@@ -148,7 +149,7 @@ class CkGradientConical extends CkShader implements ui.Gradient {
|
||||
focalRadius,
|
||||
toSkPoint(center),
|
||||
radius,
|
||||
toSkFloatColorList(colors),
|
||||
toFlatColors(colors),
|
||||
toSkColorStops(colorStops),
|
||||
toSkTileMode(tileMode),
|
||||
matrix4 != null ? toSkMatrixFromFloat32(matrix4!) : null,
|
||||
@@ -161,8 +162,7 @@ class CkGradientConical extends CkShader implements ui.Gradient {
|
||||
}
|
||||
|
||||
class CkImageShader extends CkShader implements ui.ImageShader {
|
||||
CkImageShader(
|
||||
ui.Image image, this.tileModeX, this.tileModeY, this.matrix4)
|
||||
CkImageShader(ui.Image image, this.tileModeX, this.tileModeY, this.matrix4)
|
||||
: _image = image as CkImage;
|
||||
|
||||
final ui.TileMode tileModeX;
|
||||
@@ -171,11 +171,13 @@ class CkImageShader extends CkShader implements ui.ImageShader {
|
||||
final CkImage _image;
|
||||
|
||||
@override
|
||||
SkShader createDefault() => _image.skImage.makeShader(
|
||||
toSkTileMode(tileModeX),
|
||||
toSkTileMode(tileModeY),
|
||||
toSkMatrixFromFloat64(matrix4),
|
||||
);
|
||||
SkShader createDefault() => _image.skImage.makeShaderOptions(
|
||||
toSkTileMode(tileModeX),
|
||||
toSkTileMode(tileModeY),
|
||||
canvasKit.FilterMode.Nearest,
|
||||
canvasKit.MipmapMode.None,
|
||||
toSkMatrixFromFloat64(matrix4),
|
||||
);
|
||||
|
||||
@override
|
||||
SkShader resurrect() => createDefault();
|
||||
|
||||
@@ -28,9 +28,9 @@ class CkVertices extends ManagedSkiaObject<SkVertices> implements ui.Vertices {
|
||||
|
||||
return CkVertices._(
|
||||
toSkVertexMode(mode),
|
||||
toSkPoints2d(positions),
|
||||
textureCoordinates != null ? toSkPoints2d(textureCoordinates) : null,
|
||||
colors != null ? toSkFloatColorList(colors) : null,
|
||||
toFlatSkPoints(positions),
|
||||
textureCoordinates != null ? toFlatSkPoints(textureCoordinates) : null,
|
||||
colors != null ? toFlatColors(colors) : null,
|
||||
indices != null ? toUint16List(indices) : null,
|
||||
);
|
||||
}
|
||||
@@ -57,9 +57,9 @@ class CkVertices extends ManagedSkiaObject<SkVertices> implements ui.Vertices {
|
||||
|
||||
return CkVertices._(
|
||||
toSkVertexMode(mode),
|
||||
rawPointsToSkPoints2d(positions),
|
||||
textureCoordinates != null ? rawPointsToSkPoints2d(textureCoordinates) : null,
|
||||
colors != null ? encodeRawColorList(colors) : null,
|
||||
positions,
|
||||
textureCoordinates,
|
||||
colors?.buffer.asUint32List(),
|
||||
indices,
|
||||
);
|
||||
}
|
||||
@@ -73,9 +73,9 @@ class CkVertices extends ManagedSkiaObject<SkVertices> implements ui.Vertices {
|
||||
);
|
||||
|
||||
final SkVertexMode _mode;
|
||||
final List<Float32List> _positions;
|
||||
final List<Float32List>? _textureCoordinates;
|
||||
final List<Float32List>? _colors;
|
||||
final Float32List _positions;
|
||||
final Float32List? _textureCoordinates;
|
||||
final Uint32List? _colors;
|
||||
final Uint16List? _indices;
|
||||
|
||||
@override
|
||||
|
||||
@@ -22,8 +22,10 @@ void main() {
|
||||
|
||||
const ui.Rect region = const ui.Rect.fromLTRB(0, 0, 500, 250);
|
||||
|
||||
Future<void> matchPictureGolden(String goldenFile, CkPicture picture, { bool write = false }) async {
|
||||
final EnginePlatformDispatcher dispatcher = ui.window.platformDispatcher as EnginePlatformDispatcher;
|
||||
Future<void> matchPictureGolden(String goldenFile, CkPicture picture,
|
||||
{bool write = false}) async {
|
||||
final EnginePlatformDispatcher dispatcher =
|
||||
ui.window.platformDispatcher as EnginePlatformDispatcher;
|
||||
final LayerSceneBuilder sb = LayerSceneBuilder();
|
||||
sb.pushOffset(0, 0);
|
||||
sb.addPicture(ui.Offset.zero, picture);
|
||||
@@ -35,18 +37,21 @@ void testMain() {
|
||||
group('CkCanvas', () {
|
||||
setUpCanvasKitTest();
|
||||
|
||||
test('renders using non-recording canvas if weak refs are supported', () async {
|
||||
test('renders using non-recording canvas if weak refs are supported',
|
||||
() async {
|
||||
expect(browserSupportsFinalizationRegistry, isTrue,
|
||||
reason: 'This test specifically tests non-recording canvas, which '
|
||||
'only works if FinalizationRegistry is available.');
|
||||
'only works if FinalizationRegistry is available.');
|
||||
final CkPictureRecorder recorder = CkPictureRecorder();
|
||||
final CkCanvas canvas = recorder.beginRecording(region);
|
||||
expect(canvas.runtimeType, CkCanvas);
|
||||
drawTestPicture(canvas);
|
||||
await matchPictureGolden('canvaskit_picture_original.png', recorder.endRecording());
|
||||
await matchPictureGolden(
|
||||
'canvaskit_picture_original.png', recorder.endRecording());
|
||||
});
|
||||
|
||||
test('renders using a recording canvas if weak refs are not supported', () async {
|
||||
test('renders using a recording canvas if weak refs are not supported',
|
||||
() async {
|
||||
browserSupportsFinalizationRegistry = false;
|
||||
final CkPictureRecorder recorder = CkPictureRecorder();
|
||||
final CkCanvas canvas = recorder.beginRecording(region);
|
||||
@@ -54,23 +59,31 @@ void testMain() {
|
||||
drawTestPicture(canvas);
|
||||
|
||||
final CkPicture originalPicture = recorder.endRecording();
|
||||
await matchPictureGolden('canvaskit_picture_original.png', originalPicture);
|
||||
await matchPictureGolden(
|
||||
'canvaskit_picture_original.png', originalPicture);
|
||||
|
||||
final ByteData originalPixels = await (await originalPicture.toImage(50, 50)).toByteData() as ByteData;
|
||||
final ByteData originalPixels =
|
||||
await (await originalPicture.toImage(50, 50)).toByteData()
|
||||
as ByteData;
|
||||
|
||||
// Test that a picture restored from a snapshot looks the same.
|
||||
final CkPictureSnapshot? snapshot = canvas.pictureSnapshot;
|
||||
expect(snapshot, isNotNull);
|
||||
final SkPicture restoredSkPicture = snapshot!.toPicture();
|
||||
expect(restoredSkPicture, isNotNull);
|
||||
final CkPicture restoredPicture = CkPicture(restoredSkPicture, ui.Rect.fromLTRB(0, 0, 50, 50), snapshot);
|
||||
final ByteData restoredPixels = await (await restoredPicture.toImage(50, 50)).toByteData() as ByteData;
|
||||
final CkPicture restoredPicture = CkPicture(
|
||||
restoredSkPicture, ui.Rect.fromLTRB(0, 0, 50, 50), snapshot);
|
||||
final ByteData restoredPixels =
|
||||
await (await restoredPicture.toImage(50, 50)).toByteData()
|
||||
as ByteData;
|
||||
|
||||
await matchPictureGolden('canvaskit_picture_restored.png', restoredPicture);
|
||||
expect(restoredPixels.buffer.asUint8List(), originalPixels.buffer.asUint8List());
|
||||
await matchPictureGolden(
|
||||
'canvaskit_picture_restored.png', restoredPicture);
|
||||
expect(restoredPixels.buffer.asUint8List(),
|
||||
originalPixels.buffer.asUint8List());
|
||||
});
|
||||
// TODO: https://github.com/flutter/flutter/issues/60040
|
||||
// TODO: https://github.com/flutter/flutter/issues/71520
|
||||
// TODO: https://github.com/flutter/flutter/issues/60040
|
||||
// TODO: https://github.com/flutter/flutter/issues/71520
|
||||
}, skip: isIosSafari || isFirefox);
|
||||
}
|
||||
|
||||
@@ -149,7 +162,7 @@ void drawTestPicture(CkCanvas canvas) {
|
||||
..[1] = 0
|
||||
..[2] = 15
|
||||
..[3] = 15,
|
||||
[Float32List(4)],
|
||||
Uint32List.fromList(<int>[0x00000000]),
|
||||
ui.BlendMode.srcOver,
|
||||
);
|
||||
|
||||
@@ -242,8 +255,7 @@ void drawTestPicture(CkCanvas canvas) {
|
||||
|
||||
canvas.translate(60, 0);
|
||||
canvas.drawShadow(
|
||||
CkPath()
|
||||
..addRect(ui.Rect.fromLTRB(0, 0, 40, 30)),
|
||||
CkPath()..addRect(ui.Rect.fromLTRB(0, 0, 40, 30)),
|
||||
ui.Color(0xFF00FF00),
|
||||
4,
|
||||
true,
|
||||
@@ -283,7 +295,8 @@ void drawTestPicture(CkCanvas canvas) {
|
||||
canvas.save();
|
||||
canvas.rotate(-math.pi / 8);
|
||||
canvas.drawLine(ui.Offset.zero, ui.Offset(30, 30), CkPaint());
|
||||
canvas.drawCircle(ui.Offset(30, 30), 7, CkPaint()..color = ui.Color(0xFF00AA00));
|
||||
canvas.drawCircle(
|
||||
ui.Offset(30, 30), 7, CkPaint()..color = ui.Color(0xFF00AA00));
|
||||
canvas.restore();
|
||||
|
||||
canvas.translate(60, 0);
|
||||
@@ -309,7 +322,8 @@ void drawTestPicture(CkCanvas canvas) {
|
||||
canvas.saveLayer(region, CkPaint());
|
||||
canvas.drawCircle(ui.Offset(30, 30), 10, CkPaint());
|
||||
{
|
||||
canvas.saveLayerWithFilter(region, ui.ImageFilter.blur(sigmaX: 5, sigmaY: 10));
|
||||
canvas.saveLayerWithFilter(
|
||||
region, ui.ImageFilter.blur(sigmaX: 5, sigmaY: 10));
|
||||
canvas.drawCircle(ui.Offset(10, 10), 10, CkPaint());
|
||||
canvas.drawCircle(ui.Offset(50, 50), 10, CkPaint());
|
||||
canvas.restore();
|
||||
@@ -389,14 +403,17 @@ CkImage generateTestImage() {
|
||||
ctx.fillRect(10, 0, 10, 10);
|
||||
ctx.fillStyle = '#FF00FF';
|
||||
ctx.fillRect(10, 10, 10, 10);
|
||||
final Uint8List imageData = ctx.getImageData(0, 0, 20, 20).data.buffer.asUint8List();
|
||||
final Uint8List imageData =
|
||||
ctx.getImageData(0, 0, 20, 20).data.buffer.asUint8List();
|
||||
final SkImage skImage = canvasKit.MakeImage(
|
||||
imageData,
|
||||
20,
|
||||
20,
|
||||
canvasKit.AlphaType.Premul,
|
||||
canvasKit.ColorType.RGBA_8888,
|
||||
SkColorSpaceSRGB,
|
||||
);
|
||||
SkImageInfo(
|
||||
width: 20,
|
||||
height: 20,
|
||||
alphaType: canvasKit.AlphaType.Premul,
|
||||
colorType: canvasKit.ColorType.RGBA_8888,
|
||||
colorSpace: SkColorSpaceSRGB,
|
||||
),
|
||||
imageData,
|
||||
4 * 20);
|
||||
return CkImage(skImage);
|
||||
}
|
||||
|
||||
@@ -296,9 +296,11 @@ void _imageTests() {
|
||||
|
||||
expect(nonAnimated.decodeNextFrame(), -1);
|
||||
expect(
|
||||
frame.makeShader(
|
||||
frame.makeShaderOptions(
|
||||
canvasKit.TileMode.Repeat,
|
||||
canvasKit.TileMode.Mirror,
|
||||
canvasKit.FilterMode.Linear,
|
||||
canvasKit.MipmapMode.Nearest,
|
||||
toSkMatrixFromFloat32(Matrix4.identity().storage),
|
||||
),
|
||||
isNotNull,
|
||||
@@ -331,10 +333,7 @@ void _shaderTests() {
|
||||
canvasKit.Shader.MakeRadialGradient(
|
||||
Float32List.fromList([1, 1]),
|
||||
10.0,
|
||||
<Float32List>[
|
||||
Float32List.fromList([0, 0, 0, 1]),
|
||||
Float32List.fromList([1, 1, 1, 1]),
|
||||
],
|
||||
Uint32List.fromList(<int>[0xff000000, 0xffffffff]),
|
||||
Float32List.fromList([0, 1]),
|
||||
canvasKit.TileMode.Repeat,
|
||||
toSkMatrixFromFloat32(Matrix4.identity().storage),
|
||||
@@ -350,10 +349,7 @@ void _shaderTests() {
|
||||
10.0,
|
||||
Float32List.fromList([1, 1]),
|
||||
10.0,
|
||||
<Float32List>[
|
||||
Float32List.fromList([0, 0, 0, 1]),
|
||||
Float32List.fromList([1, 1, 1, 1]),
|
||||
],
|
||||
Uint32List.fromList(<int>[0xff000000, 0xffffffff]),
|
||||
Float32List.fromList([0, 1]),
|
||||
canvasKit.TileMode.Repeat,
|
||||
toSkMatrixFromFloat32(Matrix4.identity().storage),
|
||||
@@ -367,9 +363,7 @@ SkShader _makeTestShader() {
|
||||
return canvasKit.Shader.MakeLinearGradient(
|
||||
Float32List.fromList([0, 0]),
|
||||
Float32List.fromList([1, 1]),
|
||||
[
|
||||
Float32List.fromList([255, 0, 0, 255]),
|
||||
],
|
||||
Uint32List.fromList(<int>[0xff0000ff]),
|
||||
Float32List.fromList([0, 1]),
|
||||
canvasKit.TileMode.Repeat,
|
||||
);
|
||||
@@ -836,7 +830,7 @@ void _pathTests() {
|
||||
expect(measure2, isNull);
|
||||
});
|
||||
|
||||
test('SkPath.toCmds and CanvasKit.MakePathFromCmds', () {
|
||||
test('SkPath.toCmds and CanvasKit.Path.MakeFromCmds', () {
|
||||
const ui.Rect rect = ui.Rect.fromLTRB(0, 0, 10, 10);
|
||||
final SkPath path = SkPath();
|
||||
path.addRect(toSkRect(rect));
|
||||
@@ -848,7 +842,7 @@ void _pathTests() {
|
||||
<num>[5], // close
|
||||
]);
|
||||
|
||||
final SkPath copy = canvasKit.MakePathFromCmds(path.toCmds());
|
||||
final SkPath copy = canvasKit.Path.MakeFromCmds(path.toCmds());
|
||||
expect(fromSkRect(copy.getBounds()), rect);
|
||||
});
|
||||
}
|
||||
@@ -856,21 +850,9 @@ void _pathTests() {
|
||||
SkVertices _testVertices() {
|
||||
return canvasKit.MakeVertices(
|
||||
canvasKit.VertexMode.Triangles,
|
||||
[
|
||||
Float32List.fromList([0, 0]),
|
||||
Float32List.fromList([10, 10]),
|
||||
Float32List.fromList([0, 20]),
|
||||
],
|
||||
[
|
||||
Float32List.fromList([0, 0]),
|
||||
Float32List.fromList([10, 10]),
|
||||
Float32List.fromList([0, 20]),
|
||||
],
|
||||
[
|
||||
Float32List.fromList([255, 0, 0, 255]),
|
||||
Float32List.fromList([0, 255, 0, 255]),
|
||||
Float32List.fromList([0, 0, 255, 255]),
|
||||
],
|
||||
Float32List.fromList([0, 0, 10, 10, 0, 20]),
|
||||
Float32List.fromList([0, 0, 10, 10, 0, 20]),
|
||||
Uint32List.fromList([0xffff0000, 0xff00ff00, 0xff0000ff]),
|
||||
Uint16List.fromList([0, 1, 2]),
|
||||
);
|
||||
}
|
||||
@@ -976,10 +958,7 @@ void _canvasTests() {
|
||||
Float32List.fromList([1, 0, 2, 3]),
|
||||
SkPaint(),
|
||||
canvasKit.BlendMode.SrcOver,
|
||||
[
|
||||
Float32List.fromList([0, 0, 0, 1]),
|
||||
Float32List.fromList([1, 1, 1, 1]),
|
||||
],
|
||||
Uint32List.fromList(<int>[0xff000000, 0xffffffff]),
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user