@@ -64,9 +64,16 @@ Phaser.BitmapData = function (game, key, width, height) {
6464 this . imageData = this . context . getImageData ( 0 , 0 , width , height ) ;
6565
6666 /**
67- * @property {Uint8ClampedArray } data - A Uint8ClampedArray view into BitmapData.buffer.
67+ * A Uint8ClampedArray view into BitmapData.buffer.
68+ * Note that this is unavailable in some browsers (such as Epic Browser due to its security restrictions)
69+ * @property {Uint8ClampedArray } data
6870 */
69- this . data = this . imageData . data ;
71+ this . data = null ;
72+
73+ if ( this . imageData )
74+ {
75+ this . data = this . imageData . data ;
76+ }
7077
7178 /**
7279 * @property {Uint32Array } pixels - An Uint32Array view into BitmapData.buffer.
@@ -76,21 +83,24 @@ Phaser.BitmapData = function (game, key, width, height) {
7683 /**
7784 * @property {ArrayBuffer } buffer - An ArrayBuffer the same size as the context ImageData.
7885 */
79- if ( this . imageData . data . buffer )
86+ if ( this . data )
8087 {
81- this . buffer = this . imageData . data . buffer ;
82- this . pixels = new Uint32Array ( this . buffer ) ;
83- }
84- else
85- {
86- if ( window [ 'ArrayBuffer' ] )
88+ if ( this . imageData . data . buffer )
8789 {
88- this . buffer = new ArrayBuffer ( this . imageData . data . length ) ;
90+ this . buffer = this . imageData . data . buffer ;
8991 this . pixels = new Uint32Array ( this . buffer ) ;
9092 }
9193 else
9294 {
93- this . pixels = this . imageData . data ;
95+ if ( window [ 'ArrayBuffer' ] )
96+ {
97+ this . buffer = new ArrayBuffer ( this . imageData . data . length ) ;
98+ this . pixels = new Uint32Array ( this . buffer ) ;
99+ }
100+ else
101+ {
102+ this . pixels = this . imageData . data ;
103+ }
94104 }
95105 }
96106
0 commit comments