/* * @implemented */ BOOL WINAPI DeleteDC(HDC hdc) { BOOL bResult = TRUE; PLDC pLDC = NULL; HANDLE hPrinter = NULL; ULONG hType = GDI_HANDLE_GET_TYPE(hdc); pLDC = GdiGetLDC(hdc); if (hType != GDILoObjType_LO_DC_TYPE) { return METADC_DeleteDC(hdc); } bResult = NtGdiDeleteObjectApp(hdc); if (bResult && pLDC) { DPRINT1("Delete the Local DC structure\n"); LocalFree( pLDC ); } if (hPrinter) fpClosePrinter(hPrinter); return bResult; }
/* * @implemented */ int WINAPI DrawEscape(HDC hDC, INT nEscape, INT cbInput, LPCSTR lpszInData) { if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_DC) return NtGdiDrawEscape(hDC, nEscape, cbInput, (LPSTR) lpszInData); if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_METADC) { PLDC pLDC = GdiGetLDC(hDC); if ( pLDC ) { if (pLDC->Flags & LDC_META_PRINT) { // if (nEscape != QUERYESCSUPPORT) // return EMFDRV_WriteEscape(hDC, nEscape, cbInput, lpszInData, EMR_DRAWESCAPE); return NtGdiDrawEscape(hDC, nEscape, cbInput, (LPSTR) lpszInData); } } SetLastError(ERROR_INVALID_HANDLE); } return 0; }
/* * @implemented */ BOOL WINAPI CancelDC(HDC hDC) { PDC_ATTR pDc_Attr; if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC && GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_METADC ) { PLDC pLDC = GdiGetLDC(hDC); if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } /* If a document has started set it to die. */ if (pLDC->Flags & LDC_INIT_DOCUMENT) pLDC->Flags |= LDC_KILL_DOCUMENT; return NtGdiCancelDC(hDC); } if (GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &pDc_Attr)) { pDc_Attr->ulDirty_ &= ~DC_PLAYMETAFILE; return TRUE; } return FALSE; }
/* * @implemented */ DWORD WINAPI SetLayout(HDC hdc, DWORD dwLayout) { #if 0 if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) return MFDRV_SetLayout( hdc, dwLayout); else { PLDC pLDC = GdiGetLDC(hdc); if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); return 0; } if (pLDC->iType == LDC_EMFLDC) { return EMFDRV_SetLayout( hdc, dwLayout); } } } #endif if (!GdiIsHandleValid((HGDIOBJ) hdc) || (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC)) return GDI_ERROR; return NtGdiSetLayout( hdc, -1, dwLayout); }
/* * @implemented */ HCOLORSPACE WINAPI SetColorSpace( HDC hDC, HCOLORSPACE hCS ) { HCOLORSPACE rhCS = GetColorSpace(hDC); if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_DC) { if (NtGdiSetColorSpace(hDC, hCS)) return rhCS; } #if 0 if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_METADC) { PLDC pLDC = GdiGetLDC(hDC); if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); return NULL; } if (pLDC->iType == LDC_EMFLDC) { return NULL; } } #endif return NULL; }
/* * @implemented */ BOOL WINAPI SetBrushOrgEx(HDC hdc, int nXOrg, int nYOrg, LPPOINT lppt) { PDC_ATTR Dc_Attr; #if 0 // Handle something other than a normal dc object. if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { PLDC pLDC = GdiGetLDC(hdc); if ( (pLDC == NULL) || (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC)) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } if (pLDC->iType == LDC_EMFLDC) { return EMFDRV_SetBrushOrg(hdc, nXOrg, nYOrg); // ReactOS only. } return FALSE; } #endif if (GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID)&Dc_Attr)) { PGDIBSSETBRHORG pgSBO; /* Does the caller want the current brush origin to be returned? */ if (lppt) { lppt->x = Dc_Attr->ptlBrushOrigin.x; lppt->y = Dc_Attr->ptlBrushOrigin.y; } /* Check if we have nothing to do */ if ((nXOrg == Dc_Attr->ptlBrushOrigin.x) && (nYOrg == Dc_Attr->ptlBrushOrigin.y)) return TRUE; /* Allocate a batch command buffer */ pgSBO = GdiAllocBatchCommand(hdc, GdiBCSetBrushOrg); if (pgSBO != NULL) { /* Set current brush origin in the DC attribute */ Dc_Attr->ptlBrushOrigin.x = nXOrg; Dc_Attr->ptlBrushOrigin.y = nYOrg; /* Setup the GDI batch command */ pgSBO->ptlBrushOrigin = Dc_Attr->ptlBrushOrigin; return TRUE; } } /* Fall back to the slower kernel path */ return NtGdiSetBrushOrg(hdc, nXOrg, nYOrg, lppt); }
/* * @unimplemented */ BOOL WINAPI SetViewportExtEx(HDC hdc, int nXExtent, int nYExtent, LPSIZE lpSize) { PDC_ATTR Dc_Attr; #if 0 if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) return MFDRV_SetViewportExtEx(); else { PLDC pLDC = GdiGetLDC(hdc); if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } if (pLDC->iType == LDC_EMFLDC) { return EMFDRV_SetViewportExtEx(); } } } #endif if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) { return FALSE; } if (lpSize) { lpSize->cx = Dc_Attr->szlViewportExt.cx; lpSize->cy = Dc_Attr->szlViewportExt.cy; } if ((Dc_Attr->szlViewportExt.cx == nXExtent) && (Dc_Attr->szlViewportExt.cy == nYExtent)) return TRUE; if ((Dc_Attr->iMapMode == MM_ISOTROPIC) || (Dc_Attr->iMapMode == MM_ANISOTROPIC)) { if (NtCurrentTeb()->GdiTebBatch.HDC == hdc) { if (Dc_Attr->ulDirty_ & DC_FONTTEXT_DIRTY) { NtGdiFlush(); // Sync up Dc_Attr from Kernel space. Dc_Attr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY); } } Dc_Attr->szlViewportExt.cx = nXExtent; Dc_Attr->szlViewportExt.cy = nYExtent; if (Dc_Attr->dwLayout & LAYOUT_RTL) NtGdiMirrorWindowOrg(hdc); Dc_Attr->flXform |= (PAGE_EXTENTS_CHANGED|INVALIDATE_ATTRIBUTES|DEVICE_TO_WORLD_INVALID); } return TRUE; }
/* * @unimplemented */ BOOL WINAPI SetWindowOrgEx(HDC hdc, int X, int Y, LPPOINT lpPoint) { #if 0 PDC_ATTR Dc_Attr; #if 0 if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) return MFDRV_SetWindowOrgEx(); else { PLDC pLDC = GdiGetLDC(hdc); if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } if (pLDC->iType == LDC_EMFLDC) { return EMFDRV_SetWindowOrgEx(); } } } #endif if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return FALSE; if (lpPoint) { lpPoint->x = Dc_Attr->ptlWindowOrg.x; lpPoint->y = Dc_Attr->ptlWindowOrg.y; } if ((Dc_Attr->ptlWindowOrg.x == X) && (Dc_Attr->ptlWindowOrg.y == Y)) return TRUE; if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hdc) { if (Dc_Attr->ulDirty_ & DC_FONTTEXT_DIRTY) { NtGdiFlush(); // Sync up Dc_Attr from Kernel space. Dc_Attr->ulDirty_ &= ~(DC_MODE_DIRTY|DC_FONTTEXT_DIRTY); } } Dc_Attr->ptlWindowOrg.x = X; Dc_Attr->lWindowOrgx = X; Dc_Attr->ptlWindowOrg.y = Y; if (Dc_Attr->dwLayout & LAYOUT_RTL) NtGdiMirrorWindowOrg(hdc); Dc_Attr->flXform |= (PAGE_XLATE_CHANGED|DEVICE_TO_WORLD_INVALID); return TRUE; #endif return NtGdiSetWindowOrgEx(hdc,X,Y,lpPoint); }
/* * @implemented * */ BOOL WINAPI OffsetWindowOrgEx(HDC hdc, int nXOffset, int nYOffset, LPPOINT lpPoint) { #if 0 PDC_ATTR Dc_Attr; #if 0 if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) return MFDRV_OffsetWindowOrgEx(hdc, nXOffset, nYOffset, lpPoint); else { PLDC pLDC = GdiGetLDC(hdc); if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } if (pLDC->iType == LDC_EMFLDC) { return EMFDRV_OffsetWindowOrgEx(hdc, nXOffset, nYOffset, lpPoint); } } } #endif if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return FALSE; if ( lpPoint ) { *lpPoint = (POINT)Dc_Attr->ptlWindowOrg; lpPoint->x = Dc_Attr->lWindowOrgx; } if ( nXOffset || nYOffset != nXOffset ) { if (NtCurrentTeb()->GdiTebBatch.HDC == (ULONG)hdc) { if (Dc_Attr->ulDirty_ & DC_MODE_DIRTY) { NtGdiFlush(); Dc_Attr->ulDirty_ &= ~DC_MODE_DIRTY; } } Dc_Attr->flXform |= (PAGE_XLATE_CHANGED|DEVICE_TO_WORLD_INVALID); Dc_Attr->ptlWindowOrg.x += nXOffset; Dc_Attr->ptlWindowOrg.y += nYOffset; Dc_Attr->lWindowOrgx += nXOffset; } return TRUE; #endif return NtGdiOffsetWindowOrgEx(hdc, nXOffset, nYOffset, lpPoint); }
/* * @implemented */ int WINAPI SetROP2(HDC hdc, int fnDrawMode) { PDC_ATTR Dc_Attr; INT Old_ROP2; #if 0 // Handle something other than a normal dc object. if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) return MFDRV_SetROP2( hdc, fnDrawMode); else { PLDC pLDC = GdiGetLDC(hdc); if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } if (pLDC->iType == LDC_EMFLDC) { return EMFDRV_SetROP2(( hdc, fnDrawMode); } return FALSE; } } #endif if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return FALSE; if (NtCurrentTeb()->GdiTebBatch.HDC == hdc) { if (Dc_Attr->ulDirty_ & DC_MODE_DIRTY) { NtGdiFlush(); Dc_Attr->ulDirty_ &= ~DC_MODE_DIRTY; } } Old_ROP2 = Dc_Attr->jROP2; Dc_Attr->jROP2 = fnDrawMode; return Old_ROP2; }
/* * @unimplemented */ BOOL WINAPI SetViewportOrgEx(HDC hdc, int X, int Y, LPPOINT lpPoint) { #if 0 PDC_ATTR Dc_Attr; #if 0 if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) return MFDRV_SetViewportOrgEx(); else { PLDC pLDC = GdiGetLDC(hdc); if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } if (pLDC->iType == LDC_EMFLDC) { return EMFDRV_SetViewportOrgEx(); } } } #endif if (!GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return FALSE; if (lpPoint) { lpPoint->x = Dc_Attr->ptlViewportOrg.x; lpPoint->y = Dc_Attr->ptlViewportOrg.y; if (Dc_Attr->dwLayout & LAYOUT_RTL) lpPoint->x = -lpPoint->x; } Dc_Attr->flXform |= (PAGE_XLATE_CHANGED|DEVICE_TO_WORLD_INVALID); if (Dc_Attr->dwLayout & LAYOUT_RTL) X = -X; Dc_Attr->ptlViewportOrg.x = X; Dc_Attr->ptlViewportOrg.y = Y; return TRUE; #endif return NtGdiSetViewportOrgEx(hdc,X,Y,lpPoint); }
/* * @implemented */ HDC WINAPI GdiConvertAndCheckDC(HDC hdc) { PLDC pldc; ULONG hType = GDI_HANDLE_GET_TYPE(hdc); if (hType == GDILoObjType_LO_DC_TYPE || hType == GDILoObjType_LO_METADC16_TYPE) return hdc; pldc = GdiGetLDC(hdc); if (pldc) { if (pldc->Flags & LDC_SAPCALLBACK) GdiSAPCallback(pldc); if (pldc->Flags & LDC_KILL_DOCUMENT) return NULL; if (pldc->Flags & LDC_STARTPAGE) StartPage(hdc); return hdc; } SetLastError(ERROR_INVALID_HANDLE); return NULL; }
/* * @implemented */ int WINAPI SetMetaRgn(HDC hDC) { if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_DC) return NtGdiSetMetaRgn(hDC); #if 0 PLDC pLDC = GdiGetLDC(hDC); if ( pLDC && GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_METADC ) { if (pLDC->iType == LDC_EMFLDC || EMFDRV_SetMetaRgn(hDC)) { return NtGdiSetMetaRgn(hDC); } else SetLastError(ERROR_INVALID_HANDLE); } #endif return ERROR; }
BOOL WINAPI ModifyWorldTransform( HDC hDC, CONST XFORM *Xform, DWORD iMode ) { #if 0 // Handle something other than a normal dc object. if (GDI_HANDLE_GET_TYPE(hDC) != GDI_OBJECT_TYPE_DC) { if (GDI_HANDLE_GET_TYPE(hDC) == GDI_OBJECT_TYPE_METADC) return FALSE; else { PLDC pLDC = GdiGetLDC(hDC); if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } if (pLDC->iType == LDC_EMFLDC) { if (iMode == MWT_MAX+1) if (!EMFDRV_SetWorldTransform( hDC, Xform) ) return FALSE; return EMFDRV_ModifyWorldTransform( hDC, Xform, iMode); // Ported from wine. } return FALSE; } } #endif PDC_ATTR Dc_Attr; if (!GdiGetHandleUserData((HGDIOBJ) hDC, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) return FALSE; /* Check that graphics mode is GM_ADVANCED */ if ( Dc_Attr->iGraphicsMode != GM_ADVANCED ) return FALSE; return NtGdiModifyWorldTransform(hDC, (CONST LPXFORM) Xform, iMode); }
/* * @implemented */ BOOL WINAPI ScaleWindowExtEx( HDC a0, int a1, int a2, int a3, int a4, LPSIZE a5 ) { #if 0 if (GDI_HANDLE_GET_TYPE(a0) != GDI_OBJECT_TYPE_DC) { if (GDI_HANDLE_GET_TYPE(a0) == GDI_OBJECT_TYPE_METADC) return MFDRV_; else { PLDC pLDC = GdiGetLDC(a0); if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } if (pLDC->iType == LDC_EMFLDC) { return EMFDRV_; } } } #endif if (!GdiIsHandleValid((HGDIOBJ) a0) || (GDI_HANDLE_GET_TYPE(a0) != GDI_OBJECT_TYPE_DC)) return FALSE; return NtGdiScaleWindowExtEx(a0, a1, a2, a3, a4, a5); }
/* * @unimplemented */ int WINAPI StretchDIBits( HDC hdc, int XDest, int YDest, int nDestWidth, int nDestHeight, int XSrc, int YSrc, int nSrcWidth, int nSrcHeight, CONST VOID *lpBits, CONST BITMAPINFO *lpBitsInfo, UINT iUsage, DWORD dwRop) { PDC_ATTR pDc_Attr; PBITMAPINFO pConvertedInfo = NULL; UINT ConvertedInfoSize = 0; INT LinesCopied = 0; UINT cjBmpScanSize = 0; PVOID pvSafeBits = NULL; BOOL Hit = FALSE; DPRINT("StretchDIBits %p : %p : %u\n", lpBits, lpBitsInfo, iUsage); #if 0 // Handle something other than a normal dc object. if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) return MFDRV_StretchBlt( hdc, XDest, YDest, nDestWidth, nDestHeight, XSrc, YSrc, nSrcWidth, nSrcHeight, lpBits, lpBitsInfo, iUsage, dwRop); else { PLDC pLDC = GdiGetLDC(hdc); if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); return 0; } if (pLDC->iType == LDC_EMFLDC) { return EMFDRV_StretchBlt(hdc, XDest, YDest, nDestWidth, nDestHeight, XSrc, YSrc, nSrcWidth, nSrcHeight, lpBits, lpBitsInfo, iUsage, dwRop); } return 0; } } #endif pConvertedInfo = ConvertBitmapInfo(lpBitsInfo, iUsage, &ConvertedInfoSize, FALSE); if (!pConvertedInfo) { return 0; } cjBmpScanSize = GdiGetBitmapBitsSize((BITMAPINFO *) pConvertedInfo); if (lpBits) { pvSafeBits = RtlAllocateHeap(GetProcessHeap(), 0, cjBmpScanSize); if (pvSafeBits) { _SEH2_TRY { RtlCopyMemory(pvSafeBits, lpBits, cjBmpScanSize); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { Hit = TRUE; } _SEH2_END if (Hit) { // We don't die, we continue on with a allocated safe pointer to kernel // space..... DPRINT1("StretchDIBits fail to read BitMapInfo: %p or Bits: %p & Size: %u\n", pConvertedInfo, lpBits, cjBmpScanSize); } DPRINT("StretchDIBits Allocate Bits %u!!!\n", cjBmpScanSize); } } if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID) & pDc_Attr)) { SetLastError(ERROR_INVALID_PARAMETER); return 0; } /* if ( !pDc_Attr || iUsage == DIB_PAL_COLORS || ((pConvertedInfo->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER)) && (pConvertedInfo->bmiHeader.biCompression == BI_JPEG || pConvertedInfo->bmiHeader.biCompression == BI_PNG )) )*/ { LinesCopied = NtGdiStretchDIBitsInternal(hdc, XDest, YDest, nDestWidth, nDestHeight, XSrc, YSrc, nSrcWidth, nSrcHeight, pvSafeBits, pConvertedInfo, (DWORD) iUsage, dwRop, ConvertedInfoSize, cjBmpScanSize, NULL); } if (pvSafeBits) RtlFreeHeap(RtlGetProcessHeap(), 0, pvSafeBits); if (lpBitsInfo != pConvertedInfo) RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo); return LinesCopied; }
/* * @implemented * */ INT WINAPI SetDIBitsToDevice( HDC hdc, int XDest, int YDest, DWORD Width, DWORD Height, int XSrc, int YSrc, UINT StartScan, UINT ScanLines, CONST VOID *Bits, CONST BITMAPINFO *lpbmi, UINT ColorUse) { PDC_ATTR pDc_Attr; PBITMAPINFO pConvertedInfo; UINT ConvertedInfoSize; INT LinesCopied = 0; UINT cjBmpScanSize = 0; BOOL Hit = FALSE; PVOID pvSafeBits = (PVOID) Bits; if (!ScanLines || !lpbmi || !Bits) return 0; if (ColorUse && ColorUse != DIB_PAL_COLORS && ColorUse != DIB_PAL_COLORS + 1) return 0; pConvertedInfo = ConvertBitmapInfo(lpbmi, ColorUse, &ConvertedInfoSize, FALSE); if (!pConvertedInfo) return 0; #if 0 // Handle something other than a normal dc object. if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { if (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC) return MFDRV_SetDIBitsToDevice( hdc, XDest, YDest, Width, Height, XSrc, YSrc, StartScan, ScanLines, Bits, lpbmi, ColorUse); else { PLDC pLDC = GdiGetLDC(hdc); if ( !pLDC ) { SetLastError(ERROR_INVALID_HANDLE); return 0; } if (pLDC->iType == LDC_EMFLDC) { return EMFDRV_SetDIBitsToDevice(hdc, XDest, YDest, Width, Height, XSrc, YSrc, StartScan, ScanLines, Bits, lpbmi, ColorUse); } return 0; } } #endif if ((pConvertedInfo->bmiHeader.biCompression == BI_RLE8) || (pConvertedInfo->bmiHeader.biCompression == BI_RLE4)) { /* For compressed data, we must set the whole thing */ StartScan = 0; ScanLines = pConvertedInfo->bmiHeader.biHeight; } cjBmpScanSize = DIB_BitmapMaxBitsSize((LPBITMAPINFO) lpbmi, ScanLines); pvSafeBits = RtlAllocateHeap(GetProcessHeap(), 0, cjBmpScanSize); if (pvSafeBits) { _SEH2_TRY { RtlCopyMemory(pvSafeBits, Bits, cjBmpScanSize); } _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER) { Hit = TRUE; } _SEH2_END if (Hit) { // We don't die, we continue on with a allocated safe pointer to kernel // space..... DPRINT1("SetDIBitsToDevice fail to read BitMapInfo: %p or Bits: %p & Size: %u\n", pConvertedInfo, Bits, cjBmpScanSize); } DPRINT("SetDIBitsToDevice Allocate Bits %u!!!\n", cjBmpScanSize); } if (!GdiGetHandleUserData(hdc, GDI_OBJECT_TYPE_DC, (PVOID) & pDc_Attr)) { SetLastError(ERROR_INVALID_PARAMETER); return 0; } /* if ( !pDc_Attr || // DC is Public ColorUse == DIB_PAL_COLORS || ((pConvertedInfo->bmiHeader.biSize >= sizeof(BITMAPINFOHEADER)) && (pConvertedInfo->bmiHeader.biCompression == BI_JPEG || pConvertedInfo->bmiHeader.biCompression == BI_PNG )) )*/ { LinesCopied = NtGdiSetDIBitsToDeviceInternal(hdc, XDest, YDest, Width, Height, XSrc, YSrc, StartScan, ScanLines, (LPBYTE) pvSafeBits, (LPBITMAPINFO) pConvertedInfo, ColorUse, cjBmpScanSize, ConvertedInfoSize, TRUE, NULL); } if (Bits != pvSafeBits) RtlFreeHeap(RtlGetProcessHeap(), 0, pvSafeBits); if (lpbmi != pConvertedInfo) RtlFreeHeap(RtlGetProcessHeap(), 0, pConvertedInfo); return LinesCopied; }
/* * @implemented */ BOOL WINAPI SetBrushOrgEx(HDC hdc, int nXOrg, int nYOrg, LPPOINT lppt) { PDC_ATTR Dc_Attr; #if 0 // Handle something other than a normal dc object. if (GDI_HANDLE_GET_TYPE(hdc) != GDI_OBJECT_TYPE_DC) { PLDC pLDC = GdiGetLDC(hdc); if ( (pLDC == NULL) || (GDI_HANDLE_GET_TYPE(hdc) == GDI_OBJECT_TYPE_METADC)) { SetLastError(ERROR_INVALID_HANDLE); return FALSE; } if (pLDC->iType == LDC_EMFLDC) { return EMFDRV_SetBrushOrg(hdc, nXOrg, nYOrg); // ReactOS only. } return FALSE; } #endif if (GdiGetHandleUserData((HGDIOBJ) hdc, GDI_OBJECT_TYPE_DC, (PVOID) &Dc_Attr)) { PTEB pTeb = NtCurrentTeb(); if (lppt) { lppt->x = Dc_Attr->ptlBrushOrigin.x; lppt->y = Dc_Attr->ptlBrushOrigin.y; } if ((nXOrg == Dc_Attr->ptlBrushOrigin.x) && (nYOrg == Dc_Attr->ptlBrushOrigin.y)) return TRUE; if(((pTeb->GdiTebBatch.HDC == NULL) || (pTeb->GdiTebBatch.HDC == hdc)) && ((pTeb->GdiTebBatch.Offset + sizeof(GDIBSSETBRHORG)) <= GDIBATCHBUFSIZE) && (!(Dc_Attr->ulDirty_ & DC_DIBSECTION)) ) { PGDIBSSETBRHORG pgSBO = (PGDIBSSETBRHORG)(&pTeb->GdiTebBatch.Buffer[0] + pTeb->GdiTebBatch.Offset); Dc_Attr->ptlBrushOrigin.x = nXOrg; Dc_Attr->ptlBrushOrigin.y = nYOrg; pgSBO->gbHdr.Cmd = GdiBCSetBrushOrg; pgSBO->gbHdr.Size = sizeof(GDIBSSETBRHORG); pgSBO->ptlBrushOrigin = Dc_Attr->ptlBrushOrigin; pTeb->GdiTebBatch.Offset += sizeof(GDIBSSETBRHORG); pTeb->GdiTebBatch.HDC = hdc; pTeb->GdiBatchCount++; DPRINT("Loading the Flush!! COUNT-> %lu\n", pTeb->GdiBatchCount); if (pTeb->GdiBatchCount >= GDI_BatchLimit) { DPRINT("Call GdiFlush!!\n"); NtGdiFlush(); DPRINT("Exit GdiFlush!!\n"); } return TRUE; } } return NtGdiSetBrushOrg(hdc,nXOrg,nYOrg,lppt); }