Skip to content

Commit

Permalink
Mark framebuffer reads from the dirty rect backing buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
nsgomez committed Oct 19, 2024
1 parent 8f5a632 commit 2b96989
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions scgl/cGDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ namespace nSCGL
void* secondaryWindow;
void* secondaryDeviceContext;
void* pixels;
void* lineBrush;
#endif

private:
Expand Down
1 change: 1 addition & 0 deletions scgl/cGDriver_Viewport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ namespace nSCGL

ShowWindow(secondaryHwnd, SW_SHOWNORMAL);
pixels = new char[3 * newMode.width * newMode.height];
lineBrush = CreateSolidBrush(RGB(255, 0, 0));
}
#endif

Expand Down
14 changes: 7 additions & 7 deletions scgl/ext/cGDriver_BufferRegions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,8 @@ namespace nSCGL
InvalidateRect((HWND)secondaryWindow, nullptr, TRUE);

PAINTSTRUCT ps;
DWORD dwError;
HDC hdc = BeginPaint((HWND)secondaryWindow, &ps);

dwError = GetLastError();

BITMAPINFO bm;
bm.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bm.bmiHeader.biWidth = width;
Expand All @@ -134,7 +131,7 @@ namespace nSCGL
bm.bmiColors->rgbRed = 255;
bm.bmiColors->rgbReserved = 0;

dwError = ::SetDIBitsToDevice(
::SetDIBitsToDevice(
hdc,
dstX0,
windowHeight - dstY1,
Expand All @@ -148,11 +145,14 @@ namespace nSCGL
&bm,
DIB_RGB_COLORS);

dwError = GetLastError();
RECT rect;
rect.left = srcX0;
rect.right = rect.left + width;
rect.top = windowHeight - dstY1;
rect.bottom = rect.top + height;

FrameRect(hdc, &rect, (HBRUSH)lineBrush);
EndPaint((HWND)secondaryWindow, &ps);

dwError = GetLastError();
}
#endif

Expand Down

0 comments on commit 2b96989

Please sign in to comment.