-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Open
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performance
Milestone
Description
If alpha is equal to 0xffff, return r,b,g,a.
If alpha is equal to 0, return 0,0,0,0.
Else, multiply by alpha, divide by 0xffff, return r,g,b,a.
New code:
func (c NRGBA) RGBA() (r, g, b, a uint32) {
a = uint32(c.A)
a |= a << 8
if a == 0 {
return 0, 0, 0, 0
}
r = uint32(c.R)
r |= r << 8
g = uint32(c.G)
g |= g << 8
b = uint32(c.B)
b |= b << 8
if a == 0xffff {
return
}
r = r * a / 0xffff
g = g * a / 0xffff
b = b * a / 0xffff
return
}
func (c NRGBA64) RGBA() (r, g, b, a uint32) {
a = uint32(c.A)
if a == 0 {
return 0, 0, 0, 0
}
r = uint32(c.R)
g = uint32(c.G)
b = uint32(c.B)
if a == 0xffff {
return
}
r = r * a / 0xffff
g = g * a / 0xffff
b = b * a / 0xffff
return
}Metadata
Metadata
Assignees
Labels
NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.Performance