Skip to content

Commit e551254

Browse files
committed
Merge pull request phaserjs#2209 from FracturedShader/patch-1
Update BitmapData.setHSL to accept 0
2 parents f80e596 + 8f1450e commit e551254

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

src/gameobjects/BitmapData.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -784,12 +784,12 @@ Phaser.BitmapData.prototype = {
784784
* @return {Phaser.BitmapData} This BitmapData object for method chaining.
785785
*/
786786
setHSL: function (h, s, l, region) {
787+
788+
var bHaveH = h || h === 0;
789+
var bHaveS = s || s === 0;
790+
var bHaveL = l || l === 0;
787791

788-
if (h === undefined || h === null) { h = false; }
789-
if (s === undefined || s === null) { s = false; }
790-
if (l === undefined || l === null) { l = false; }
791-
792-
if (!h && !s && !l)
792+
if (!bHaveH && !bHaveS && !bHaveL)
793793
{
794794
return;
795795
}
@@ -807,17 +807,17 @@ Phaser.BitmapData.prototype = {
807807
{
808808
Phaser.Color.unpackPixel(this.getPixel32(x, y), pixel, true);
809809

810-
if (h)
810+
if (bHaveH)
811811
{
812812
pixel.h = h;
813813
}
814814

815-
if (s)
815+
if (bHaveS)
816816
{
817817
pixel.s = s;
818818
}
819819

820-
if (l)
820+
if (bHaveL)
821821
{
822822
pixel.l = l;
823823
}

0 commit comments

Comments
 (0)