mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
internal/affine: create a fast path for ChangeHSV
When hue = 0 and saturation = 1, this should be the same as scaling. Closes #2170
This commit is contained in:
parent
a9c9e18ff4
commit
8cdfa4f66c
@ -761,6 +761,11 @@ var (
|
||||
//
|
||||
// This conversion uses RGB to/from YCrCb conversion.
|
||||
func ChangeHSV(c ColorM, hueTheta float64, saturationScale float32, valueScale float32) ColorM {
|
||||
if hueTheta == 0 && saturationScale == 1 {
|
||||
v := valueScale
|
||||
return c.Scale(v, v, v, 1)
|
||||
}
|
||||
|
||||
sin, cos := math.Sincos(hueTheta)
|
||||
s32, c32 := float32(sin), float32(cos)
|
||||
c = c.Concat(rgbToYCbCr)
|
||||
|
Loading…
Reference in New Issue
Block a user