Merge branch 'png-encoder'

This commit is contained in:
Bill 2021-07-30 20:35:46 -04:00
commit a62d16b2b1

View File

@ -1,5 +1,4 @@
import { RenderTexture } from 'pixi.js'; import { RenderTexture } from 'pixi.js';
import { Byte } from '../../../../../core';
import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer'; import { IMessageComposer } from '../../../../../core/communication/messages/IMessageComposer';
import { TextureUtils } from '../../../../../room'; import { TextureUtils } from '../../../../../room';
@ -29,12 +28,8 @@ export class RenderRoomMessageComposer implements IMessageComposer<ConstructorPa
if(!url) return; if(!url) return;
const base64Data = url.split(',')[1]; const base64Data = url.split(',')[1];
const binaryData = atob(base64Data); const binaryData = Uint8Array.from(atob(base64Data), c => c.charCodeAt(0));
const codes: Byte[] = []; this._data.push(binaryData.byteLength, binaryData.buffer);
for(let i = 0; i < binaryData.length; i++) codes.push(new Byte(binaryData.charCodeAt(i)));
this._data.push(codes.length, ...codes);
} }
} }