@@ -43,7 +43,7 @@ namespace Screen_Capture {
43
43
return Ret;
44
44
}
45
45
DUPL_RETURN GDIFrameProcessor::ProcessFrame (const Monitor ¤tmonitorinfo)
46
- {
46
+ {
47
47
auto Ret = DUPL_RETURN_SUCCESS;
48
48
49
49
ImageRect ret;
@@ -59,27 +59,25 @@ namespace Screen_Capture {
59
59
SelectObject (CaptureDC.DC , originalBmp);
60
60
return DUPL_RETURN::DUPL_RETURN_ERROR_EXPECTED; // likely a permission issue
61
61
}
62
- else {
63
62
64
- BITMAPINFOHEADER bi;
65
- memset (&bi, 0 , sizeof (bi));
63
+ BITMAPINFOHEADER bi;
64
+ memset (&bi, 0 , sizeof (bi));
66
65
67
- bi.biSize = sizeof (BITMAPINFOHEADER);
66
+ bi.biSize = sizeof (BITMAPINFOHEADER);
68
67
69
- bi.biWidth = ret.right ;
70
- bi.biHeight = -ret.bottom ;
71
- bi.biPlanes = 1 ;
72
- bi.biBitCount = sizeof (ImageBGRA) * 8 ; // always 32 bits damnit!!!
73
- bi.biCompression = BI_RGB;
74
- bi.biSizeImage = ((ret.right * bi.biBitCount + 31 ) / (sizeof (ImageBGRA) * 8 )) * sizeof (ImageBGRA) * ret.bottom ;
75
- GetDIBits (MonitorDC.DC , CaptureBMP.Bitmap , 0 , (UINT)ret.bottom , NewImageBuffer.get (), (BITMAPINFO *)&bi, DIB_RGB_COLORS);
76
- SelectObject (CaptureDC.DC , originalBmp);
77
- ProcessCapture (Data->ScreenCaptureData , *this , currentmonitorinfo, NewImageBuffer.get (), Width (SelectedMonitor)* sizeof (ImageBGRA));
78
- }
68
+ bi.biWidth = ret.right ;
69
+ bi.biHeight = -ret.bottom ;
70
+ bi.biPlanes = 1 ;
71
+ bi.biBitCount = sizeof (ImageBGRA) * 8 ; // always 32 bits damnit!!!
72
+ bi.biCompression = BI_RGB;
73
+ bi.biSizeImage = ((ret.right * bi.biBitCount + 31 ) / (sizeof (ImageBGRA) * 8 )) * sizeof (ImageBGRA) * ret.bottom ;
74
+ GetDIBits (MonitorDC.DC , CaptureBMP.Bitmap , 0 , (UINT)ret.bottom , NewImageBuffer.get (), (BITMAPINFO *)&bi, DIB_RGB_COLORS);
75
+ SelectObject (CaptureDC.DC , originalBmp);
76
+ ProcessCapture (Data->ScreenCaptureData , *this , currentmonitorinfo, NewImageBuffer.get (), Width (SelectedMonitor) * sizeof (ImageBGRA));
79
77
80
78
return Ret;
81
79
}
82
-
80
+
83
81
DUPL_RETURN GDIFrameProcessor::ProcessFrame (Window &selectedwindow)
84
82
{
85
83
auto Ret = DUPL_RETURN_SUCCESS;
@@ -102,29 +100,30 @@ namespace Screen_Capture {
102
100
auto left = -windowrect.ClientBorder .left ;
103
101
auto top = -windowrect.ClientBorder .top ;
104
102
105
- BOOL result = PrintWindow ((HWND)selectedwindow.Handle , CaptureDC.DC , PW_RENDERFULLCONTENT );
103
+ BOOL result = PrintWindow ((HWND)selectedwindow.Handle , CaptureDC.DC , PW_RENDERFULLCONTENT);
106
104
107
- if ( !result ) {
105
+ if (!result) {
108
106
result = BitBlt (CaptureDC.DC , left, top, ret.right , ret.bottom , MonitorDC.DC , 0 , 0 , SRCCOPY | CAPTUREBLT);
109
107
}
110
108
111
- if ( !result ) {
109
+ if (!result) {
112
110
// if the screen cannot be captured, return
113
111
SelectObject (CaptureDC.DC , originalBmp);
114
112
return DUPL_RETURN::DUPL_RETURN_ERROR_EXPECTED; // likely a permission issue
115
113
}
116
114
117
- // std::vector<HWND> childrenToComposite = CollectWindowsToComposite((HWND)selectedwindow.Handle);
115
+ // std::vector<HWND> childrenToComposite = CollectWindowsToComposite((HWND)selectedwindow.Handle);
118
116
//
119
117
// // list is ordered topmost to bottommost, so we visit them in reverse order to let painter's algorithm work
120
- // for ( auto child = childrenToComposite.rbegin(); child != childrenToComposite.rend(); child++ ) {
121
- // auto childRect = SL::Screen_Capture::GetWindowRect( *child );
118
+ // for ( auto child = childrenToComposite.rbegin(); child != childrenToComposite.rend(); child++ ) {
119
+ // auto childRect = SL::Screen_Capture::GetWindowRect( *child );
122
120
123
121
// HDC srcDC = GetWindowDC(*child);
124
122
125
123
// // if this fails we just won't composite this window, so continue with the others to get what we can
126
- // BOOL childBlitSuccess = BitBlt(CaptureDC.DC, childRect.ClientRect.left - windowrect.ClientRect.left, childRect.ClientRect.top - windowrect.ClientRect.top,
127
- // childRect.ClientRect.right - childRect.ClientRect.left, childRect.ClientRect.bottom - childRect.ClientRect.top,
124
+ // BOOL childBlitSuccess = BitBlt(CaptureDC.DC, childRect.ClientRect.left - windowrect.ClientRect.left, childRect.ClientRect.top -
125
+ // windowrect.ClientRect.top,
126
+ // childRect.ClientRect.right - childRect.ClientRect.left, childRect.ClientRect.bottom - childRect.ClientRect.top,
128
127
// srcDC, 0, 0,
129
128
// SRCCOPY | CAPTUREBLT);
130
129
// if ( !childBlitSuccess ) {
@@ -135,17 +134,17 @@ namespace Screen_Capture {
135
134
// }
136
135
137
136
BITMAPINFOHEADER bi;
138
- memset (&bi, 0 , sizeof (bi));
139
- bi.biSize = sizeof (BITMAPINFOHEADER);
137
+ memset (&bi, 0 , sizeof (bi));
138
+ bi.biSize = sizeof (BITMAPINFOHEADER);
140
139
bi.biWidth = Width (ret);
141
140
bi.biHeight = -Height (ret);
142
141
bi.biPlanes = 1 ;
143
142
bi.biBitCount = sizeof (ImageBGRA) * 8 ; // always 32 bits damnit!!!
144
143
bi.biCompression = BI_RGB;
145
- bi.biSizeImage = ((Width (ret) * bi.biBitCount + 31 ) / (sizeof (ImageBGRA) * 8 )) * sizeof (ImageBGRA) * Height (ret);
144
+ bi.biSizeImage = ((Width (ret) * bi.biBitCount + 31 ) / (sizeof (ImageBGRA) * 8 )) * sizeof (ImageBGRA) * Height (ret);
146
145
GetDIBits (MonitorDC.DC , CaptureBMP.Bitmap , 0 , (UINT)Height (ret), NewImageBuffer.get (), (BITMAPINFO *)&bi, DIB_RGB_COLORS);
147
146
SelectObject (CaptureDC.DC , originalBmp);
148
- ProcessCapture (Data->WindowCaptureData , *this , selectedwindow, NewImageBuffer.get (), Width (selectedwindow)* sizeof (ImageBGRA));
147
+ ProcessCapture (Data->WindowCaptureData , *this , selectedwindow, NewImageBuffer.get (), Width (selectedwindow) * sizeof (ImageBGRA));
149
148
150
149
return Ret;
151
150
}
0 commit comments