Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/web_ui/lib/src/engine/compositor/vertices.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
part of engine;

js.JsArray<Float32List> _encodeRawColorList(Int32List rawColors) {
if (rawColors == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be rebased? The type should be Int32List?, no?

return null;
}
final int colorCount = rawColors.length;
final List<ui.Color> colors = List<ui.Color>(colorCount);
for (int i = 0; i < colorCount; ++i) {
Expand Down Expand Up @@ -36,7 +39,8 @@ class SkVertices implements ui.Vertices {
throw ArgumentError(
'"indices" values must be valid indices in the positions list.');

final js.JsArray<js.JsArray<double>> encodedPositions = encodePointList(positions);
final js.JsArray<js.JsArray<double>> encodedPositions =
encodePointList(positions);
final js.JsArray<js.JsArray<double>> encodedTextures =
encodePointList(textureCoordinates);
final js.JsArray<Float32List> encodedColors =
Expand Down
32 changes: 32 additions & 0 deletions lib/web_ui/test/canvaskit/vertices_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// @dart = 2.6
import 'dart:typed_data';

import 'package:test/test.dart';

import 'package:ui/src/engine.dart';
import 'package:ui/ui.dart' as ui;

void main() {
group(
'SkVertices',
() {
setUpAll(() async {
await ui.webOnlyInitializePlatform();
});

test('Using CanvasKit', () {
expect(experimentalUseSkia, true);
});

test('Can create SkVertices.raw with null colors', () {
SkVertices vertices =
SkVertices.raw(ui.VertexMode.triangles, Float32List.fromList([]));
expect(vertices, isNotNull);
});
},
);
}