Jeff 2 anni fa
parent
commit
9872289b74
1 ha cambiato i file con 4 aggiunte e 5 eliminazioni
  1. 4 5
      GameAssist/GameAssist/ImgAssist.cpp

+ 4 - 5
GameAssist/GameAssist/ImgAssist.cpp

@@ -110,7 +110,7 @@ namespace ImgAssist
 		int height = rcc.bottom - rcc.top;
 		int dx = rc.right - rc.left - width;
 		int dy = rc.bottom - rc.top - height;
-		// 创建兼容位图;
+		// 创建窗口DC的颜色位图(创建颜色位图必须使用创建兼容DC的DC,即窗口DC);
 		hbmpWindow = ::CreateCompatibleBitmap(hdcWindow, width, height);
 		// 将位图选入兼容DC;
 		SelectObject(hdcMemDC, hbmpWindow);
@@ -159,10 +159,7 @@ namespace ImgAssist
 
 		// Gets the "bits" from the bitmap, and copies them into a buffer 
 		// that's pointed to by lpbitmap.
-		GetDIBits(hdcMemDC, hbmpWindow, 0,
-			(UINT)bmpWindow.bmHeight,
-			lpbitmap,
-			(BITMAPINFO*)&bi, DIB_RGB_COLORS);
+		GetDIBits(hdcMemDC, hbmpWindow, 0, (UINT)bmpWindow.bmHeight, lpbitmap, (BITMAPINFO*)&bi, DIB_RGB_COLORS);
 
 		// Add the size of the headers to the size of the bitmap to get the total file size.
 		dwSizeofDIB = dwBmpSize + sizeof(BITMAPFILEHEADER) + sizeof(BITMAPINFOHEADER);
@@ -371,7 +368,9 @@ namespace ImgAssist
 
 		// 指定源图片区域来做模块比较,提高效率;
 		cv::Mat imgROI = cvSrcImg(cv::Rect(srcRect.left, srcRect.top, srcRect.right - srcRect.left, srcRect.bottom - srcRect.top));
+#ifdef DEBUG
 		cv::imwrite(GameGlobal::BuildImgPath(NULL, _T("roi")), imgROI);
+#endif
 		/*
 		m_ImgROI = srcImg([&]()-> cv::Rect {
 			// 注意是x,y,w=cols,h=rows