else
xfc->format = PIXEL_FORMAT_RGBX32;
+ xfc->format = PIXEL_FORMAT_RGBX32;
+
if (xfc->debug)
{
WLog_INFO(TAG, "Enabling X11 debug mode.");
{
brushFormat = gdi_get_pixel_format(bpp, FALSE);
cdata = (BYTE*) _aligned_malloc(width * height * 4, 16);
- freerdp_image_copy(cdata, xfc->format, -1, 0, 0,
- width, height, data, brushFormat, -1, 0, 0,
+ freerdp_image_copy(cdata, xfc->format, 0, 0, 0,
+ width, height, data, brushFormat, 0, 0, 0,
&xfc->context.gdi->palette);
image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
ZPixmap, 0, (char*) cdata, width, height, xfc->scanline_pad, 0);
pSrcData, SrcSize,
bitsPerPixel,
pDstData,
- xfc->format, -1,
+ xfc->format, 0,
0, 0,
nWidth, nHeight,
&xfc->context.gdi->palette))
else
{
if (!planar_decompress(codecs->planar, pSrcData, SrcSize, pDstData,
- xfc->format, -1, 0, 0, nWidth, nHeight, TRUE))
+ xfc->format, 0, 0, 0, nWidth, nHeight, TRUE))
return FALSE;
}
{
pDstData = xfc->bitmap_buffer;
- if (!freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
+ if (!freerdp_image_copy(pDstData, xfc->format, 0, 0, 0,
nWidth, nHeight, pSrcData, SrcFormat,
- -1, 0, 0, &xfc->context.gdi->palette))
+ 0, 0, 0, &xfc->context.gdi->palette))
return FALSE;
pSrcData = xfc->bitmap_buffer;
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
XSetForeground(xfc->display, xfc->gc, color);
- for (i = 1; i < multi_opaque_rect->numRectangles + 1; i++)
+ for (i = 0; i < multi_opaque_rect->numRectangles; i++)
{
const DELTA_RECT* rectangle = &multi_opaque_rect->rectangles[i];
XFillRectangle(xfc->display, xfc->drawing, xfc->gc,
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
pSrcData = cmd->bitmapData;
pDstData = xfc->bitmap_buffer;
- freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
+ freerdp_image_copy(pDstData, xfc->format, 0, 0, 0,
cmd->width, cmd->height, pSrcData,
- PIXEL_FORMAT_BGRX32_VF, -1, 0, 0, &xfc->context.gdi->palette);
+ PIXEL_FORMAT_BGRX32_VF, 0, 0, 0, &xfc->context.gdi->palette);
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
(char*) pDstData, cmd->width, cmd->height, xfc->scanline_pad, 0);
XPutImage(xfc->display, xfc->primary, xfc->gc, image, 0, 0,
}
SrcFormat = bitmap->format;
- freerdp_image_copy(data, xfc->format, -1, 0, 0,
+ freerdp_image_copy(data, xfc->format, 0, 0, 0,
bitmap->width, bitmap->height,
bitmap->data, SrcFormat,
- -1, 0, 0, &context->gdi->palette);
+ 0, 0, 0, &context->gdi->palette);
_aligned_free(bitmap->data);
bitmap->data = data;
bitmap->format = xfc->format;
if (!interleaved_decompress(context->codecs->interleaved,
pSrcData, SrcSize, bpp,
pDstData, xfc->format,
- -1, 0, 0, width, height,
+ 0, 0, 0, width, height,
&context->gdi->palette))
return FALSE;
}
else
{
if (!planar_decompress(context->codecs->planar, pSrcData, SrcSize,
- pDstData, xfc->format, -1, 0, 0, width, height, TRUE))
+ pDstData, xfc->format, 0, 0, 0, width, height, TRUE))
return FALSE;
}
}
{
SrcFormat = gdi_get_pixel_format(bpp, TRUE);
- if (!freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
+ if (!freerdp_image_copy(pDstData, xfc->format, 0, 0, 0,
width, height, pSrcData,
- SrcFormat, -1, 0, 0, &context->gdi->palette))
+ SrcFormat, 0, 0, 0, &context->gdi->palette))
return FALSE;
}
UINT32 xorBpp, const gdiPalette* palette);
FREERDP_API BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
- INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
+ UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight,
const BYTE* pSrcData, DWORD SrcFormat,
- INT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
+ UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
const gdiPalette* palette);
FREERDP_API BOOL freerdp_image_fill(BYTE* pDstData, DWORD DstFormat,
#ifndef FREERDP_GDI_H
#define FREERDP_GDI_H
+#include <winpr/wlog.h>
+
#include <freerdp/api.h>
#include <freerdp/log.h>
#include <freerdp/freerdp.h>
UINT32 bitmap_stride;
BYTE* bitmap_buffer;
BYTE* primary_buffer;
- UINT32 textColor;
gdiPalette palette;
gdiBitmap* image;
void (*free)(void*);
UINT16 outputSurfaceId;
REGION16 invalidRegion;
RdpgfxClientContext* gfx;
+
+ wLog* log;
};
#ifdef __cplusplus
}
#endif
-#define GDI_TAG FREERDP_TAG("gdi")
-#ifdef WITH_DEBUG_GDI
-#define DEBUG_GDI(fmt, ...) WLog_DBG(GDI_TAG, fmt, ## __VA_ARGS__)
-#else
-#define DEBUG_GDI(fmt, ...)
-#endif
-
#endif /* FREERDP_GDI_H */
if (!bitmap)
return FALSE;
- Bitmap_SetDimensions(bitmap, cacheBitmap->bitmapWidth,
- cacheBitmap->bitmapHeight);
+ if (!Bitmap_SetDimensions(bitmap, cacheBitmap->bitmapWidth,
+ cacheBitmap->bitmapHeight))
+ {
+ bitmap->Free(context, bitmap);
+ return FALSE;
+ }
if (!bitmap->Decompress(context, bitmap,
cacheBitmap->bitmapDataStream, cacheBitmap->bitmapWidth,
}
if (!bitmap->New(context, bitmap))
+ {
+ bitmap->Free(context, bitmap);
return FALSE;
+ }
prevBitmap = bitmap_cache_get(cache->bitmap, cacheBitmap->cacheId,
cacheBitmap->cacheIndex);
}
else
{
- rdpBitmap* bitmap;
- bitmap = offscreen_cache_get(cache->offscreen, switchSurface->bitmapId);
- bitmap->SetSurface(context, bitmap, FALSE);
+ rdpBitmap* bmp;
+ bmp = offscreen_cache_get(cache->offscreen, switchSurface->bitmapId);
+ bitmap->SetSurface(context, bmp, FALSE);
}
cache->offscreen->currentSurface = switchSurface->bitmapId;
}
BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
- INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
+ UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight,
const BYTE* pSrcData, DWORD SrcFormat,
- INT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
+ UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
const gdiPalette* palette)
{
const UINT32 dstByte = GetBytesPerPixel(DstFormat);
}
static INLINE BOOL update_read_delta_rects(wStream* s, DELTA_RECT* rectangles,
- int number)
+ UINT32 number)
{
- int i;
+ UINT32 i;
BYTE flags = 0;
BYTE* zeroBits;
UINT32 zeroBitsSize;
Stream_GetPointer(s, zeroBits);
Stream_Seek(s, zeroBitsSize);
- ZeroMemory(rectangles, sizeof(DELTA_RECT) * (number + 1));
+ ZeroMemory(rectangles, sizeof(DELTA_RECT) * number);
- for (i = 1; i < number + 1; i++)
+ for (i = 0; i < number; i++)
{
- if ((i - 1) % 2 == 0)
- flags = zeroBits[(i - 1) / 2];
+ if (i % 2 == 0)
+ flags = zeroBits[i / 2];
if ((~flags & 0x80) && !update_read_delta(s, &rectangles[i].left))
return FALSE;
if (!update_read_delta(s, &rectangles[i].width))
return FALSE;
}
- else
- {
+ else if (i > 0)
rectangles[i].width = rectangles[i - 1].width;
- }
+ else
+ rectangles[i].width = 0;
if (~flags & 0x10)
{
if (!update_read_delta(s, &rectangles[i].height))
return FALSE;
}
+ else if (i > 0)
+ rectangles[i].height = rectangles[i - 1].height;
else
+ rectangles[i].height = 0;
+
+ if (i > 0)
{
- rectangles[i].height = rectangles[i - 1].height;
+ rectangles[i].left += rectangles[i - 1].left;
+ rectangles[i].top += rectangles[i - 1].top;
}
- rectangles[i].left = rectangles[i].left + rectangles[i - 1].left;
- rectangles[i].top = rectangles[i].top + rectangles[i - 1].top;
flags <<= 4;
}
UINT16 flags)
{
UINT32 i;
- INT16 lsi16;
- GLYPH_DATA* glyph;
if (Stream_GetRemainingLength(s) < 2)
return FALSE;
for (i = 0; i < cache_glyph_order->cGlyphs; i++)
{
- glyph = &cache_glyph_order->glyphData[i];
+ GLYPH_DATA* glyph = &cache_glyph_order->glyphData[i];
if (Stream_GetRemainingLength(s) < 10)
return FALSE;
Stream_Read_UINT16(s, glyph->cacheIndex);
- Stream_Read_UINT16(s, lsi16);
- glyph->x = lsi16;
- Stream_Read_UINT16(s, lsi16);
- glyph->y = lsi16;
+ Stream_Read_INT16(s, glyph->x);
+ Stream_Read_INT16(s, glyph->y);
Stream_Read_UINT16(s, glyph->cx);
Stream_Read_UINT16(s, glyph->cy);
glyph->cb = ((glyph->cx + 7) / 8) * glyph->cy;
CACHE_GLYPH_V2_ORDER* cache_glyph_v2,
UINT16 flags)
{
- int i;
- GLYPH_DATA_V2* glyph;
+ UINT32 i;
cache_glyph_v2->cacheId = (flags & 0x000F);
cache_glyph_v2->flags = (flags & 0x00F0) >> 4;
cache_glyph_v2->cGlyphs = (flags & 0xFF00) >> 8;
- for (i = 0; i < (int) cache_glyph_v2->cGlyphs; i++)
+ for (i = 0; i < cache_glyph_v2->cGlyphs; i++)
{
- glyph = &cache_glyph_v2->glyphData[i];
+ GLYPH_DATA_V2* glyph = &cache_glyph_v2->glyphData[i];
if (Stream_GetRemainingLength(s) < 1)
return FALSE;
}
if (flags & CG_GLYPH_UNICODE_PRESENT)
- {
return Stream_SafeSeek(s, cache_glyph_v2->cGlyphs * 2);
- }
return TRUE;
}
const CACHE_GLYPH_V2_ORDER* cache_glyph_v2,
UINT16* flags)
{
- int i, inf;
+ UINT32 i, inf;
inf = update_approximate_cache_glyph_v2_order(cache_glyph_v2, flags);
if (!Stream_EnsureRemainingCapacity(s, inf))
((cache_glyph_v2->flags & 0x000F) << 4) |
((cache_glyph_v2->cGlyphs & 0x00FF) << 8);
- for (i = 0; i < (int) cache_glyph_v2->cGlyphs; i++)
+ for (i = 0; i < cache_glyph_v2->cGlyphs; i++)
{
UINT32 cb;
const GLYPH_DATA_V2* glyph = &cache_glyph_v2->glyphData[i];
hSrcBmp = (HGDI_BITMAP) hdcSrc->selectedObject;
hDstBmp = (HGDI_BITMAP) hdcDest->selectedObject;
+ if (!hDstBmp || !hSrcBmp)
+ return FALSE;
+
if (!freerdp_image_copy(hDstBmp->data, hDstBmp->format, hDstBmp->scanline,
nXDest, nYDest, nWidth, nHeight,
hSrcBmp->data, hSrcBmp->format, hSrcBmp->scanline,
if (!hdcDest || !hdcSrc)
return FALSE;
- /* D = (S & P) | (~S & D) */
+ /* D = (D ^ S) & (P ^ D) */
color = hdcDest->textColor;
for (y = 0; y < nHeight; y++)
UINT32 colorB = ReadColor(dstp, hdcDest->format);
colorA = ConvertColor(colorA, hdcSrc->format,
hdcDest->format, palette);
- dstColor = (colorA & color) | (~colorA & colorB);
+ dstColor = (colorB ^ colorA) & (color & colorB);
WriteColor(dstp, hdcDest->format, dstColor);
}
}
if (!(bitmap->hdc = gdi_CreateCompatibleDC(gdi->hdc)))
goto fail_hdc;
- DEBUG_GDI("gdi_bitmap_new: width:%d height:%d bpp:%d", width, height, bpp);
+ WLog_Print(gdi->log, WLOG_DEBUG, "gdi_bitmap_new: width:%d height:%d bpp:%d",
+ width, height, bpp);
if (!data)
bitmap->bitmap = gdi_CreateCompatibleBitmap(gdi->hdc, width, height);
BOOL ret;
gdi_CRgnToRect(opaque_rect->nLeftRect, opaque_rect->nTopRect,
opaque_rect->nWidth, opaque_rect->nHeight, &rect);
- WLog_INFO(TAG, "%s x=%lu, y=%lu, w=%lu, h=%lu",
- __FUNCTION__, opaque_rect->nLeftRect, opaque_rect->nTopRect,
- opaque_rect->nWidth, opaque_rect->nHeight);
if (!gdi_decode_color(gdi, opaque_rect->color, &brush_color, NULL))
return FALSE;
UINT32 brush_color;
rdpGdi* gdi = context->gdi;
BOOL ret = TRUE;
- WLog_INFO(TAG, "%s x=%lu, y=%lu, w=%lu, h=%lu",
- __FUNCTION__, multi_opaque_rect->nLeftRect, multi_opaque_rect->nTopRect,
- multi_opaque_rect->nWidth, multi_opaque_rect->nHeight);
if (!gdi_decode_color(gdi, multi_opaque_rect->color, &brush_color, NULL))
return FALSE;
if (!hBrush)
return FALSE;
- for (i = 1; i < multi_opaque_rect->numRectangles + 1; i++)
+ for (i = 0; i < multi_opaque_rect->numRectangles; i++)
{
const DELTA_RECT* rectangle = &multi_opaque_rect->rectangles[i];
gdi_CRgnToRect(rectangle->left, rectangle->top,
rectangle->width, rectangle->height, &rect);
- gdi_FillRect(gdi->drawing->hdc, &rect, hBrush);
+ ret = gdi_FillRect(gdi->drawing->hdc, &rect, hBrush);
+
+ if (!ret)
+ break;
}
gdi_DeleteObject((HGDIOBJECT) hBrush);
HGDI_PEN hPen;
UINT32 SrcFormat;
rdpGdi* gdi = context->gdi;
- WLog_INFO(TAG, "%s x=%lu, y=%lu, w=%lu, h=%lu",
- __FUNCTION__, lineTo->nXStart, lineTo->nYStart,
- lineTo->nXEnd, lineTo->nYEnd);
if (!gdi_decode_color(gdi, lineTo->backColor, &color, &SrcFormat))
return FALSE;
gdi_MoveToEx(gdi->drawing->hdc, x, y, NULL);
points = polyline->points;
- for (i = 0; i < (int) polyline->numDeltaEntries; i++)
+ for (i = 0; i < polyline->numDeltaEntries; i++)
{
x += points[i].x;
y += points[i].y;
- WLog_INFO(TAG, "%s x=%lu, y=%lu",
- __FUNCTION__, x, y);
gdi_LineTo(gdi->drawing->hdc, x, y);
gdi_MoveToEx(gdi->drawing->hdc, x, y, NULL);
}
static BOOL gdi_polygon_sc(rdpContext* context,
const POLYGON_SC_ORDER* polygon_sc)
{
- WLog_VRB(TAG, "%s: not implemented", __FUNCTION__);
- return TRUE;
+ WLog_WARN(TAG, "%s: not implemented", __FUNCTION__);
+ return FALSE;
}
static BOOL gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
{
- WLog_VRB(TAG, "%s: not implemented", __FUNCTION__);
- return TRUE;
+ WLog_WARN(TAG, "%s: not implemented", __FUNCTION__);
+ return FALSE;
}
static BOOL gdi_ellipse_sc(rdpContext* context,
const ELLIPSE_SC_ORDER* ellipse_sc)
{
- WLog_VRB(TAG, "%s: not implemented", __FUNCTION__);
- return TRUE;
+ WLog_WARN(TAG, "%s: not implemented", __FUNCTION__);
+ return FALSE;
}
static BOOL gdi_ellipse_cb(rdpContext* context,
const ELLIPSE_CB_ORDER* ellipse_cb)
{
- WLog_VRB(TAG, "%s: not implemented", __FUNCTION__);
- return TRUE;
+ WLog_WARN(TAG, "%s: not implemented", __FUNCTION__);
+ return FALSE;
}
static BOOL gdi_frame_marker(rdpContext* context,
BOOL gdi_surface_frame_marker(rdpContext* context,
const SURFACE_FRAME_MARKER* surfaceFrameMarker)
{
- DEBUG_GDI("frameId %d frameAction %d",
- surfaceFrameMarker->frameId,
- surfaceFrameMarker->frameAction);
+ WLog_Print(context->gdi->log, WLOG_DEBUG, "frameId %d frameAction %d",
+ surfaceFrameMarker->frameId,
+ surfaceFrameMarker->frameAction);
switch (surfaceFrameMarker->frameAction)
{
const SURFACE_BITS_COMMAND* cmd)
{
rdpGdi* gdi = context->gdi;
- DEBUG_GDI("destLeft %d destTop %d destRight %d destBottom %d "
- "bpp %d codecID %d width %d height %d length %d",
- cmd->destLeft, cmd->destTop, cmd->destRight, cmd->destBottom,
- cmd->bpp, cmd->codecID, cmd->width, cmd->height, cmd->bitmapDataLength);
+ WLog_Print(gdi->log, WLOG_DEBUG,
+ "destLeft %d destTop %d destRight %d destBottom %d "
+ "bpp %d codecID %d width %d height %d length %d",
+ cmd->destLeft, cmd->destTop, cmd->destRight, cmd->destBottom,
+ cmd->bpp, cmd->codecID, cmd->width, cmd->height, cmd->bitmapDataLength);
switch (cmd->codecID)
{
if (!gdi)
goto fail;
+ gdi->log = WLog_Get(TAG);
+
+ if (!gdi->log)
+ goto fail;
+
instance->context->gdi = gdi;
gdi->context = instance->context;
gdi->width = instance->settings->DesktopWidth;
gdi->height = instance->settings->DesktopHeight;
gdi->dstFormat = format;
/* default internal buffer format */
- WLog_INFO(TAG, "Local framebuffer format %s",
- GetColorFormatName(gdi->dstFormat));
- WLog_INFO(TAG, "Remote framebuffer format %s",
- GetColorFormatName(SrcFormat));
+ WLog_Print(gdi->log, WLOG_INFO, "Local framebuffer format %s",
+ GetColorFormatName(gdi->dstFormat));
+ WLog_Print(gdi->log, WLOG_INFO, "Remote framebuffer format %s",
+ GetColorFormatName(SrcFormat));
if (!(gdi->hdc = gdi_GetDC()))
goto fail;
if (!surface)
return ERROR_INTERNAL_ERROR;
- WLog_DBG(TAG, "TODO gdi_SurfaceCommand_Alpha: status: %d", status);
+ WLog_WARN(TAG, "TODO gdi_SurfaceCommand_Alpha: status: %d", status);
/* fill with green for now to distinguish from the rest */
if (!freerdp_image_fill(surface->data, surface->format, surface->scanline,
#include <freerdp/gdi/region.h>
#include <freerdp/gdi/bitmap.h>
+#include "clipping.h"
#include "drawing.h"
#include "brush.h"
#include "graphics.h"
BYTE* pSrcData;
BYTE* pDstData;
HGDI_BITMAP bitmap;
+
+ if (!gdi)
+ return NULL;
+
nDstStep = nWidth * GetBytesPerPixel(gdi->dstFormat);
pDstData = _aligned_malloc(nHeight * nDstStep, 16);
UINT32 width, UINT32 height, UINT32 bgcolor,
UINT32 fgcolor, BOOL fOpRedundant)
{
- GDI_RECT rect;
- HGDI_BRUSH brush;
- rdpGdi* gdi = context->gdi;
- BOOL ret = FALSE;
+ rdpGdi* gdi;
- if (!gdi_decode_color(gdi, bgcolor, &bgcolor, NULL))
+ if (!context || !context->gdi)
return FALSE;
- if (!gdi_decode_color(gdi, fgcolor, &fgcolor, NULL))
- return FALSE;
+ gdi = context->gdi;
- if (!(brush = gdi_CreateSolidBrush(fgcolor)))
+ if (!gdi->drawing || !gdi->drawing->hdc)
return FALSE;
- gdi_CRgnToRect(x, y, width, height, &rect);
-
- switch (fOpRedundant)
- {
- case 0:
- ret = gdi_FillRect(gdi->drawing->hdc, &rect, brush);
- break;
+ if (!gdi_decode_color(gdi, bgcolor, &bgcolor, NULL))
+ return FALSE;
- default:
- ret = TRUE;
- break;
- }
+ if (!gdi_decode_color(gdi, fgcolor, &fgcolor, NULL))
+ return FALSE;
- gdi_DeleteObject((HGDIOBJECT) brush);
- gdi->textColor = gdi_SetTextColor(gdi->drawing->hdc, bgcolor);
- return ret;
+ gdi_SetTextColor(gdi->drawing->hdc, fgcolor);
+ gdi_SetBkColor(gdi->drawing->hdc, bgcolor);
+ return gdi_SetClipRgn(gdi->drawing->hdc, x, y, width, height);
}
static BOOL gdi_Glyph_EndDraw(rdpContext* context, UINT32 x, UINT32 y,
UINT32 width, UINT32 height, UINT32 bgcolor, UINT32 fgcolor)
{
- rdpGdi* gdi = context->gdi;
- UINT32 SrcFormat = gdi_get_pixel_format(context->settings->ColorDepth, FALSE);
- bgcolor = ConvertColor(bgcolor, SrcFormat,
- gdi->drawing->hdc->format, &gdi->palette);
- gdi->textColor = gdi_SetTextColor(gdi->drawing->hdc, bgcolor);
+ rdpGdi* gdi;
+
+ if (!context || !context->gdi)
+ return FALSE;
+
+ gdi = context->gdi;
+
+ if (!gdi->drawing || !gdi->drawing->hdc)
+ return FALSE;
+
+ gdi_SetNullClipRgn(gdi->drawing->hdc);
return TRUE;
}
*/
static BOOL gdi_rop_color(UINT32 rop, BYTE* pixelPtr, UINT32 pen, UINT32 format)
{
- UINT32 pixel = ReadColor(pixelPtr, format);
+ UINT32 dstPixel;
+ const UINT32 srcPixel = ReadColor(pixelPtr, format);
switch (rop)
{
case GDI_R2_BLACK: /* LineTo_BLACK */
- pixel = GetColor(format, 0, 0, 0, 0xFF);
+ dstPixel = GetColor(format, 0, 0, 0, 0xFF);
break;
case GDI_R2_NOTMERGEPEN: /* LineTo_NOTMERGEPEN */
- pixel = ~(pixel | pen);
+ dstPixel = ~(srcPixel | pen);
break;
case GDI_R2_MASKNOTPEN: /* LineTo_MASKNOTPEN */
- pixel &= ~pen;
+ dstPixel = srcPixel & ~pen;
break;
case GDI_R2_NOTCOPYPEN: /* LineTo_NOTCOPYPEN */
- pixel = ~pen;
+ dstPixel = ~pen;
break;
case GDI_R2_MASKPENNOT: /* LineTo_MASKPENNOT */
- pixel = pen & ~pixel;
+ dstPixel = pen & ~srcPixel;
break;
case GDI_R2_NOT: /* LineTo_NOT */
- pixel = ~pixel;
+ dstPixel = ~srcPixel;
break;
case GDI_R2_XORPEN: /* LineTo_XORPEN */
- pixel = pixel ^ pen;
+ dstPixel = srcPixel ^ pen;
break;
case GDI_R2_NOTMASKPEN: /* LineTo_NOTMASKPEN */
- pixel = ~(pixel & pen);
+ dstPixel = ~(srcPixel & pen);
break;
case GDI_R2_MASKPEN: /* LineTo_MASKPEN */
- pixel &= pen;
+ dstPixel = srcPixel & pen;
break;
case GDI_R2_NOTXORPEN: /* LineTo_NOTXORPEN */
- pixel = ~(pixel ^ pen);
+ dstPixel = ~(srcPixel ^ pen);
break;
case GDI_R2_NOP: /* LineTo_NOP */
break;
case GDI_R2_MERGENOTPEN: /* LineTo_MERGENOTPEN */
- pixel |= ~pen;
+ dstPixel = srcPixel | ~pen;
break;
case GDI_R2_COPYPEN: /* LineTo_COPYPEN */
- pixel = pen;
+ dstPixel = pen;
break;
case GDI_R2_MERGEPENNOT: /* LineTo_MERGEPENNOT */
- pixel = pixel | ~pen;
+ dstPixel = srcPixel | ~pen;
break;
case GDI_R2_MERGEPEN: /* LineTo_MERGEPEN */
- pixel = pixel | pen;
+ dstPixel = srcPixel | pen;
break;
case GDI_R2_WHITE: /* LineTo_WHITE */
- pixel = GetColor(format, 0, 0, 0, 0);
+ dstPixel = GetColor(format, 0, 0, 0, 0xFF);
break;
default:
return FALSE;
}
- WriteColor(pixelPtr, format, pixel);
+ WriteColor(pixelPtr, format, dstPixel);
return TRUE;
}
BOOL gdi_LineTo(HGDI_DC hdc, UINT32 nXEnd, UINT32 nYEnd)
{
- UINT32 x, y;
- UINT32 x1, y1;
- UINT32 x2, y2;
- INT32 e, e2;
- INT32 dx, dy;
- INT32 sx, sy;
- INT32 bx1, by1;
- INT32 bx2, by2;
- HGDI_BITMAP bmp;
+ INT64 e2;
+ INT64 bx1, by1;
+ INT64 bx2, by2;
+ HGDI_BITMAP bmp = (HGDI_BITMAP) hdc->selectedObject;
UINT32 pen;
UINT32 rop2 = gdi_GetROP2(hdc);
- x1 = hdc->pen->posX;
- y1 = hdc->pen->posY;
- x2 = nXEnd;
- y2 = nYEnd;
- dx = (x1 > x2) ? x1 - x2 : x2 - x1;
- dy = (y1 > y2) ? y1 - y2 : y2 - y1;
- sx = (x1 < x2) ? 1 : -1;
- sy = (y1 < y2) ? 1 : -1;
- e = dx - dy;
- x = x1;
- y = y1;
- bmp = (HGDI_BITMAP) hdc->selectedObject;
+ UINT32 x1 = hdc->pen->posX;
+ UINT32 y1 = hdc->pen->posY;
+ UINT32 x2 = nXEnd;
+ UINT32 y2 = nYEnd;
+ INT64 dx = (x1 > x2) ? x1 - x2 : x2 - x1;
+ INT64 dy = (y1 > y2) ? y1 - y2 : y2 - y1;
+ INT64 sx = (x1 < x2) ? 1 : -1;
+ INT64 sy = (y1 < y2) ? 1 : -1;
+ INT64 e = dx - dy;
+ UINT32 x = x1;
+ UINT32 y = y1;
if (hdc->clip->null)
{
if (w > 0)
rect->right = x + w - 1;
+ else
+ WLog_ERR("xxxxxx", "");
if (h > 0)
rect->bottom = y + h - 1;
+ else
+ WLog_ERR("xxxxxx", "");
}
/**