Source
void drawAtlas(Image atlas,
List<RSTransform> transforms,
List<Rect> rects,
List<Color> colors,
TransferMode transferMode,
Rect cullRect,
Paint paint) {
final int rectCount = rects.length;
if (transforms.length != rectCount)
throw new ArgumentError("[transforms] and [rects] lengths must match");
if (colors.isNotEmpty && colors.length != rectCount)
throw new ArgumentError("if supplied, [colors] length must match that of [transforms] and [rects]");
final Float32List rstTransformBuffer = new Float32List(rectCount * 4);
final Float32List rectBuffer = new Float32List(rectCount * 4);
for (int i = 0; i < rectCount; ++i) {
final int index0 = i * 4;
final int index1 = index0 + 1;
final int index2 = index0 + 2;
final int index3 = index0 + 3;
final RSTransform rstTransform = transforms[i];
final Rect rect = rects[i];
rstTransformBuffer[index0] = rstTransform.scos;
rstTransformBuffer[index1] = rstTransform.ssin;
rstTransformBuffer[index2] = rstTransform.tx;
rstTransformBuffer[index3] = rstTransform.ty;
rectBuffer[index0] = rect.left;
rectBuffer[index1] = rect.top;
rectBuffer[index2] = rect.right;
rectBuffer[index3] = rect.bottom;
}
final Int32List colorBuffer = colors.isEmpty ? null : _encodeColorList(colors);
final Float32List cullRectBuffer = cullRect?._value;
_drawAtlas(
paint._objects, paint._data, atlas, rstTransformBuffer, rectBuffer,
colorBuffer, transferMode.index, cullRectBuffer
);
}