ref: 4ed08f439ac547b7e1b2864efda66c297348cce9
parent: 261a80f05dcfb2bc8fa98093a293abfc67f24394
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Tue Jun 21 19:39:51 EDT 2016
gui-win32: fix clipping code
--- a/gui-win32/screen.c
+++ b/gui-win32/screen.c
@@ -105,7 +105,6 @@
{
screenload(r, gscreen->depth, byteaddr(gscreen, ZP), ZP,
gscreen->width*sizeof(ulong));
-// Sleep(100);
}
void
@@ -125,15 +124,14 @@
*/
if(rectclip(&r, gscreen->r) == 0)
return;
+ if(GetWindowRect(window, &winr)==0)
+ return;
+ if(rectclip(&r, Rect(0, 0, winr.right-winr.left, winr.bottom-winr.top))==0)
+ return;
if((step&3) != 0 || ((pt.x*depth)%32) != 0 || ((ulong)p&3) != 0)
panic("screenload: bad params %d %d %ux", step, pt.x, p);
- dx = r.max.x - r.min.x;
- dy = r.max.y - r.min.y;
- if(dx <= 0 || dy <= 0)
- return;
-
if(depth == 24)
delx = r.min.x % 4;
else
@@ -141,11 +139,6 @@
p += (r.min.y-pt.y)*step;
p += ((r.min.x-delx-pt.x)*depth)>>3;
-
- if(GetWindowRect(window, &winr)==0)
- return;
- if(rectclip(&r, Rect(0, 0, winr.right-winr.left, winr.bottom-winr.top))==0)
- return;
lock(&gdilock);
@@ -153,9 +146,8 @@
SelectPalette(hdc, palette, 0);
RealizePalette(hdc);
-//FillRect(hdc,(void*)&r, GetStockObject(BLACK_BRUSH));
-//GdiFlush();
-//Sleep(100);
+ dx = r.max.x - r.min.x;
+ dy = r.max.y - r.min.y;
bmi->bmiHeader.biWidth = (step*8)/depth;
bmi->bmiHeader.biHeight = -dy; /* - => origin upper left */