~ubuntu-branches/ubuntu/wily/freerdp/wily-proposed

« back to all changes in this revision

Viewing changes to libfreerdp-gdi/line.c

  • Committer: Package Import Robot
  • Author(s): Martin Pitt, Jeremy Bicha, Jean-Louis Dupond, Martin Pitt
  • Date: 2012-01-31 10:02:14 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120131100214-jaok3uwvni7sqxth
Tags: 1.0.0-0git1
Upload current Debian packaging git to get this rolling for precise.

[ Jeremy Bicha ]
* New upstream release. Closes: #647498.
* Updated symbols and bumped soname
* debian/control:
  - Added new build dependencies
  - Bump Standards-Version to 3.9.2
* debian/source/format: Set to 3.0 (quilt)
* debian/rules: Turn on strict symbols checking
* debian/watch: Watch github

[ Jean-Louis Dupond ]
* debian/control: Updated homepage
* debian/copyright: Reflect upstream switch to the Apache license

[ Martin Pitt ]
* debian/libfreerdp0.symbols: Fix version number, should
  be 1.0~beta5, not 1.0-beta5.
* debian/control: Add libavcodec-dev build dependency, upstream build system
  checks for that. Thanks Jean-Louis Dupond!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * FreeRDP: A Remote Desktop Protocol Client
 
3
 * GDI Line Functions
 
4
 *
 
5
 * Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
 
6
 *
 
7
 * Licensed under the Apache License, Version 2.0 (the "License");
 
8
 * you may not use this file except in compliance with the License.
 
9
 * You may obtain a copy of the License at
 
10
 *
 
11
 *     http://www.apache.org/licenses/LICENSE-2.0
 
12
 *
 
13
 * Unless required by applicable law or agreed to in writing, software
 
14
 * distributed under the License is distributed on an "AS IS" BASIS,
 
15
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 
16
 * See the License for the specific language governing permissions and
 
17
 * limitations under the License.
 
18
 */
 
19
 
 
20
#include <stdio.h>
 
21
#include <string.h>
 
22
#include <stdlib.h>
 
23
 
 
24
#include <freerdp/freerdp.h>
 
25
#include <freerdp/gdi/gdi.h>
 
26
 
 
27
#include <freerdp/gdi/32bpp.h>
 
28
#include <freerdp/gdi/16bpp.h>
 
29
#include <freerdp/gdi/8bpp.h>
 
30
 
 
31
#include <freerdp/gdi/line.h>
 
32
 
 
33
p_LineTo LineTo_[5] =
 
34
{
 
35
        NULL,
 
36
        LineTo_8bpp,
 
37
        LineTo_16bpp,
 
38
        NULL,
 
39
        LineTo_32bpp
 
40
};
 
41
 
 
42
/**
 
43
 * Draw a line from the current position to the given position.\n
 
44
 * @msdn{dd145029}
 
45
 * @param hdc device context
 
46
 * @param nXEnd ending x position
 
47
 * @param nYEnd ending y position
 
48
 * @return 1 if successful, 0 otherwise
 
49
 */
 
50
 
 
51
int gdi_LineTo(HGDI_DC hdc, int nXEnd, int nYEnd)
 
52
{
 
53
        p_LineTo _LineTo = LineTo_[IBPP(hdc->bitsPerPixel)];
 
54
 
 
55
        if (_LineTo != NULL)
 
56
                return _LineTo(hdc, nXEnd, nYEnd);
 
57
        else
 
58
                return 0;
 
59
}
 
60
 
 
61
/**
 
62
 * Draw one or more straight lines
 
63
 * @param hdc device context
 
64
 * @param lppt array of points
 
65
 * @param cCount number of points
 
66
 * @return
 
67
 */
 
68
int gdi_PolylineTo(HGDI_DC hdc, GDI_POINT *lppt, int cCount)
 
69
{
 
70
        int i;
 
71
 
 
72
        for (i = 0; i < cCount; i++)
 
73
        {
 
74
                gdi_LineTo(hdc, lppt[i].x, lppt[i].y);
 
75
                gdi_MoveToEx(hdc, lppt[i].x, lppt[i].y, NULL);
 
76
        }
 
77
 
 
78
        return 1;
 
79
}
 
80
 
 
81
/**
 
82
 * Draw one or more straight lines
 
83
 * @param hdc device context
 
84
 * @param lppt array of points
 
85
 * @param cPoints number of points
 
86
 * @return
 
87
 */
 
88
int gdi_Polyline(HGDI_DC hdc, GDI_POINT *lppt, int cPoints)
 
89
{
 
90
        if (cPoints > 0)
 
91
        {
 
92
                int i;
 
93
                GDI_POINT pt;
 
94
 
 
95
                gdi_MoveToEx(hdc, lppt[0].x, lppt[0].y, &pt);
 
96
 
 
97
                for (i = 0; i < cPoints; i++)
 
98
                {
 
99
                        gdi_LineTo(hdc, lppt[i].x, lppt[i].y);
 
100
                        gdi_MoveToEx(hdc, lppt[i].x, lppt[i].y, NULL);
 
101
                }
 
102
 
 
103
                gdi_MoveToEx(hdc, pt.x, pt.y, NULL);
 
104
        }
 
105
 
 
106
        return 1;
 
107
}
 
108
 
 
109
/**
 
110
 * Draw multiple series of connected line segments
 
111
 * @param hdc device context
 
112
 * @param lppt array of points
 
113
 * @param lpdwPolyPoints array of numbers of points per series
 
114
 * @param cCount count of entries in lpdwPolyPoints
 
115
 * @return
 
116
 */
 
117
int gdi_PolyPolyline(HGDI_DC hdc, GDI_POINT *lppt, int *lpdwPolyPoints, int cCount)
 
118
{
 
119
        int cPoints;
 
120
        int i, j = 0;
 
121
 
 
122
        for (i = 0; i < cCount; i++)
 
123
        {
 
124
                cPoints = lpdwPolyPoints[i];
 
125
                gdi_Polyline(hdc, &lppt[j], cPoints);
 
126
                j += cPoints;
 
127
        }
 
128
 
 
129
        return 1;
 
130
}
 
131
 
 
132
/**
 
133
 * Move pen from the current device context to a new position.
 
134
 * @param hdc device context
 
135
 * @param X x position
 
136
 * @param Y y position
 
137
 * @return 1 if successful, 0 otherwise
 
138
 */
 
139
 
 
140
int gdi_MoveToEx(HGDI_DC hdc, int X, int Y, HGDI_POINT lpPoint)
 
141
{
 
142
        if (lpPoint != NULL)
 
143
        {
 
144
                lpPoint->x = hdc->pen->posX;
 
145
                lpPoint->y = hdc->pen->posY;
 
146
        }
 
147
 
 
148
        hdc->pen->posX = X;
 
149
        hdc->pen->posY = Y;
 
150
 
 
151
        return 1;
 
152
}