mirror of
https://github.com/retspen/webvirtcloud
synced 2025-07-31 12:41:08 +00:00
Update spice-html5
This commit is contained in:
parent
34394c2b5e
commit
562fe5c3dc
36 changed files with 59278 additions and 1325 deletions
|
|
@ -23,16 +23,19 @@
|
|||
** bitmap.js
|
||||
** Handle SPICE_IMAGE_TYPE_BITMAP
|
||||
**--------------------------------------------------------------------------*/
|
||||
|
||||
import { Constants } from './enums.js';
|
||||
|
||||
function convert_spice_bitmap_to_web(context, spice_bitmap)
|
||||
{
|
||||
var ret;
|
||||
var offset, x, src_offset = 0, src_dec = 0;
|
||||
var u8 = new Uint8Array(spice_bitmap.data);
|
||||
if (spice_bitmap.format != SPICE_BITMAP_FMT_32BIT &&
|
||||
spice_bitmap.format != SPICE_BITMAP_FMT_RGBA)
|
||||
if (spice_bitmap.format != Constants.SPICE_BITMAP_FMT_32BIT &&
|
||||
spice_bitmap.format != Constants.SPICE_BITMAP_FMT_RGBA)
|
||||
return undefined;
|
||||
|
||||
if (!(spice_bitmap.flags & SPICE_BITMAP_FLAGS_TOP_DOWN))
|
||||
if (!(spice_bitmap.flags & Constants.SPICE_BITMAP_FLAGS_TOP_DOWN))
|
||||
{
|
||||
src_offset = (spice_bitmap.y - 1 ) * spice_bitmap.stride;
|
||||
src_dec = 2 * spice_bitmap.stride;
|
||||
|
|
@ -47,7 +50,7 @@ function convert_spice_bitmap_to_web(context, spice_bitmap)
|
|||
ret.data[offset + 2 ] = u8[src_offset + 0];
|
||||
|
||||
// FIXME - We effectively treat all images as having SPICE_IMAGE_FLAGS_HIGH_BITS_SET
|
||||
if (spice_bitmap.format == SPICE_BITMAP_FMT_32BIT)
|
||||
if (spice_bitmap.format == Constants.SPICE_BITMAP_FMT_32BIT)
|
||||
ret.data[offset + 3] = 255;
|
||||
else
|
||||
ret.data[offset + 3] = u8[src_offset];
|
||||
|
|
@ -55,3 +58,7 @@ function convert_spice_bitmap_to_web(context, spice_bitmap)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
export {
|
||||
convert_spice_bitmap_to_web,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue