Skip to content

Commit b14aff5

Browse files
committed
Return type of Phaser.Color.packPixel changed
1 parent a0a7c02 commit b14aff5

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

src/utils/Color.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,31 @@ Phaser.Color = {
2222
* @param {number} g - The green color component, in the range 0 - 255.
2323
* @param {number} b - The blue color component, in the range 0 - 255.
2424
* @param {number} a - The alpha color component, in the range 0 - 255.
25-
* @return {number} The packed color
25+
* @return {number} The packed color as uint32
2626
*/
2727
packPixel: function (r, g, b, a) {
2828

2929
if (Phaser.Device.LITTLE_ENDIAN)
3030
{
31-
return (a << 24) | (b << 16) | (g << 8) | r;
31+
return ( (a << 24) | (b << 16) | (g << 8) | r ) >>> 0;
3232
}
3333
else
3434
{
35-
return (r << 24) | (g << 16) | (b << 8) | a;
35+
return ( (r << 24) | (g << 16) | (b << 8) | a ) >>> 0;
3636
}
3737

3838
},
3939

4040
/**
4141
* Unpacks the r, g, b, a components into the specified color object, or a new
42-
* object, for use with Int32Array. If little endian, then ABGR order is used when
42+
* object, for use with Int32Array. If little endian, then ABGR order is used when
4343
* unpacking, otherwise, RGBA order is used. The resulting color object has the
4444
* `r, g, b, a` properties which are unrelated to endianness.
4545
*
4646
* Note that the integer is assumed to be packed in the correct endianness. On little-endian
4747
* the format is 0xAABBGGRR and on big-endian the format is 0xRRGGBBAA. If you want a
4848
* endian-independent method, use fromRGBA(rgba) and toRGBA(r, g, b, a).
49-
*
49+
*
5050
* @author Matt DesLauriers (@mattdesl)
5151
* @method Phaser.Color.unpackPixel
5252
* @static
@@ -76,7 +76,7 @@ Phaser.Color = {
7676
out.b = ((rgba & 0x0000ff00) >>> 8);
7777
out.a = ((rgba & 0x000000ff));
7878
}
79-
79+
8080
out.color = rgba;
8181
out.rgba = 'rgba(' + out.r + ',' + out.g + ',' + out.b + ',' + (out.a / 255) + ')';
8282

@@ -673,7 +673,7 @@ Phaser.Color = {
673673

674674
/**
675675
* Interpolates the two given colours based on the supplied step and currentStep properties.
676-
*
676+
*
677677
* @method Phaser.Color.interpolateColorWithRGB
678678
* @static
679679
* @param {number} color - The first color value.

0 commit comments

Comments
 (0)