Commit e25dca21 authored by Adi Shavit's avatar Adi Shavit

Fixed indentation.

parent d44e3c36
...@@ -1287,8 +1287,8 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam ) ...@@ -1287,8 +1287,8 @@ MainWindowProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
switch(uMsg) switch(uMsg)
{ {
case WM_COPY: case WM_COPY:
::WindowProc(hwnd, uMsg, wParam, lParam); // call highgui proc. There may be a better way to do this. ::WindowProc(hwnd, uMsg, wParam, lParam); // call highgui proc. There may be a better way to do this.
break; break;
case WM_DESTROY: case WM_DESTROY:
...@@ -1465,57 +1465,57 @@ static LRESULT CALLBACK HighGUIProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM ...@@ -1465,57 +1465,57 @@ static LRESULT CALLBACK HighGUIProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
// Upon any error we can jump out of the single-time while scope to clean up the resources. // Upon any error we can jump out of the single-time while scope to clean up the resources.
do do
{ {
if (!::EmptyClipboard()) if (!::EmptyClipboard())
break; break;
if(!window->image) if(!window->image)
break; break;
// Get window device context // Get window device context
if (0 == (hDC = ::GetDC(hwnd))) if (0 == (hDC = ::GetDC(hwnd)))
break; break;
// Create another DC compatible with hDC // Create another DC compatible with hDC
if (0 == (memDC = ::CreateCompatibleDC( hDC ))) if (0 == (memDC = ::CreateCompatibleDC( hDC )))
break; break;
// Determine the bitmap's dimensions // Determine the bitmap's dimensions
int nchannels = 3; int nchannels = 3;
SIZE size = {0,0}; SIZE size = {0,0};
icvGetBitmapData( window, &size, &nchannels, 0 ); icvGetBitmapData( window, &size, &nchannels, 0 );
// Create bitmap to draw on and it in the new DC // Create bitmap to draw on and it in the new DC
if (0 == (memBM = ::CreateCompatibleBitmap ( hDC, size.cx, size.cy))) if (0 == (memBM = ::CreateCompatibleBitmap ( hDC, size.cx, size.cy)))
break; break;
if (!::SelectObject( memDC, memBM )) if (!::SelectObject( memDC, memBM ))
break; break;
// Begin drawing to DC // Begin drawing to DC
if (!::SetStretchBltMode(memDC, COLORONCOLOR)) if (!::SetStretchBltMode(memDC, COLORONCOLOR))
break; break;
RGBQUAD table[256]; RGBQUAD table[256];
if( 1 == nchannels ) if( 1 == nchannels )
{ {
for(int i = 0; i < 256; ++i) for(int i = 0; i < 256; ++i)
{ {
table[i].rgbBlue = (unsigned char)i; table[i].rgbBlue = (unsigned char)i;
table[i].rgbGreen = (unsigned char)i; table[i].rgbGreen = (unsigned char)i;
table[i].rgbRed = (unsigned char)i; table[i].rgbRed = (unsigned char)i;
} }
if (!::SetDIBColorTable(window->dc, 0, 255, table)) if (!::SetDIBColorTable(window->dc, 0, 255, table))
break; break;
} }
// The image copied to the clipboard will be in its original size, regardless if the window itself was resized. // The image copied to the clipboard will be in its original size, regardless if the window itself was resized.
// Render the image to the dc/bitmap (at original size). // Render the image to the dc/bitmap (at original size).
if (!::BitBlt( memDC, 0, 0, size.cx, size.cy, window->dc, 0, 0, SRCCOPY )) if (!::BitBlt( memDC, 0, 0, size.cx, size.cy, window->dc, 0, 0, SRCCOPY ))
break; break;
// Finally, set bitmap to clipboard // Finally, set bitmap to clipboard
::SetClipboardData(CF_BITMAP, memBM); ::SetClipboardData(CF_BITMAP, memBM);
} while (0,0); // (0,0) instead of (0) to avoid MSVC compiler warning C4127: "conditional expression is constant" } while (0,0); // (0,0) instead of (0) to avoid MSVC compiler warning C4127: "conditional expression is constant"
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment