Skip to content

Commit 83c3a61

Browse files
authored
Only emit image painting events in debug & profile modes. (#118872)
* Only emit image painting events in debug & profile modes. These events were being emitted in release mode, which was showing up in the profiler for my app as taking up a noticeable amount of build time (still well within the frame budget, but this code was near the top of the list). * Review comment
1 parent 426cdd9 commit 83c3a61

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/flutter/lib/src/painting/decoration_image.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ void paintImage({
599599
return true;
600600
}());
601601
// Avoid emitting events that are the same as those emitted in the last frame.
602-
if (!_lastFrameImageSizeInfo.contains(sizeInfo)) {
602+
if (!kReleaseMode && !_lastFrameImageSizeInfo.contains(sizeInfo)) {
603603
final ImageSizeInfo? existingSizeInfo = _pendingImageSizeInfo[sizeInfo.source];
604604
if (existingSizeInfo == null || existingSizeInfo.displaySizeInBytes < sizeInfo.displaySizeInBytes) {
605605
_pendingImageSizeInfo[sizeInfo.source!] = sizeInfo;

0 commit comments

Comments
 (0)