summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-07-08 13:56:01 +0200
committerAlexander Larsson <alexl@redhat.com>2010-07-08 13:56:01 +0200
commit0659fb78972b5e9d0dc90a0270ef1dd4b59042ec (patch)
tree111ff1650fc87625e60cbe1bf56daee8f7a92126
parent3c0329d27f692d418fa6bd0955dd5e0c242618a6 (diff)
downloadspice-0659fb78972b5e9d0dc90a0270ef1dd4b59042ec.tar.gz
spice-0659fb78972b5e9d0dc90a0270ef1dd4b59042ec.tar.xz
spice-0659fb78972b5e9d0dc90a0270ef1dd4b59042ec.zip
Move in spice/draw.h from spice-protocol to common/
-rw-r--r--client/glz_decoder.h3
-rw-r--r--client/monitor.h2
-rw-r--r--client/pixels_source.h2
-rw-r--r--common/canvas_base.c1
-rw-r--r--common/canvas_base.h2
-rw-r--r--common/draw.h294
-rw-r--r--common/gdi_canvas.h1
-rw-r--r--common/gl_canvas.h1
-rw-r--r--common/lines.h2
-rw-r--r--common/lz.h2
-rw-r--r--common/marshaller.h2
-rw-r--r--common/mem.h2
-rw-r--r--common/messages.h1
-rw-r--r--common/pixman_utils.h2
-rw-r--r--common/rect.h2
-rw-r--r--common/region.h2
-rw-r--r--common/rop3.h2
-rw-r--r--common/sw_canvas.h2
18 files changed, 307 insertions, 18 deletions
diff --git a/client/glz_decoder.h b/client/glz_decoder.h
index bf57252b..f046f8c8 100644
--- a/client/glz_decoder.h
+++ b/client/glz_decoder.h
@@ -23,9 +23,6 @@
#include "glz_decoder_config.h"
#include "glz_decoder_window.h"
#include "canvas_base.h"
-#include <spice/draw.h>
-
-
class GlzDecodeHandler {
public:
diff --git a/client/monitor.h b/client/monitor.h
index 34089c0f..39d957d7 100644
--- a/client/monitor.h
+++ b/client/monitor.h
@@ -18,7 +18,7 @@
#ifndef _H_MONITOR
#define _H_MONITOR
-#include <spice/draw.h>
+#include <common/draw.h>
class Monitor {
public:
diff --git a/client/pixels_source.h b/client/pixels_source.h
index 6b898b2b..6e243003 100644
--- a/client/pixels_source.h
+++ b/client/pixels_source.h
@@ -18,7 +18,7 @@
#ifndef _H_PIXELS_SOURCE
#define _H_PIXELS_SOURCE
-#include <spice/draw.h>
+#include <common/draw.h>
#define PIXELES_SOURCE_OPAQUE_SIZE (20 * sizeof(void*))
diff --git a/common/canvas_base.c b/common/canvas_base.c
index 6a0c09c3..ef60d215 100644
--- a/common/canvas_base.c
+++ b/common/canvas_base.c
@@ -22,7 +22,6 @@
#include <stdio.h>
#include <math.h>
-#include <spice/draw.h>
#include <spice/macros.h>
#include "quic.h"
#include "lz.h"
diff --git a/common/canvas_base.h b/common/canvas_base.h
index 36199a71..55e1b337 100644
--- a/common/canvas_base.h
+++ b/common/canvas_base.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);
diff --git a/common/draw.h b/common/draw.h
new file mode 100644
index 00000000..b8432a9b
--- /dev/null
+++ b/common/draw.h
@@ -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 */
diff --git a/common/gdi_canvas.h b/common/gdi_canvas.h
index 3fdf07e9..b3d4b15e 100644
--- a/common/gdi_canvas.h
+++ b/common/gdi_canvas.h
@@ -21,7 +21,6 @@
#include <stdint.h>
-#include <spice/draw.h>
#include "pixman_utils.h"
#include "canvas_base.h"
#include "region.h"
diff --git a/common/gl_canvas.h b/common/gl_canvas.h
index dfb59bbf..d7125e60 100644
--- a/common/gl_canvas.h
+++ b/common/gl_canvas.h
@@ -17,7 +17,6 @@
*/
#include "glc.h"
-#include <spice/draw.h>
#include "canvas_base.h"
#include "region.h"
diff --git a/common/lines.h b/common/lines.h
index 33c8ea90..8a60c03c 100644
--- a/common/lines.h
+++ b/common/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;
diff --git a/common/lz.h b/common/lz.h
index 6f796f17..fb61e10e 100644
--- a/common/lz.h
+++ b/common/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;
diff --git a/common/marshaller.h b/common/marshaller.h
index 51189341..ab11742c 100644
--- a/common/marshaller.h
+++ b/common/marshaller.h
@@ -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
diff --git a/common/mem.h b/common/mem.h
index ebf2fb8c..385ef556 100644
--- a/common/mem.h
+++ b/common/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;
diff --git a/common/messages.h b/common/messages.h
index 7575f071..4cbd80eb 100644
--- a/common/messages.h
+++ b/common/messages.h
@@ -32,6 +32,7 @@
#define _H_MESSAGES
#include <spice/protocol.h>
+#include <common/draw.h>
typedef struct SpiceMsgData {
uint32_t data_size;
diff --git a/common/pixman_utils.h b/common/pixman_utils.h
index 24ecee37..45a58cae 100644
--- a/common/pixman_utils.h
+++ b/common/pixman_utils.h
@@ -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
diff --git a/common/rect.h b/common/rect.h
index 802c76b0..7d8e752d 100644
--- a/common/rect.h
+++ b/common/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)
diff --git a/common/region.h b/common/region.h
index 223370d4..c90e06fc 100644
--- a/common/region.h
+++ b/common/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;
diff --git a/common/rop3.h b/common/rop3.h
index 9c863977..15f31d45 100644
--- a/common/rop3.h
+++ b/common/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,
diff --git a/common/sw_canvas.h b/common/sw_canvas.h
index d4573bb8..2d551184 100644
--- a/common/sw_canvas.h
+++ b/common/sw_canvas.h
@@ -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"