mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 13:10:00 -07:00
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
This commit is contained in:
parent
7d36803fbe
commit
203479ee4d
1 changed files with 4 additions and 4 deletions
|
@ -202,9 +202,9 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class GDI32 {
|
public static class GDI32 {
|
||||||
[DllImport("gdi32", SetLastError=true)]
|
[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)]
|
[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)]
|
[DllImport("gdi32", SetLastError=true)]
|
||||||
public static extern SafeCompatibleDCHandle CreateCompatibleDC(SafeHandle hDC);
|
public static extern SafeCompatibleDCHandle CreateCompatibleDC(SafeHandle hDC);
|
||||||
[DllImport("gdi32", SetLastError=true)]
|
[DllImport("gdi32", SetLastError=true)]
|
||||||
|
@ -241,12 +241,12 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="target"></param>
|
/// <param name="target"></param>
|
||||||
/// <param name="source"></param>
|
/// <param name="source"></param>
|
||||||
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 (SafeDeviceContextHandle targetDC = target.getSafeDeviceContext()) {
|
||||||
using (SafeCompatibleDCHandle safeCompatibleDCHandle = CreateCompatibleDC(targetDC)) {
|
using (SafeCompatibleDCHandle safeCompatibleDCHandle = CreateCompatibleDC(targetDC)) {
|
||||||
using (SafeHBitmapHandle hBitmapHandle = new SafeHBitmapHandle(sourceBitmap.GetHbitmap())) {
|
using (SafeHBitmapHandle hBitmapHandle = new SafeHBitmapHandle(sourceBitmap.GetHbitmap())) {
|
||||||
using (SafeSelectObjectHandle selectObject = safeCompatibleDCHandle.SelectObject(hBitmapHandle)) {
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue