예제 #1
0
파일: 32bpp.c 프로젝트: johnsonyes/FreeRDP
static int BitBlt_PATPAINT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
{
	int x, y;
	uint32* srcp;
	uint32* dstp;
	uint32* patp;
	
	for (y = 0; y < nHeight; y++)
	{
		srcp = (uint32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
		dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

		if (dstp != 0)
		{
			for (x = 0; x < nWidth; x++)
			{
				patp = (uint32*) gdi_get_brush_pointer(hdcDest, x, y);
				*dstp = *dstp | (*patp | ~(*srcp));
				srcp++;
				dstp++;
			}
		}
	}
	
	return 0;
}
예제 #2
0
static int BitBlt_PATINVERT_16bpp(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
{
	int x, y;
	char *dstp;
	char *patp;
		
	for (y = 0; y < nHeight; y++)
	{
		dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

		if (dstp != 0)
		{
			for (x = 0; x < nWidth; x++)
			{
				patp = gdi_get_brush_pointer(hdcDest, x, y);
				
				*dstp = *patp ^ *dstp;
				patp++;
				dstp++;
					
				*dstp = *patp ^ *dstp;
				patp++;
				dstp++;
			}
		}
	}
	
	return 0;
}
예제 #3
0
파일: 8bpp.c 프로젝트: ArvidNorr/FreeRDP
static int BitBlt_PDxn_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
{
	int x, y;
	uint8* dstp;
	uint8* patp;

	for (y = 0; y < nHeight; y++)
	{
		dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

		if (dstp != 0)
		{
			for (x = 0; x < nWidth; x++)
			{
				patp = gdi_get_brush_pointer(hdcDest, x, y);

				*dstp = *dstp ^ ~(*patp);
				patp++;
				dstp++;
			}
		}
	}

	return 0;
}
예제 #4
0
파일: 8bpp.c 프로젝트: ArvidNorr/FreeRDP
static int BitBlt_MERGECOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
{
	int x, y;
	uint8* srcp;
	uint8* dstp;
	uint8* patp;
	
	for (y = 0; y < nHeight; y++)
	{
		srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
		dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

		if (dstp != 0)
		{
			for (x = 0; x < nWidth; x++)
			{
				patp = gdi_get_brush_pointer(hdcDest, x, y);
				
				*dstp = *srcp & *patp;
				patp++;
				srcp++;
				dstp++;
			}
		}
	}
	
	return 0;
}
예제 #5
0
static int BitBlt_MERGECOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
{
	int x, y;
	UINT16* srcp;
	UINT16* dstp;
	UINT16* patp;
	
	if (!hdcSrc || !hdcDest)
		return 1;

	for (y = 0; y < nHeight; y++)
	{
		srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
		dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

		if (dstp != 0)
		{
			for (x = 0; x < nWidth; x++)
			{
				patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y);
				*dstp = *srcp & *patp;
				srcp++;
				dstp++;
			}
		}
	}
	
	return 0;
}
예제 #6
0
파일: 32bpp.c 프로젝트: BUGgs/FreeRDP
static BOOL BitBlt_SPna_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
{
	int x, y;
	UINT32* srcp;
	UINT32* dstp;
	UINT32* patp;

	if (!hdcDest || !hdcSrc)
		return FALSE;

	for (y = 0; y < nHeight; y++)
	{
		srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
		dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

		if (dstp != 0)
		{
			for (x = 0; x < nWidth; x++)
			{
				patp = (UINT32*) gdi_get_brush_pointer(hdcDest, x, y);
				
				*dstp = *srcp & ~(*patp);
				srcp++;
				dstp++;
			}
		}
	}
	
	return TRUE;
}
예제 #7
0
파일: 8bpp.c 프로젝트: mbbush/FreeRDP
static BOOL BitBlt_MERGECOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
{
    int x, y;
    BYTE* srcp;
    BYTE* dstp;
    BYTE* patp;

    if (!hdcSrc || !hdcDest)
        return FALSE;

    for (y = 0; y < nHeight; y++)
    {
        srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

        if (dstp != 0)
        {
            for (x = 0; x < nWidth; x++)
            {
                patp = gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);

                *dstp = *srcp & *patp;
                patp++;
                srcp++;
                dstp++;
            }
        }
    }

    return TRUE;
}
예제 #8
0
파일: 16bpp.c 프로젝트: felfert/FreeRDP
static int BitBlt_SPna_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
{
	int x, y;
	uint16* srcp;
	uint16* dstp;
	uint16* patp;
	
	for (y = 0; y < nHeight; y++)
	{
		srcp = (uint16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
		dstp = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

		if (dstp != 0)
		{
			for (x = 0; x < nWidth; x++)
			{
				patp = (uint16*) gdi_get_brush_pointer(hdcDest, x, y);
				*dstp = *srcp & ~(*patp);
				srcp++;
				dstp++;
			}
		}
	}
	
	return 0;
}
예제 #9
0
파일: 16bpp.c 프로젝트: erbth/FreeRDP
static BOOL BitBlt_PATPAINT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
{
	int x, y;
	UINT16* srcp;
	UINT16* dstp;
	UINT16* patp;
	
	if (!hdcSrc || !hdcDest)
		return FALSE;

	for (y = 0; y < nHeight; y++)
	{
		srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
		dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

		if (dstp != 0)
		{
			for (x = 0; x < nWidth; x++)
			{
				patp = (UINT16*) gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);
				*dstp = *dstp | (*patp | ~(*srcp));
				srcp++;
				dstp++;
			}
		}
	}
	
	return TRUE;
}
예제 #10
0
static int BitBlt_PATCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
{
	int x, y, xOffset, yOffset;
	UINT16* dstp;
	UINT16* patp;
	UINT16 color16;

	if (hdcDest->brush->style == GDI_BS_SOLID)
	{
		color16 = gdi_get_color_16bpp(hdcDest, hdcDest->brush->color);

		for (y = 0; y < nHeight; y++)
		{
			dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					*dstp = color16;
					dstp++;
				}
			}
		}
	}
	else
	{
		/* align pattern to 8x8 grid to make sure transition
		between different pattern blocks are smooth */

		if (hdcDest->brush->style == GDI_BS_HATCHED)
		{
			xOffset = nXDest % 8;
			yOffset = nYDest % 8 + 2; // +2 added after comparison to mstsc
		}
		else
		{
			xOffset = 0;
			yOffset = 0;
		}
		for (y = 0; y < nHeight; y++)
		{
			dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x+xOffset, y+yOffset);
					*dstp = *patp;
					dstp++;
				}
			}
		}
	}

	return 0;
}
예제 #11
0
static int BitBlt_PSDPxax_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
{
	int x, y;
	UINT16* srcp;
	UINT16* dstp;
	UINT16* patp;
	UINT16 color16;

	if (!hdcSrc || !hdcDest)
		return 1;

	/* D = (S & D) | (~S & P) */

	if (hdcDest->brush->style == GDI_BS_SOLID)
	{
		color16 = gdi_get_color_16bpp(hdcDest, hdcDest->brush->color);
		patp = (UINT16*) &color16;

		for (y = 0; y < nHeight; y++)
		{
			srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
			dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					*dstp = (*srcp & *dstp) | (~(*srcp) & *patp);
					srcp++;
					dstp++;
				}
			}
		}
	}
	else
	{
		for (y = 0; y < nHeight; y++)
		{
			srcp = (UINT16*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
			dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y);
					*dstp = (*srcp & *dstp) | (~(*srcp) & *patp);
					srcp++;
					dstp++;
				}
			}
		}
	}

	return 0;
}
예제 #12
0
파일: 8bpp.c 프로젝트: mbbush/FreeRDP
static BOOL BitBlt_PSDPxax_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
{
    int x, y;
    BYTE* srcp;
    BYTE* dstp;
    BYTE* patp;
    BYTE color8;

    if (!hdcSrc || !hdcDest)
        return FALSE;

    /* D = (S & D) | (~S & P) */

    if (hdcDest->brush->style == GDI_BS_SOLID)
    {
        color8 = gdi_get_color_8bpp(hdcDest, hdcDest->brush->color);
        patp = (BYTE*) &color8;

        for (y = 0; y < nHeight; y++)
        {
            srcp = (BYTE*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
            dstp = (BYTE*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

            if (dstp != 0)
            {
                for (x = 0; x < nWidth; x++)
                {
                    *dstp = (*srcp & *dstp) | (~(*srcp) & *patp);
                    srcp++;
                    dstp++;
                }
            }
        }
    }
    else
    {
        for (y = 0; y < nHeight; y++)
        {
            srcp = (BYTE*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
            dstp = (BYTE*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

            if (dstp != 0)
            {
                for (x = 0; x < nWidth; x++)
                {
                    patp = (BYTE*) gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);
                    *dstp = (*srcp & *dstp) | (~(*srcp) & *patp);
                    srcp++;
                    dstp++;
                }
            }
        }
    }

    return TRUE;
}
예제 #13
0
파일: 32bpp.c 프로젝트: BUGgs/FreeRDP
static BOOL BitBlt_SPDSxax_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc)
{
	int x, y;
	UINT32* srcp;
	UINT32* dstp;
	UINT32* patp;
	UINT32 color32;

	if (!hdcDest || !hdcSrc)
		return FALSE;

	/* D = S ^ (P & (D ^ S)) */

	if (hdcDest->brush->style == GDI_BS_SOLID)
	{
		color32 = gdi_get_color_32bpp(hdcDest, hdcDest->brush->color);
		patp = (UINT32*) &color32;

		for (y = 0; y < nHeight; y++)
		{
			srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
			dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					*dstp = *srcp ^ (*patp & (*dstp ^ *srcp));
					srcp++;
					dstp++;
				}
			}
		}
	}
	else
	{
		for (y = 0; y < nHeight; y++)
		{
			srcp = (UINT32*) gdi_get_bitmap_pointer(hdcSrc, nXSrc, nYSrc + y);
			dstp = (UINT32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					patp = (UINT32*) gdi_get_brush_pointer(hdcDest, x, y);
					*dstp = *srcp ^ (*patp & (*dstp ^ *srcp));
					srcp++;
					dstp++;
				}
			}
		}
	}

	return TRUE;
}
예제 #14
0
파일: 16bpp.c 프로젝트: erbth/FreeRDP
static BOOL BitBlt_PATCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
{
	int x, y, xOffset, yOffset;
	UINT16* dstp;
	UINT16* patp;
	UINT16 color16;

	if (hdcDest->brush->style == GDI_BS_SOLID)
	{
		color16 = gdi_get_color_16bpp(hdcDest, hdcDest->brush->color);

		for (y = 0; y < nHeight; y++)
		{
			dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					*dstp = color16;
					dstp++;
				}
			}
		}
	}
	else
	{
		if (hdcDest->brush->style == GDI_BS_HATCHED)
		{
			xOffset = 0;
			yOffset = 2; // +2 added after comparison to mstsc
		}
		else
		{
			xOffset = 0;
			yOffset = 0;
		}
		for (y = 0; y < nHeight; y++)
		{
			dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					patp = (UINT16*) gdi_get_brush_pointer(hdcDest, nXDest + x + xOffset, nYDest + y + yOffset);
					*dstp = *patp;
					dstp++;
				}
			}
		}
	}

	return TRUE;
}
예제 #15
0
파일: gdi_16bpp.c 프로젝트: pykoder/FreeRDP
static int BitBlt_PATINVERT_16bpp(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
{
	int x, y;
	uint8 *dstp;
	uint8 *patp;
	uint8 colR, colG, colB;
	uint16 col;
	uint16 *dstp16;

	if(hdcDest->brush->style == BS_SOLID)
	{
		GetRGB(colR, colG, colB, hdcDest->brush->color);
		RGB_888_565(colR, colG, colB);
		col = RGB16(colR, colG, colB);
		for (y = 0; y < nHeight; y++)
		{
			dstp16 = (uint16*)gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp16 != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					*dstp16 ^= col;
					dstp16++;
				}
			}
		}
	}
	else
	{
		for (y = 0; y < nHeight; y++)
		{
			dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					patp = gdi_get_brush_pointer(hdcDest, x, y);
					
					*dstp = *patp ^ *dstp;
					patp++;
					dstp++;

					*dstp = *patp ^ *dstp;
					patp++;
					dstp++;
				}
			}
		}
	}
	
	return 0;
}
예제 #16
0
static int BitBlt_PATCOPY_16bpp(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
{
	int x, y;
	uint8 *dstp;
	uint8 *patp;
	uint16 color16;
	uint16 *dstp16;

	if(hdcDest->brush->style == BS_SOLID)
	{
		color16 = gdi_get_color_16bpp(hdcDest, hdcDest->brush->color);

		for (y = 0; y < nHeight; y++)
		{
			dstp16 = (uint16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp16 != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					*dstp16 = color16;
					dstp16++;
				}
			}
		}
	}
	else
	{
		for (y = 0; y < nHeight; y++)
		{
			dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					patp = gdi_get_brush_pointer(hdcDest, x, y);
					
					*dstp = *patp;
					patp++;
					dstp++;

					*dstp = *patp;
					patp++;
					dstp++;
				}
			}
		}
	}

	return 0;
}
예제 #17
0
파일: 16bpp.c 프로젝트: erbth/FreeRDP
static BOOL BitBlt_PATINVERT_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
{
	int x, y;
	UINT16* dstp;
	UINT16* patp;
	UINT16 color16;

	if (hdcDest->brush->style == GDI_BS_SOLID)
	{
		color16 = gdi_get_color_16bpp(hdcDest, hdcDest->brush->color);

		for (y = 0; y < nHeight; y++)
		{
			dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					*dstp ^= color16;
					dstp++;
				}
			}
		}
	}
	else
	{
		for (y = 0; y < nHeight; y++)
		{
			dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					patp = (UINT16*) gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);
					*dstp = *patp ^ *dstp;
					dstp++;
				}
			}
		}
	}
	
	return TRUE;
}
예제 #18
0
파일: 32bpp.c 프로젝트: johnsonyes/FreeRDP
static int BitBlt_PATINVERT_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
{
	int x, y;
	uint32* dstp;
	uint32* patp;
	uint32 color32;
		
	if(hdcDest->brush->style == GDI_BS_SOLID)
	{
		color32 = gdi_get_color_32bpp(hdcDest, hdcDest->brush->color);

		for (y = 0; y < nHeight; y++)
		{
			dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					*dstp ^= color32;
					dstp++;
				}
			}
		}
	}
	else
	{
		for (y = 0; y < nHeight; y++)
		{
			dstp = (uint32*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

			if (dstp != 0)
			{
				for (x = 0; x < nWidth; x++)
				{
					patp = (uint32*) gdi_get_brush_pointer(hdcDest, x, y);
					*dstp = *patp ^ *dstp;
					dstp++;
				}
			}
		}
	}
	
	return 0;
}
예제 #19
0
파일: 16bpp.c 프로젝트: erbth/FreeRDP
static BOOL BitBlt_PDxn_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
{
	int x, y;
	UINT16* dstp;
	UINT16* patp;

	for (y = 0; y < nHeight; y++)
	{
		dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

		if (dstp != 0)
		{
			for (x = 0; x < nWidth; x++)
			{
				patp = (UINT16*) gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);
				*dstp = *dstp ^ ~(*patp);
				dstp++;
			}
		}
	}

	return TRUE;
}
예제 #20
0
파일: 8bpp.c 프로젝트: mbbush/FreeRDP
static BOOL BitBlt_DPa_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
{
    int x, y;
    BYTE* dstp;
    BYTE* patp;

    for (y = 0; y < nHeight; y++)
    {
        dstp = gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

        if (dstp != 0)
        {
            for (x = 0; x < nWidth; x++)
            {
                patp = gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);

                *dstp = *dstp & *patp;
                dstp++;
            }
        }
    }

    return TRUE;
}
예제 #21
0
static int BitBlt_DPa_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight)
{
	int x, y;
	UINT16* dstp;
	UINT16* patp;

	for (y = 0; y < nHeight; y++)
	{
		dstp = (UINT16*) gdi_get_bitmap_pointer(hdcDest, nXDest, nYDest + y);

		if (dstp != 0)
		{
			for (x = 0; x < nWidth; x++)
			{
				patp = (UINT16*) gdi_get_brush_pointer(hdcDest, x, y);

				*dstp = *dstp & *patp;
				dstp++;
			}
		}
	}

	return 0;
}
예제 #22
0
static INLINE BOOL BitBlt_write(HGDI_DC hdcDest, HGDI_DC hdcSrc, UINT32 nXDest,
                                UINT32 nYDest, UINT32 nXSrc, UINT32 nYSrc, UINT32 x, UINT32 y,
                                BOOL useSrc, BOOL usePat, UINT32 style,
                                const char* rop, const gdiPalette* palette)
{
	UINT32 dstColor;
	UINT32 colorA;
	UINT32 colorB = 0;
	UINT32 colorC = 0;
	BYTE* dstp = gdi_get_bitmap_pointer(hdcDest, nXDest + x, nYDest + y);

	if (!dstp)
	{
		WLog_ERR(TAG, "dstp=%p", (void*) dstp);
		return FALSE;
	}

	colorA = ReadColor(dstp, hdcDest->format);

	if (useSrc)
	{
		const BYTE* srcp = gdi_get_bitmap_pointer(hdcSrc, nXSrc + x, nYSrc + y);

		if (!srcp)
		{
			WLog_ERR(TAG, "srcp=%p", (void*) srcp);
			return FALSE;
		}

		colorC = ReadColor(srcp, hdcSrc->format);
		colorC = FreeRDPConvertColor(colorC, hdcSrc->format, hdcDest->format, palette);
	}

	if (usePat)
	{
		switch (style)
		{
			case GDI_BS_SOLID:
				colorB = hdcDest->brush->color;
				break;

			case GDI_BS_HATCHED:
			case GDI_BS_PATTERN:
				{
					const BYTE* patp = gdi_get_brush_pointer(hdcDest, nXDest + x, nYDest + y);

					if (!patp)
					{
						WLog_ERR(TAG, "patp=%p", (void*) patp);
						return FALSE;
					}

					colorB = ReadColor(patp, hdcDest->format);
				}
				break;

			default:
				break;
		}
	}

	dstColor = process_rop(colorC, colorA, colorB, rop, hdcDest->format);
	return WriteColor(dstp, hdcDest->format, dstColor);
}