Add comment to RenderColoredBox.paint() (#72526)

This commit is contained in:
Todd Volkert 2020-12-24 21:42:25 -08:00 committed by GitHub
parent 19a835498e
commit d61d7758ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7683,6 +7683,10 @@ class _RenderColoredBox extends RenderProxyBoxWithHitTestBehavior {
@override
void paint(PaintingContext context, Offset offset) {
// It's tempting to want to optimize out this `drawRect()` call if the
// color is transparent (alpha==0), but doing so would be incorrect. See
// https://github.com/flutter/flutter/pull/72526#issuecomment-749185938 for
// a good description of why.
if (size > Size.zero) {
context.canvas.drawRect(offset & size, Paint()..color = color);
}