forked from flutter/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix off-by-one fromRGBO alpha value calculation (flutter#13777)
Constructing colors using `fromRGBO` should return the same values as the CSS `rgba()` notation. rgba(0, 0, 255, 0.5) is the same as `#0000ff80` However `fromRGBO` sometimes creates a color with an off-by-one alpha value: expect(Color.fromRGBO(0, 0, 255, 0.5), Color(0x800000ff)); Expected: Color:<Color(0x800000ff)> Actual: Color:<Color(0x7f0000ff)> If we use `withOpacity` to create the same color, it returns the correct color: expect(Color.fromRGBO(0, 0, 255, 1).withOpacity(0.5), Color(0x800000ff)); This should also be changed in lib/web_ui/lib/src/ui/painting.dart in a followup change.
- Loading branch information
Showing
2 changed files
with
11 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters