From 203479ee4d6082ab29a1252f919799269e6a0b96 Mon Sep 17 00:00:00 2001 From: RKrom Date: Sun, 17 Feb 2013 09:49:42 +0000 Subject: [PATCH] Fixed Bitblt wrapper, the wrong parameters were used. (P.S. On Windows 8 the bitblt seems slower than a normal DrawImage) git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2494 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- GreenshotPlugin/UnmanagedHelpers/GDI32.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/GreenshotPlugin/UnmanagedHelpers/GDI32.cs b/GreenshotPlugin/UnmanagedHelpers/GDI32.cs index 6087e1d8a..174a2f826 100644 --- a/GreenshotPlugin/UnmanagedHelpers/GDI32.cs +++ b/GreenshotPlugin/UnmanagedHelpers/GDI32.cs @@ -202,9 +202,9 @@ namespace GreenshotPlugin.UnmanagedHelpers { /// public static class GDI32 { [DllImport("gdi32", SetLastError=true)] - public static extern bool BitBlt(SafeHandle hObject, int nXDest, int nYDest, int nWidth, int nHeight, SafeHandle hdcSrc, int nXSrc, int nYSrc, CopyPixelOperation dwRop); + public static extern bool BitBlt(SafeHandle hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, SafeHandle hdcSrc, int nXSrc, int nYSrc, CopyPixelOperation dwRop); [DllImport("gdi32", SetLastError=true)] - public static extern bool StretchBlt(SafeHandle hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, SafeHandle hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, CopyPixelOperation dwRop); + private static extern bool StretchBlt(SafeHandle hdcDest, int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, SafeHandle hdcSrc, int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, CopyPixelOperation dwRop); [DllImport("gdi32", SetLastError=true)] public static extern SafeCompatibleDCHandle CreateCompatibleDC(SafeHandle hDC); [DllImport("gdi32", SetLastError=true)] @@ -241,12 +241,12 @@ namespace GreenshotPlugin.UnmanagedHelpers { /// /// /// - public static void BitBlt(this Graphics target, Bitmap sourceBitmap, Rectangle source, Point destination) { + public static void BitBlt(this Graphics target, Bitmap sourceBitmap, Rectangle source, Point destination, CopyPixelOperation rop) { using (SafeDeviceContextHandle targetDC = target.getSafeDeviceContext()) { using (SafeCompatibleDCHandle safeCompatibleDCHandle = CreateCompatibleDC(targetDC)) { using (SafeHBitmapHandle hBitmapHandle = new SafeHBitmapHandle(sourceBitmap.GetHbitmap())) { using (SafeSelectObjectHandle selectObject = safeCompatibleDCHandle.SelectObject(hBitmapHandle)) { - BitBlt(safeCompatibleDCHandle, destination.X, destination.Y, source.Width, source.Height, safeCompatibleDCHandle, source.Left, source.Top, CopyPixelOperation.SourceCopy); + BitBlt(targetDC, destination.X, destination.Y, source.Width, source.Height, safeCompatibleDCHandle, source.Left, source.Top, rop); } } }