Skip to content

Commit

Permalink
Removed fallback on web for drawAtlas
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfenrain authored and luanpotter committed Dec 2, 2021
1 parent aec2607 commit 202397a
Showing 1 changed file with 9 additions and 29 deletions.
38 changes: 9 additions & 29 deletions packages/flame/lib/src/sprite_batch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -260,34 +260,14 @@ class SpriteBatch {
Rect? cullRect,
Paint? paint,
}) {
paint ??= Paint();

if (kIsWeb) {
for (final batchItem in _batchItems) {
paint.blendMode = blendMode ?? paint.blendMode;

canvas
..save()
..transform(batchItem.matrix.storage)
..drawRect(batchItem.destination, batchItem.paint)
..drawImageRect(
atlas,
batchItem.source,
batchItem.destination,
paint,
)
..restore();
}
} else {
canvas.drawAtlas(
atlas,
_transforms,
_sources,
_colors,
blendMode ?? defaultBlendMode,
cullRect,
paint,
);
}
canvas.drawAtlas(
atlas,
_transforms,
_sources,
_colors,
blendMode ?? defaultBlendMode,
cullRect,
paint ?? Paint(),
);
}
}

0 comments on commit 202397a

Please sign in to comment.