mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-common
synced 2025-12-26 14:18:36 +00:00
Move in spice/draw.h from spice-protocol to common/
This commit is contained in:
parent
2b5fe8c7ac
commit
d1ed338483
@ -22,7 +22,6 @@
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <spice/draw.h>
|
||||
#include <spice/macros.h>
|
||||
#include "quic.h"
|
||||
#include "lz.h"
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#include "pixman_utils.h"
|
||||
#include "lz.h"
|
||||
#include "region.h"
|
||||
#include <spice/draw.h>
|
||||
#include <common/draw.h>
|
||||
|
||||
typedef void (*spice_destroy_fn_t)(void *data);
|
||||
|
||||
|
||||
294
draw.h
Normal file
294
draw.h
Normal file
@ -0,0 +1,294 @@
|
||||
/*
|
||||
Copyright (C) 2009 Red Hat, Inc.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are
|
||||
met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in
|
||||
the documentation and/or other materials provided with the
|
||||
distribution.
|
||||
* Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived
|
||||
from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS
|
||||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef _H_SPICE_DRAW
|
||||
#define _H_SPICE_DRAW
|
||||
|
||||
#include <spice/types.h>
|
||||
#include <spice/enums.h>
|
||||
|
||||
#include <spice/start-packed.h>
|
||||
|
||||
#define SPICE_GET_ADDRESS(addr) ((void *)(unsigned long)(addr))
|
||||
#define SPICE_SET_ADDRESS(addr, val) ((addr) = (unsigned long)(val))
|
||||
|
||||
typedef int32_t SPICE_FIXED28_4;
|
||||
typedef uint64_t SPICE_ADDRESS;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpicePointFix {
|
||||
SPICE_FIXED28_4 x;
|
||||
SPICE_FIXED28_4 y;
|
||||
} SpicePointFix;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpicePoint {
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
} SpicePoint;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpicePoint16 {
|
||||
int16_t x;
|
||||
int16_t y;
|
||||
} SpicePoint16;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceRect {
|
||||
int32_t left;
|
||||
int32_t top;
|
||||
int32_t right;
|
||||
int32_t bottom;
|
||||
} SpiceRect;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpicePathSeg {
|
||||
uint32_t flags;
|
||||
uint32_t count;
|
||||
SpicePointFix points[0];
|
||||
} SpicePathSeg;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpicePath {
|
||||
uint32_t num_segments;
|
||||
SpicePathSeg *segments[0];
|
||||
} SpicePath;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceClipRects {
|
||||
uint32_t num_rects;
|
||||
SpiceRect rects[0];
|
||||
} SpiceClipRects;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceClip {
|
||||
uint32_t type;
|
||||
SpiceClipRects *rects;
|
||||
} SpiceClip;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpicePalette {
|
||||
uint64_t unique;
|
||||
uint16_t num_ents;
|
||||
uint32_t ents[0];
|
||||
} SpicePalette;
|
||||
|
||||
#define SPICE_SURFACE_FMT_DEPTH(_d) ((_d) & 0x3f)
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceImageDescriptor {
|
||||
uint64_t id;
|
||||
uint8_t type;
|
||||
uint8_t flags;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
} SpiceImageDescriptor;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceChunk {
|
||||
uint8_t *data;
|
||||
uint32_t len;
|
||||
} SpiceChunk;
|
||||
|
||||
enum {
|
||||
SPICE_CHUNKS_FLAGS_UNSTABLE = (1<<0),
|
||||
SPICE_CHUNKS_FLAGS_FREE = (1<<1)
|
||||
};
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceChunks {
|
||||
uint32_t data_size;
|
||||
uint32_t num_chunks;
|
||||
uint32_t flags;
|
||||
SpiceChunk chunk[0];
|
||||
} SpiceChunks;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceBitmap {
|
||||
uint8_t format;
|
||||
uint8_t flags;
|
||||
uint32_t x;
|
||||
uint32_t y;
|
||||
uint32_t stride;
|
||||
SpicePalette *palette;
|
||||
uint64_t palette_id;
|
||||
SpiceChunks *data;
|
||||
} SpiceBitmap;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceSurface {
|
||||
uint32_t surface_id;
|
||||
} SpiceSurface;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceQUICData {
|
||||
uint32_t data_size;
|
||||
SpiceChunks *data;
|
||||
} SpiceQUICData, SpiceLZRGBData, SpiceJPEGData;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceLZPLTData {
|
||||
uint8_t flags;
|
||||
uint32_t data_size;
|
||||
SpicePalette *palette;
|
||||
uint64_t palette_id;
|
||||
SpiceChunks *data;
|
||||
} SpiceLZPLTData;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceZlibGlzRGBData {
|
||||
uint32_t glz_data_size;
|
||||
uint32_t data_size;
|
||||
SpiceChunks *data;
|
||||
} SpiceZlibGlzRGBData;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceJPEGAlphaData {
|
||||
uint8_t flags;
|
||||
uint32_t jpeg_size;
|
||||
uint32_t data_size;
|
||||
SpiceChunks *data;
|
||||
} SpiceJPEGAlphaData;
|
||||
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceImage {
|
||||
SpiceImageDescriptor descriptor;
|
||||
union {
|
||||
SpiceBitmap bitmap;
|
||||
SpiceQUICData quic;
|
||||
SpiceSurface surface;
|
||||
SpiceLZRGBData lz_rgb;
|
||||
SpiceLZPLTData lz_plt;
|
||||
SpiceJPEGData jpeg;
|
||||
SpiceZlibGlzRGBData zlib_glz;
|
||||
SpiceJPEGAlphaData jpeg_alpha;
|
||||
} u;
|
||||
} SpiceImage;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpicePattern {
|
||||
SpiceImage *pat;
|
||||
SpicePoint pos;
|
||||
} SpicePattern;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceBrush {
|
||||
uint32_t type;
|
||||
union {
|
||||
uint32_t color;
|
||||
SpicePattern pattern;
|
||||
} u;
|
||||
} SpiceBrush;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceQMask {
|
||||
uint8_t flags;
|
||||
SpicePoint pos;
|
||||
SpiceImage *bitmap;
|
||||
} SpiceQMask;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceFill {
|
||||
SpiceBrush brush;
|
||||
uint16_t rop_descriptor;
|
||||
SpiceQMask mask;
|
||||
} SpiceFill;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceOpaque {
|
||||
SpiceImage *src_bitmap;
|
||||
SpiceRect src_area;
|
||||
SpiceBrush brush;
|
||||
uint16_t rop_descriptor;
|
||||
uint8_t scale_mode;
|
||||
SpiceQMask mask;
|
||||
} SpiceOpaque;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceCopy {
|
||||
SpiceImage *src_bitmap;
|
||||
SpiceRect src_area;
|
||||
uint16_t rop_descriptor;
|
||||
uint8_t scale_mode;
|
||||
SpiceQMask mask;
|
||||
} SpiceCopy, SpiceBlend;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceTransparent {
|
||||
SpiceImage *src_bitmap;
|
||||
SpiceRect src_area;
|
||||
uint32_t src_color;
|
||||
uint32_t true_color;
|
||||
} SpiceTransparent;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceAlphaBlnd {
|
||||
uint16_t alpha_flags;
|
||||
uint8_t alpha;
|
||||
SpiceImage *src_bitmap;
|
||||
SpiceRect src_area;
|
||||
} SpiceAlphaBlnd;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceRop3 {
|
||||
SpiceImage *src_bitmap;
|
||||
SpiceRect src_area;
|
||||
SpiceBrush brush;
|
||||
uint8_t rop3;
|
||||
uint8_t scale_mode;
|
||||
SpiceQMask mask;
|
||||
} SpiceRop3;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceBlackness {
|
||||
SpiceQMask mask;
|
||||
} SpiceBlackness, SpiceInvers, SpiceWhiteness;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceLineAttr {
|
||||
uint8_t flags;
|
||||
uint8_t style_nseg;
|
||||
SPICE_FIXED28_4 *style;
|
||||
} SpiceLineAttr;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceStroke {
|
||||
SpicePath *path;
|
||||
SpiceLineAttr attr;
|
||||
SpiceBrush brush;
|
||||
uint16_t fore_mode;
|
||||
uint16_t back_mode;
|
||||
} SpiceStroke;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceRasterGlyph {
|
||||
SpicePoint render_pos;
|
||||
SpicePoint glyph_origin;
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
uint8_t data[0];
|
||||
} SpiceRasterGlyph;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceString {
|
||||
uint16_t length;
|
||||
uint16_t flags;
|
||||
SpiceRasterGlyph *glyphs[0];
|
||||
} SpiceString;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceText {
|
||||
SpiceString *str;
|
||||
SpiceRect back_area;
|
||||
SpiceBrush fore_brush;
|
||||
SpiceBrush back_brush;
|
||||
uint16_t fore_mode;
|
||||
uint16_t back_mode;
|
||||
} SpiceText;
|
||||
|
||||
typedef struct SPICE_ATTR_PACKED SpiceCursorHeader {
|
||||
uint64_t unique;
|
||||
uint16_t type;
|
||||
uint16_t width;
|
||||
uint16_t height;
|
||||
uint16_t hot_spot_x;
|
||||
uint16_t hot_spot_y;
|
||||
} SpiceCursorHeader;
|
||||
|
||||
#include <spice/end-packed.h>
|
||||
|
||||
#endif /* _H_SPICE_DRAW */
|
||||
@ -21,7 +21,6 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <spice/draw.h>
|
||||
#include "pixman_utils.h"
|
||||
#include "canvas_base.h"
|
||||
#include "region.h"
|
||||
|
||||
@ -17,7 +17,6 @@
|
||||
*/
|
||||
|
||||
#include "glc.h"
|
||||
#include <spice/draw.h>
|
||||
#include "canvas_base.h"
|
||||
#include "region.h"
|
||||
|
||||
|
||||
2
lines.h
2
lines.h
@ -52,7 +52,7 @@ SOFTWARE.
|
||||
#include <pixman_utils.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <spice/draw.h>
|
||||
#include <common/draw.h>
|
||||
|
||||
typedef struct lineGC lineGC;
|
||||
|
||||
|
||||
2
lz.h
2
lz.h
@ -8,7 +8,7 @@
|
||||
|
||||
#include "lz_common.h"
|
||||
#include "lz_config.h"
|
||||
#include <spice/draw.h>
|
||||
#include <common/draw.h>
|
||||
|
||||
typedef void *LzContext;
|
||||
|
||||
|
||||
@ -20,7 +20,7 @@
|
||||
#define _H_MARSHALLER
|
||||
|
||||
#include <spice/types.h>
|
||||
#include <spice/draw.h> /* for SpiceChunk, temporary */
|
||||
#include <common/draw.h> /* for SpiceChunk, temporary */
|
||||
#ifndef WIN32
|
||||
#include <sys/uio.h>
|
||||
#endif
|
||||
|
||||
2
mem.h
2
mem.h
@ -21,7 +21,7 @@
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <spice/macros.h>
|
||||
#include <spice/draw.h> /* for SpiceChunks, temporary */
|
||||
#include <common/draw.h> /* for SpiceChunks, temporary */
|
||||
|
||||
char *spice_strdup(const char *str) SPICE_GNUC_MALLOC;
|
||||
char *spice_strndup(const char *str, size_t n_bytes) SPICE_GNUC_MALLOC;
|
||||
|
||||
@ -32,6 +32,7 @@
|
||||
#define _H_MESSAGES
|
||||
|
||||
#include <spice/protocol.h>
|
||||
#include <common/draw.h>
|
||||
|
||||
typedef struct SpiceMsgData {
|
||||
uint32_t data_size;
|
||||
|
||||
@ -24,7 +24,7 @@
|
||||
#define PIXMAN_DONT_DEFINE_STDINT
|
||||
#include <pixman.h>
|
||||
|
||||
#include <spice/draw.h>
|
||||
#include <common/draw.h>
|
||||
|
||||
/* This lists all possible 2 argument binary raster ops.
|
||||
* This enum has the same values as the X11 GXcopy type
|
||||
|
||||
2
rect.h
2
rect.h
@ -19,7 +19,7 @@
|
||||
#ifndef _H_RECT
|
||||
#define _H_RECT
|
||||
|
||||
#include <spice/draw.h>
|
||||
#include <common/draw.h>
|
||||
#include <spice/macros.h>
|
||||
|
||||
static inline void rect_sect(SpiceRect* r, const SpiceRect* bounds)
|
||||
|
||||
2
region.h
2
region.h
@ -20,7 +20,7 @@
|
||||
#define _H_REGION
|
||||
|
||||
#include <stdint.h>
|
||||
#include <spice/draw.h>
|
||||
#include <common/draw.h>
|
||||
#include <pixman_utils.h>
|
||||
|
||||
typedef pixman_region32_t QRegion;
|
||||
|
||||
2
rop3.h
2
rop3.h
@ -21,7 +21,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <spice/draw.h>
|
||||
#include <common/draw.h>
|
||||
#include "pixman_utils.h"
|
||||
|
||||
void do_rop3_with_pattern(uint8_t rop3, pixman_image_t *d, pixman_image_t *s, SpicePoint *src_pos,
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <spice/draw.h>
|
||||
#include <common/draw.h>
|
||||
#include "pixman_utils.h"
|
||||
#include "canvas_base.h"
|
||||
#include "region.h"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user