mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-08-08 11:06:18 +00:00
Add line rasterizer
This commit is contained in:
parent
9091e763a8
commit
60a189f250
@ -11,6 +11,7 @@ RED_COMMON_SRCS = \
|
||||
cache.hpp \
|
||||
cairo_canvas.cpp \
|
||||
pixman_utils.cpp \
|
||||
lines.cpp \
|
||||
canvas.cpp \
|
||||
canvas.h \
|
||||
canvas_utils.cpp \
|
||||
|
||||
24
client/lines.cpp
Normal file
24
client/lines.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
/*
|
||||
Copyright (C) 2009 Red Hat, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
#include "utils.h"
|
||||
|
||||
|
||||
#define CANVAS_ERROR(format, ...) THROW(format, ## __VA_ARGS__)
|
||||
|
||||
#include "../common/lines.c"
|
||||
@ -66,6 +66,7 @@ RED_COMMON_SRCS = \
|
||||
$(top_srcdir)/client/inputs_channel.h \
|
||||
$(top_srcdir)/client/inputs_handler.h \
|
||||
$(top_srcdir)/client/lz.cpp \
|
||||
$(top_srcdir)/client/lines.cpp \
|
||||
$(top_srcdir)/client/monitor.cpp \
|
||||
$(top_srcdir)/client/monitor.h \
|
||||
$(top_srcdir)/client/menu.cpp \
|
||||
|
||||
@ -34,6 +34,8 @@ COMMON_SRCS = \
|
||||
ring.h \
|
||||
rop3.h \
|
||||
rop3.c \
|
||||
lines.h \
|
||||
lines.c \
|
||||
lz.c \
|
||||
lz_compress_tmpl.c \
|
||||
lz_config.h \
|
||||
|
||||
3632
common/lines.c
Normal file
3632
common/lines.c
Normal file
File diff suppressed because it is too large
Load Diff
130
common/lines.h
Normal file
130
common/lines.h
Normal file
@ -0,0 +1,130 @@
|
||||
/* -*- Mode: C; c-basic-offset: 4; indent-tabs-mode: nil -*- */
|
||||
/***********************************************************
|
||||
|
||||
Copyright 1987, 1998 The Open Group
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software and its
|
||||
documentation for any purpose is hereby granted without fee, provided that
|
||||
the above copyright notice appear in all copies and that both that
|
||||
copyright notice and this permission notice appear in supporting
|
||||
documentation.
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
Except as contained in this notice, the name of The Open Group shall not be
|
||||
used in advertising or otherwise to promote the sale, use or other dealings
|
||||
in this Software without prior written authorization from The Open Group.
|
||||
|
||||
|
||||
Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
|
||||
|
||||
All Rights Reserved
|
||||
|
||||
Permission to use, copy, modify, and distribute this software and its
|
||||
documentation for any purpose and without fee is hereby granted,
|
||||
provided that the above copyright notice appear in all copies and that
|
||||
both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of Digital not be
|
||||
used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission.
|
||||
|
||||
DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
|
||||
ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
|
||||
DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
|
||||
ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
******************************************************************/
|
||||
|
||||
#ifndef LINES_H
|
||||
#define LINES_H
|
||||
|
||||
#include <pixman.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <spice/draw.h>
|
||||
|
||||
typedef struct lineGC lineGC;
|
||||
|
||||
typedef struct {
|
||||
void (*FillSpans)(lineGC * pGC,
|
||||
int num_spans, SpicePoint * points, int *widths,
|
||||
int sorted, int foreground);
|
||||
void (*FillRects)(lineGC * pGC,
|
||||
int nun_rects, pixman_rectangle32_t * rects,
|
||||
int foreground);
|
||||
} lineGCOps;
|
||||
|
||||
struct lineGC {
|
||||
int width;
|
||||
int height;
|
||||
unsigned char alu;
|
||||
unsigned short lineWidth;
|
||||
unsigned short dashOffset;
|
||||
unsigned short numInDashList;
|
||||
unsigned char *dash;
|
||||
unsigned int lineStyle:2;
|
||||
unsigned int capStyle:2;
|
||||
unsigned int joinStyle:2;
|
||||
lineGCOps *ops;
|
||||
};
|
||||
|
||||
/* CoordinateMode for drawing routines */
|
||||
|
||||
#define CoordModeOrigin 0 /* relative to the origin */
|
||||
#define CoordModePrevious 1 /* relative to previous point */
|
||||
|
||||
/* LineStyle */
|
||||
|
||||
#define LineSolid 0
|
||||
#define LineOnOffDash 1
|
||||
#define LineDoubleDash 2
|
||||
|
||||
/* capStyle */
|
||||
|
||||
#define CapNotLast 0
|
||||
#define CapButt 1
|
||||
#define CapRound 2
|
||||
#define CapProjecting 3
|
||||
|
||||
/* joinStyle */
|
||||
|
||||
#define JoinMiter 0
|
||||
#define JoinRound 1
|
||||
#define JoinBevel 2
|
||||
|
||||
extern void spice_canvas_zero_line(lineGC *pgc,
|
||||
int mode,
|
||||
int num_points,
|
||||
SpicePoint * points);
|
||||
extern void spice_canvas_zero_dash_line(lineGC * pgc,
|
||||
int mode,
|
||||
int n_points,
|
||||
SpicePoint * points);
|
||||
extern void spice_canvas_wide_dash_line(lineGC * pGC,
|
||||
int mode,
|
||||
int num_points,
|
||||
SpicePoint * points);
|
||||
extern void spice_canvas_wide_line(lineGC *pGC,
|
||||
int mode,
|
||||
int num_points,
|
||||
SpicePoint * points);
|
||||
extern int spice_canvas_clip_spans(pixman_region32_t *clip_region,
|
||||
SpicePoint *points,
|
||||
int *widths,
|
||||
int num_spans,
|
||||
SpicePoint *new_points,
|
||||
int *new_widths,
|
||||
int sorted);
|
||||
|
||||
#endif /* LINES_H */
|
||||
@ -21,6 +21,7 @@ INCLUDES = \
|
||||
COMMON_SRCS = \
|
||||
$(top_srcdir)/common/cairo_canvas.c \
|
||||
$(top_srcdir)/common/pixman_utils.c \
|
||||
$(top_srcdir)/common/lines.c \
|
||||
$(top_srcdir)/common/gl_canvas.c \
|
||||
$(top_srcdir)/common/region.c \
|
||||
$(top_srcdir)/common/glc.c \
|
||||
|
||||
Loading…
Reference in New Issue
Block a user