Author: MarkieB
Date: Mon Aug 31 09:17:22 2009
New Revision: 9525
URL:
http://source.netsurf-browser.org?rev=9525&view=rev
Log:
improve interactivity
Modified:
branches/MarkieB/windows/windows/gui.c
branches/MarkieB/windows/windows/plot.c
Modified: branches/MarkieB/windows/windows/gui.c
URL:
http://source.netsurf-browser.org/branches/MarkieB/windows/windows/gui.c?...
==============================================================================
--- branches/MarkieB/windows/windows/gui.c (original)
+++ branches/MarkieB/windows/windows/gui.c Mon Aug 31 09:17:22 2009
@@ -322,8 +322,14 @@
current_redraw_browser = bw;
nsws_plot_set_scale(bw->scale);
- doublebuffering = true;
- hdc = GetDC(w->main);
+/* doublebuffering = true;
+*/ hdc = GetDC(w->main);
+ if (w->bufferbm == NULL) {
+ w->bufferbm = CreateCompatibleBitmap(hdc, w->width,
+ w->height + w->voffset);
+ SelectObject(w->bufferdc, w->bufferbm);
+ }
+
if ((w->bufferbm == NULL) || (w->bufferdc == NULL) ||
(hdc == NULL))
@@ -333,10 +339,10 @@
content_redraw(c, -w->scrollx / w->bw->scale,
-w->scrolly / w->bw->scale,
w->width, w->height,
- w->redraw.left,
- w->redraw.top,
- w->redraw.right,
- w->redraw.bottom,
+ w->redraw.left - w->scrollx / w->bw->scale,
+ w->redraw.top - w->scrolly / w->bw->scale,
+ w->redraw.right - w->scrollx / w->bw->scale,
+ w->redraw.bottom - w->scrolly / w->bw->scale,
bw->scale, 0xFFFFFF);
if (doublebuffering)
/* blit buffer to screen */
@@ -1069,6 +1075,7 @@
w->redraw.bottom = MIN(ps.rcPaint.bottom, w->height);
redraw();
EndPaint(hwnd, &ps);
+ plot.clip(0, 0, w->width, w->height);
DWORD ret = DefWindowProc(hwnd, msg, wparam, lparam);
if (historyactive)
current_gui = NULL;
@@ -1781,10 +1788,10 @@
data->redraw.height));
if (w == NULL)
return;
- w->redraw.left = data->redraw.x;
- w->redraw.top = data->redraw.y;
- w->redraw.right = data->redraw.x + data->redraw.width;
- w->redraw.bottom = data->redraw.y + data->redraw.height;
+ w->redraw.left = (long)data->redraw.x;
+ w->redraw.top = (long)data->redraw.y;
+ w->redraw.right =(long)(data->redraw.x + data->redraw.width);
+ w->redraw.bottom = (long)(data->redraw.y + data->redraw.height);
redraw();
}
@@ -1837,13 +1844,19 @@
HideCaret(w->main);
SetCaretPos(p.x - w->requestscrollx, p.y - w->requestscrolly);
ShowCaret(w->main);
- RECT r;
+ RECT r, redraw;
r.top = w->voffset - 1;
r.bottom = w->voffset + w->height + 1;
r.left = 0;
r.right = w->width + 1;
ScrollWindowEx(w->main, - w->requestscrollx, - w->requestscrolly, &r,
- NULL, NULL, NULL, SW_INVALIDATE);
+ NULL, NULL, &redraw, SW_INVALIDATE);
+ gui_window_redraw(w, redraw.left + w->requestscrollx + w->scrollx,
+ redraw.top + w->requestscrolly + w->scrolly
+ - w->voffset,
+ redraw.right + w->requestscrollx + w->scrollx,
+ redraw.bottom + w->requestscrolly + w->scrolly
+ - w->voffset);
}
void gui_window_scroll_visible(struct gui_window *w, int x0, int y0,
Modified: branches/MarkieB/windows/windows/plot.c
URL:
http://source.netsurf-browser.org/branches/MarkieB/windows/windows/plot.c...
==============================================================================
--- branches/MarkieB/windows/windows/plot.c (original)
+++ branches/MarkieB/windows/windows/plot.c Mon Aug 31 09:17:22 2009
@@ -113,14 +113,16 @@
HPEN pen = ExtCreatePen(penstyle, style->stroke_width, &lb, 0, NULL);
if (pen == NULL) {
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ bak = SelectObject(hdc, (HGDIOBJ) pen);
if (bak == NULL) {
DeleteObject(pen);
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
RECT r;
@@ -173,7 +175,8 @@
clipr = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(clipr);
if (clipregion == NULL) {
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
COLORREF pencol = (DWORD)(style->stroke_colour & 0x00FFFFFF);
@@ -190,14 +193,16 @@
HPEN pen = ExtCreatePen(penstyle, style->stroke_width, &lb, 0, NULL);
if (pen == NULL) {
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ penbak = SelectObject(hdc, (HGDIOBJ) pen);
if (penbak == NULL) {
DeleteObject(clipregion);
DeleteObject(pen);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HBRUSH brush = CreateBrushIndirect(&lb1);
@@ -205,7 +210,8 @@
DeleteObject(clipregion);
SelectObject(hdc, penbak);
DeleteObject(pen);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ brushbak = SelectObject(hdc, (HGDIOBJ) brush);
@@ -214,7 +220,8 @@
SelectObject(hdc, penbak);
DeleteObject(pen);
DeleteObject(brush);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
RECT r;
@@ -257,7 +264,8 @@
clipr = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(clipr);
if (clipregion == NULL) {
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
COLORREF pencol = (DWORD)(style->fill_colour & 0x00FFFFFF);
@@ -265,14 +273,16 @@
HPEN pen = CreatePen(PS_GEOMETRIC | PS_NULL, 1, pencol);
if (pen == NULL) {
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HPEN penbak = SelectObject(hdc, pen);
if (penbak == NULL) {
DeleteObject(clipregion);
DeleteObject(pen);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HBRUSH brush = CreateSolidBrush(brushcol);
@@ -280,7 +290,8 @@
DeleteObject(clipregion);
SelectObject(hdc, penbak);
DeleteObject(pen);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HBRUSH brushbak = SelectObject(hdc, brush);
@@ -289,7 +300,8 @@
SelectObject(hdc, penbak);
DeleteObject(pen);
DeleteObject(brush);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
SetPolyFillMode(hdc, WINDING);
@@ -340,14 +352,16 @@
clipr = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(clipr);
if (clipregion == NULL) {
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HFONT fontbak, font = get_font(style);
if (font == NULL) {
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
int wlen;
@@ -407,7 +421,8 @@
clipr = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(clipr);
if (clipregion == NULL) {
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
@@ -416,14 +431,16 @@
HPEN pen = CreatePen(PS_GEOMETRIC | PS_SOLID, 1, col);
if (pen == NULL) {
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ penbak = SelectObject(hdc, (HGDIOBJ) pen);
if (penbak == NULL) {
DeleteObject(clipregion);
DeleteObject(pen);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HBRUSH brush = CreateSolidBrush(col);
@@ -431,7 +448,8 @@
DeleteObject(clipregion);
SelectObject(hdc, penbak);
DeleteObject(pen);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ brushbak = SelectObject(hdc, (HGDIOBJ) brush);
@@ -440,7 +458,8 @@
SelectObject(hdc, penbak);
DeleteObject(pen);
DeleteObject(brush);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
RECT r;
@@ -488,21 +507,24 @@
clipr = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(clipr);
if (clipregion == NULL) {
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
COLORREF col = (DWORD)(style->stroke_colour & 0x00FFFFFF);
HPEN pen = CreatePen(PS_GEOMETRIC | PS_SOLID, 1, col);
if (pen == NULL) {
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ penbak = SelectObject(hdc, (HGDIOBJ) pen);
if (penbak == NULL) {
DeleteObject(clipregion);
DeleteObject(pen);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
RECT r;
@@ -603,13 +625,15 @@
cliprect = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(cliprect);
if (clipregion == NULL) {
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HDC Memhdc = CreateCompatibleDC(hdc);
if (Memhdc == NULL) {
DeleteObject(clipregion);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
BITMAPINFOHEADER bmih;
@@ -645,7 +669,8 @@
if (bmi == NULL) {
DeleteObject(clipregion);
DeleteDC(Memhdc);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}
HBITMAP MemBMh = CreateCompatibleBitmap(
@@ -654,7 +679,8 @@
DeleteObject(clipregion);
free(bmi);
DeleteDC(Memhdc);
- ReleaseDC(current_hwnd, hdc);
+ if (!doublebuffering)
+ ReleaseDC(current_hwnd, hdc);
return false;
}