2 * FreeRDP: A Remote Desktop Protocol Client
5 * Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
20 /* do not include this file directly! */
22 int LINE_TO(HGDI_DC hdc, int nXEnd, int nYEnd)
41 dx = (x1 > x2) ? x1 - x2 : x2 - x1;
42 dy = (y1 > y2) ? y1 - y2 : y2 - y1;
44 sx = (x1 < x2) ? 1 : -1;
45 sy = (y1 < y2) ? 1 : -1;
52 bmp = (HGDI_BITMAP) hdc->selectedObject;
56 bx1 = (x1 < x2) ? x1 : x2;
57 by1 = (y1 < y2) ? y1 : y2;
58 bx2 = (x1 > x2) ? x1 : x2;
59 by2 = (y1 > y2) ? y1 : y2;
65 bx2 = bx1 + hdc->clip->w - 1;
66 by2 = by1 + hdc->clip->h - 1;
69 pen = GDI_GET_PEN_COLOR(hdc->pen);
73 if (!(x == x2 && y == y2))
75 if ((x >= bx1 && x <= bx2) && (y >= by1 && y <= by2))
77 pixel = GDI_GET_POINTER(bmp, x, y);
78 SET_PIXEL_ROP2(pixel, &pen);
107 #undef SET_PIXEL_ROP2
108 #undef GDI_GET_POINTER
109 #undef GDI_GET_PEN_COLOR