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
This commit is contained in:
Todd Volkert 2023-01-24 19:19:47 -08:00 committed by GitHub
parent 426cdd90cd
commit 83c3a61e3f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -599,7 +599,7 @@ void paintImage({
return true;
}());
// Avoid emitting events that are the same as those emitted in the last frame.
if (!_lastFrameImageSizeInfo.contains(sizeInfo)) {
if (!kReleaseMode && !_lastFrameImageSizeInfo.contains(sizeInfo)) {
final ImageSizeInfo? existingSizeInfo = _pendingImageSizeInfo[sizeInfo.source];
if (existingSizeInfo == null || existingSizeInfo.displaySizeInBytes < sizeInfo.displaySizeInBytes) {
_pendingImageSizeInfo[sizeInfo.source!] = sizeInfo;