Apply the buffer offset when converting a vertex color Int32List to a Uint32List (flutter/engine#40066)
Apply the buffer offset when converting a vertex color Int32List to a Uint32List
This commit is contained in:
@@ -389,8 +389,13 @@ class CanvasKitCanvas implements ui.Canvas {
|
||||
'If non-null, "colors" length must be one fourth the length of "rstTransforms" and "rects".');
|
||||
}
|
||||
|
||||
Uint32List? unsignedColors;
|
||||
if (colors != null) {
|
||||
unsignedColors = colors.buffer.asUint32List(colors.offsetInBytes, colors.length);
|
||||
}
|
||||
|
||||
_drawAtlas(paint, atlas, rstTransforms, rects,
|
||||
colors?.buffer.asUint32List(), blendMode ?? ui.BlendMode.src);
|
||||
unsignedColors, blendMode ?? ui.BlendMode.src);
|
||||
}
|
||||
|
||||
// TODO(hterkelsen): Pass a cull_rect once CanvasKit supports that.
|
||||
|
||||
@@ -62,11 +62,16 @@ class CkVertices extends ManagedSkiaObject<SkVertices> implements ui.Vertices {
|
||||
'"indices" values must be valid indices in the positions list.');
|
||||
}
|
||||
|
||||
Uint32List? unsignedColors;
|
||||
if (colors != null) {
|
||||
unsignedColors = colors.buffer.asUint32List(colors.offsetInBytes, colors.length);
|
||||
}
|
||||
|
||||
return CkVertices._(
|
||||
toSkVertexMode(mode),
|
||||
positions,
|
||||
textureCoordinates,
|
||||
colors?.buffer.asUint32List(),
|
||||
unsignedColors,
|
||||
indices,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user