make windows frontend build and run again

Fix redraw bugs
Still major issue with frames

svn path=/trunk/netsurf/; revision=10880
This commit is contained in:
Vincent Sanders 2010-10-10 22:42:24 +00:00
parent 5738a8f342
commit 01c8552489
8 changed files with 1330 additions and 647 deletions

View File

@ -72,7 +72,7 @@ S_GTK := $(addprefix gtk/,$(S_GTK)) $(addprefix utils/,container.c)
# S_WINDOWS are sources purely for the windows build
S_WINDOWS := about.c bitmap.c download.c filetype.c findfile.c font.c \
gui.c localhistory.c login.c misc.c plot.c prefs.c schedule.c \
thumbnail.c tree.c
thumbnail.c tree.c windbg.c
S_WINDOWS := $(addprefix windows/,$(S_WINDOWS))
# S_BEOS are sources purely for the BeOS build

File diff suppressed because it is too large Load Diff

View File

@ -73,7 +73,6 @@ void nsws_localhistory_init(struct gui_window *w)
localhistory.height = 0;
current_gui = NULL;
current_hwnd = NULL;
doublebuffering = false;
if ((bw != NULL) && (bw->history != NULL))
history_size(bw->history, &(localhistory.width),
&(localhistory.height));

View File

@ -48,9 +48,7 @@
HWND current_hwnd;
struct gui_window *current_gui;
bool doublebuffering;
bool thumbnail = false;
HDC bufferdc;
static float nsws_plot_scale = 1.0;
static RECT localhistory_clip;
@ -82,7 +80,7 @@ static bool line(int x0, int y0, int x1, int y1, const plot_style_t *style)
{
#if NSWS_PLOT_DEBUG
LOG(("ligne from %d,%d to %d,%d thumbnail %d", x0, y0, x1, y1,
thumbnail));
thumbnail));
#endif
RECT *clipr = gui_window_clip_rect(current_gui);
if (clipr == NULL)
@ -92,7 +90,7 @@ static bool line(int x0, int y0, int x1, int y1, const plot_style_t *style)
return false;
}
HDC hdc = doublebuffering ? bufferdc : GetDC(current_hwnd);
HDC hdc = GetDC(current_hwnd);
if (hdc == NULL) {
DeleteObject(clipregion);
return false;
@ -100,23 +98,23 @@ static bool line(int x0, int y0, int x1, int y1, const plot_style_t *style)
COLORREF col = (DWORD)(style->stroke_colour & 0x00FFFFFF);
/* windows 0x00bbggrr */
DWORD penstyle = PS_GEOMETRIC | ((style->stroke_type ==
PLOT_OP_TYPE_DOT) ? PS_DOT :
(style->stroke_type == PLOT_OP_TYPE_DASH) ? PS_DASH:
0);
PLOT_OP_TYPE_DOT) ? PS_DOT :
(style->stroke_type == PLOT_OP_TYPE_DASH) ? PS_DASH:
0);
LOGBRUSH lb = {BS_SOLID, col, 0};
HPEN pen = ExtCreatePen(penstyle, style->stroke_width, &lb, 0, NULL);
if (pen == NULL) {
DeleteObject(clipregion);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ bak = SelectObject(hdc, (HGDIOBJ) pen);
if (bak == NULL) {
DeleteObject(pen);
DeleteObject(clipregion);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
RECT r;
@ -133,50 +131,51 @@ static bool line(int x0, int y0, int x1, int y1, const plot_style_t *style)
SelectClipRgn(hdc, NULL);
/* ValidateRect(current_hwnd, &r);
*/
*/
pen = SelectObject(hdc, bak);
DeleteObject(pen);
DeleteObject(clipregion);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return true;
}
static bool rectangle(int x0, int y0, int x1, int y1, const plot_style_t
*style)
*style)
{
x1++;
y1++;
x0 = MAX(x0, 0);
/* x0 = MAX(x0, 0);
y0 = MAX(y0, 0);
if (!((current_gui == NULL) || (thumbnail))) {
x1 = MIN(x1, gui_window_width(current_gui));
y1 = MIN(y1, gui_window_height(current_gui));
x1 = MIN(x1, gui_window_width(current_gui));
y1 = MIN(y1, gui_window_height(current_gui));
}
*/
#if NSWS_PLOT_DEBUG
LOG(("rectangle from %d,%d to %d,%d thumbnail %d", x0, y0, x1, y1,
thumbnail));
thumbnail));
#endif
HDC hdc = doublebuffering ? bufferdc : GetDC(current_hwnd);
HDC hdc = GetDC(current_hwnd);
if (hdc == NULL) {
return false;
}
RECT *clipr = gui_window_clip_rect(current_gui);
/* RECT *clipr = gui_window_clip_rect(current_gui);
if (clipr == NULL)
clipr = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(clipr);
if (clipregion == NULL) {
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
}
*/
COLORREF pencol = (DWORD)(style->stroke_colour & 0x00FFFFFF);
DWORD penstyle = PS_GEOMETRIC |
(style->stroke_type == PLOT_OP_TYPE_DOT ? PS_DOT :
(style->stroke_type == PLOT_OP_TYPE_DASH ? PS_DASH :
(style->stroke_type == PLOT_OP_TYPE_NONE ? PS_NULL :
0)));
(style->stroke_type == PLOT_OP_TYPE_DOT ? PS_DOT :
(style->stroke_type == PLOT_OP_TYPE_DASH ? PS_DASH :
(style->stroke_type == PLOT_OP_TYPE_NONE ? PS_NULL :
0)));
LOGBRUSH lb = {BS_SOLID, pencol, 0};
LOGBRUSH lb1 = {BS_SOLID, style->fill_colour, 0};
if (style->fill_type == PLOT_OP_TYPE_NONE)
@ -184,36 +183,36 @@ static bool rectangle(int x0, int y0, int x1, int y1, const plot_style_t
HPEN pen = ExtCreatePen(penstyle, style->stroke_width, &lb, 0, NULL);
if (pen == NULL) {
DeleteObject(clipregion);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
// DeleteObject(clipregion);
ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ penbak = SelectObject(hdc, (HGDIOBJ) pen);
if (penbak == NULL) {
DeleteObject(clipregion);
// DeleteObject(clipregion);
DeleteObject(pen);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
HBRUSH brush = CreateBrushIndirect(&lb1);
if (brush == NULL) {
DeleteObject(clipregion);
// DeleteObject(clipregion);
SelectObject(hdc, penbak);
DeleteObject(pen);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ brushbak = SelectObject(hdc, (HGDIOBJ) brush);
if (brushbak == NULL) {
DeleteObject(clipregion);
// DeleteObject(clipregion);
SelectObject(hdc, penbak);
DeleteObject(pen);
DeleteObject(brush);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
RECT r;
@ -222,20 +221,20 @@ static bool rectangle(int x0, int y0, int x1, int y1, const plot_style_t
r.right = x1;
r.bottom = y1;
SelectClipRgn(hdc, clipregion);
//SelectClipRgn(hdc, clipregion);
Rectangle(hdc, x0, y0, x1, y1);
SelectClipRgn(hdc, NULL);
//SelectClipRgn(hdc, NULL);
/* ValidateRect(current_hwnd, &r);
*/
*/
pen = SelectObject(hdc, penbak);
brush = SelectObject(hdc, brushbak);
DeleteObject(clipregion);
// DeleteObject(clipregion);
DeleteObject(pen);
DeleteObject(brush);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return true;
}
@ -247,7 +246,7 @@ static bool polygon(const int *p, unsigned int n, const plot_style_t *style)
#endif
POINT points[n];
unsigned int i;
HDC hdc = doublebuffering ? bufferdc : GetDC(current_hwnd);
HDC hdc = GetDC(current_hwnd);
if (hdc == NULL) {
return false;
}
@ -256,8 +255,8 @@ static bool polygon(const int *p, unsigned int n, const plot_style_t *style)
clipr = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(clipr);
if (clipregion == NULL) {
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
COLORREF pencol = (DWORD)(style->fill_colour & 0x00FFFFFF);
@ -265,16 +264,15 @@ static bool polygon(const int *p, unsigned int n, const plot_style_t *style)
HPEN pen = CreatePen(PS_GEOMETRIC | PS_NULL, 1, pencol);
if (pen == NULL) {
DeleteObject(clipregion);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
HPEN penbak = SelectObject(hdc, pen);
if (penbak == NULL) {
DeleteObject(clipregion);
DeleteObject(pen);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
HBRUSH brush = CreateSolidBrush(brushcol);
@ -282,8 +280,8 @@ static bool polygon(const int *p, unsigned int n, const plot_style_t *style)
DeleteObject(clipregion);
SelectObject(hdc, penbak);
DeleteObject(pen);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
HBRUSH brushbak = SelectObject(hdc, brush);
@ -292,8 +290,8 @@ static bool polygon(const int *p, unsigned int n, const plot_style_t *style)
SelectObject(hdc, penbak);
DeleteObject(pen);
DeleteObject(brush);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
SetPolyFillMode(hdc, WINDING);
@ -318,22 +316,22 @@ static bool polygon(const int *p, unsigned int n, const plot_style_t *style)
DeleteObject(clipregion);
DeleteObject(pen);
DeleteObject(brush);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
#if NSWS_PLOT_DEBUG
printf("\n");
printf("\n");
#endif
return true;
}
static bool text(int x, int y, const char *text, size_t length,
const plot_font_style_t *style)
const plot_font_style_t *style)
{
#if NSWS_PLOT_DEBUG
LOG(("words %s at %d,%d thumbnail %d", text, x, y, thumbnail));
#endif
HDC hdc = doublebuffering ? bufferdc : GetDC(current_hwnd);
HDC hdc = GetDC(current_hwnd);
if (hdc == NULL) {
return false;
}
@ -342,16 +340,15 @@ static bool text(int x, int y, const char *text, size_t length,
clipr = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(clipr);
if (clipregion == NULL) {
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
HFONT fontbak, font = get_font(style);
if (font == NULL) {
DeleteObject(clipregion);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
int wlen;
@ -385,13 +382,13 @@ static bool text(int x, int y, const char *text, size_t length,
SelectClipRgn(hdc, NULL);
/* ValidateRect(current_hwnd, &r);
*/
*/
free(wstring);
font = SelectObject(hdc, fontbak);
DeleteObject(clipregion);
DeleteObject(font);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return true;
}
@ -400,7 +397,7 @@ static bool disc(int x, int y, int radius, const plot_style_t *style)
#if NSWS_PLOT_DEBUG
LOG(("disc at %d,%d radius %d thumbnail %d", x, y, radius, thumbnail));
#endif
HDC hdc = doublebuffering ? bufferdc : GetDC(current_hwnd);
HDC hdc = GetDC(current_hwnd);
if (hdc == NULL) {
return false;
}
@ -409,26 +406,26 @@ static bool disc(int x, int y, int radius, const plot_style_t *style)
clipr = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(clipr);
if (clipregion == NULL) {
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
COLORREF col = (DWORD)((style->fill_colour | style->stroke_colour)
& 0x00FFFFFF);
& 0x00FFFFFF);
HPEN pen = CreatePen(PS_GEOMETRIC | PS_SOLID, 1, col);
if (pen == NULL) {
DeleteObject(clipregion);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ penbak = SelectObject(hdc, (HGDIOBJ) pen);
if (penbak == NULL) {
DeleteObject(clipregion);
DeleteObject(pen);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
HBRUSH brush = CreateSolidBrush(col);
@ -436,8 +433,8 @@ static bool disc(int x, int y, int radius, const plot_style_t *style)
DeleteObject(clipregion);
SelectObject(hdc, penbak);
DeleteObject(pen);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ brushbak = SelectObject(hdc, (HGDIOBJ) brush);
@ -446,8 +443,8 @@ static bool disc(int x, int y, int radius, const plot_style_t *style)
SelectObject(hdc, penbak);
DeleteObject(pen);
DeleteObject(brush);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
RECT r;
@ -460,32 +457,32 @@ static bool disc(int x, int y, int radius, const plot_style_t *style)
if (style->fill_type == PLOT_OP_TYPE_NONE)
Arc(hdc, x - radius, y - radius, x + radius, y + radius,
x - radius, y - radius,
x - radius, y - radius);
x - radius, y - radius,
x - radius, y - radius);
else
Ellipse(hdc, x - radius, y - radius, x + radius, y + radius);
SelectClipRgn(hdc, NULL);
/* ValidateRect(current_hwnd, &r);
*/
*/
pen = SelectObject(hdc, penbak);
brush = SelectObject(hdc, brushbak);
DeleteObject(clipregion);
DeleteObject(pen);
DeleteObject(brush);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return true;
}
static bool arc(int x, int y, int radius, int angle1, int angle2,
const plot_style_t *style)
const plot_style_t *style)
{
#if NSWS_PLOT_DEBUG
LOG(("arc centre %d,%d radius %d from %d to %d", x, y, radius,
angle1, angle2));
angle1, angle2));
#endif
HDC hdc = doublebuffering ? bufferdc : GetDC(current_hwnd);
HDC hdc = GetDC(current_hwnd);
if (hdc == NULL) {
return false;
}
@ -494,24 +491,24 @@ static bool arc(int x, int y, int radius, int angle1, int angle2,
clipr = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(clipr);
if (clipregion == NULL) {
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
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);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
HGDIOBJ penbak = SelectObject(hdc, (HGDIOBJ) pen);
if (penbak == NULL) {
DeleteObject(clipregion);
DeleteObject(pen);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
RECT r;
@ -576,32 +573,32 @@ static bool arc(int x, int y, int radius, int angle1, int angle2,
SelectClipRgn(hdc, clipregion);
Arc(hdc, x - radius, y - radius, x + radius, y + radius,
x + (int)(a1 * radius), y + (int)(b1 * radius),
x + (int)(a2 * radius), y + (int)(b2 * radius));
x + (int)(a1 * radius), y + (int)(b1 * radius),
x + (int)(a2 * radius), y + (int)(b2 * radius));
SelectClipRgn(hdc, NULL);
/* ValidateRect(current_hwnd, &r);
*/
*/
pen = SelectObject(hdc, penbak);
DeleteObject(clipregion);
DeleteObject(pen);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return true;
}
static bool bitmap(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg,
bitmap_flags_t flags)
struct bitmap *bitmap, colour bg,
bitmap_flags_t flags)
{
#if NSWS_PLOT_DEBUG
LOG(("%p bitmap %d,%d width %d height %d", current_hwnd, x, y, width,
height));
height));
#endif
if (bitmap == NULL)
return false;
HDC hdc = doublebuffering ? bufferdc : GetDC(current_hwnd);
HDC hdc = GetDC(current_hwnd);
if (hdc == NULL) {
return false;
}
@ -610,15 +607,14 @@ static bool bitmap(int x, int y, int width, int height,
cliprect = &localhistory_clip;
HRGN clipregion = CreateRectRgnIndirect(cliprect);
if (clipregion == NULL) {
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
HDC Memhdc = CreateCompatibleDC(hdc);
if (Memhdc == NULL) {
DeleteObject(clipregion);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
BITMAPINFOHEADER bmih;
@ -637,8 +633,8 @@ static bool bitmap(int x, int y, int width, int height,
if ((flags & BITMAPF_REPEAT_X) || (flags & BITMAPF_REPEAT_Y)) {
struct bitmap *prebitmap = bitmap_pretile(bitmap,
cliprect->right - x,
cliprect->bottom - y, flags);
cliprect->right - x,
cliprect->bottom - y, flags);
if (prebitmap == NULL)
return false;
if (modifying) {
@ -650,29 +646,29 @@ static bool bitmap(int x, int y, int width, int height,
}
BITMAP MemBM;
BITMAPINFO *bmi = (BITMAPINFO *) malloc(sizeof(BITMAPINFOHEADER) +
(bitmap->width * bitmap->height * 4));
(bitmap->width * bitmap->height * 4));
if (bmi == NULL) {
DeleteObject(clipregion);
DeleteDC(Memhdc);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
HBITMAP MemBMh = CreateCompatibleBitmap(
hdc, bitmap->width, bitmap->height);
hdc, bitmap->width, bitmap->height);
if (MemBMh == NULL){
DeleteObject(clipregion);
free(bmi);
DeleteDC(Memhdc);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return false;
}
/* save 'background' data for alpha channel work */
SelectObject(Memhdc, MemBMh);
BitBlt(Memhdc, 0, 0, bitmap->width, bitmap->height, hdc, x, y,
SRCCOPY);
SRCCOPY);
GetObject(MemBMh, sizeof(BITMAP), &MemBM);
bmih.biSize = sizeof(bmih);
@ -689,77 +685,77 @@ static bool bitmap(int x, int y, int width, int height,
bmi->bmiHeader = bmih;
GetDIBits(hdc, MemBMh, 0, bitmap->height, bmi->bmiColors, bmi,
DIB_RGB_COLORS);
DIB_RGB_COLORS);
/* then load 'foreground' bits from bitmap->pixdata */
width4 = bitmap->width * 4;
for (v = 0, vv = 0, vi = (bitmap->height - 1) * width4;
v < bitmap->height;
v++, vv += bitmap->width, vi -= width4) {
v < bitmap->height;
v++, vv += bitmap->width, vi -= width4) {
for (h = 0, hh = 0; h < bitmap->width; h++, hh += 4) {
alpha = bitmap->pixdata[vi + hh + 3];
/* multiplication of alpha value; subject to profiling could be optional */
if (alpha == 0xFF) {
bmi->bmiColors[vv + h].rgbBlue =
bitmap->pixdata[vi + hh + 2];
bitmap->pixdata[vi + hh + 2];
bmi->bmiColors[vv + h].rgbGreen =
bitmap->pixdata[vi + hh + 1];
bitmap->pixdata[vi + hh + 1];
bmi->bmiColors[vv + h].rgbRed =
bitmap->pixdata[vi + hh];
bitmap->pixdata[vi + hh];
} else if (alpha > 0) {
transparency = 0x100 - alpha;
bmi->bmiColors[vv + h].rgbBlue =
(bmi->bmiColors[vv + h].rgbBlue
* transparency +
(bitmap->pixdata[vi + hh + 2]) *
alpha) >> 8;
(bmi->bmiColors[vv + h].rgbBlue
* transparency +
(bitmap->pixdata[vi + hh + 2]) *
alpha) >> 8;
bmi->bmiColors[vv + h].rgbGreen =
(bmi->bmiColors[vv + h].
rgbGreen
* transparency +
(bitmap->pixdata[vi + hh + 1]) *
alpha) >> 8;
(bmi->bmiColors[vv + h].
rgbGreen
* transparency +
(bitmap->pixdata[vi + hh + 1]) *
alpha) >> 8;
bmi->bmiColors[vv + h].rgbRed =
(bmi->bmiColors[vv + h].rgbRed
* transparency +
bitmap->pixdata[vi + hh]
* alpha) >> 8;
(bmi->bmiColors[vv + h].rgbRed
* transparency +
bitmap->pixdata[vi + hh]
* alpha) >> 8;
}
/* alternative simple 2/3 stage alpha value handling */
/* if (bitmap->pixdata[vi + hh + 3] > 0xAA) {
bmi->bmiColors[vv + h].rgbBlue =
bitmap->pixdata[vi + hh + 2];
bmi->bmiColors[vv + h].rgbGreen =
bitmap->pixdata[vi + hh + 1];
bmi->bmiColors[vv + h].rgbRed =
bitmap->pixdata[vi + hh];
bmi->bmiColors[vv + h].rgbBlue =
bitmap->pixdata[vi + hh + 2];
bmi->bmiColors[vv + h].rgbGreen =
bitmap->pixdata[vi + hh + 1];
bmi->bmiColors[vv + h].rgbRed =
bitmap->pixdata[vi + hh];
} else if (bitmap->pixdata[vi + hh + 3] > 0x70){
bmi->bmiColors[vv + h].rgbBlue =
(bmi->bmiColors[vv + h].rgbBlue +
bitmap->pixdata[vi + hh + 2]) / 2;
bmi->bmiColors[vv + h].rgbRed =
(bmi->bmiColors[vv + h].rgbRed +
bitmap->pixdata[vi + hh]) / 2;
bmi->bmiColors[vv + h].rgbGreen =
(bmi->bmiColors[vv + h].rgbGreen +
bitmap->pixdata[vi + hh + 1]) / 2;
bmi->bmiColors[vv + h].rgbBlue =
(bmi->bmiColors[vv + h].rgbBlue +
bitmap->pixdata[vi + hh + 2]) / 2;
bmi->bmiColors[vv + h].rgbRed =
(bmi->bmiColors[vv + h].rgbRed +
bitmap->pixdata[vi + hh]) / 2;
bmi->bmiColors[vv + h].rgbGreen =
(bmi->bmiColors[vv + h].rgbGreen +
bitmap->pixdata[vi + hh + 1]) / 2;
} else if (bitmap->pixdata[vi + hh + 3] > 0x30){
bmi->bmiColors[vv + h].rgbBlue =
(bmi->bmiColors[vv + h].rgbBlue * 3 +
bitmap->pixdata[vi + hh + 2]) / 4;
bmi->bmiColors[vv + h].rgbRed =
(bmi->bmiColors[vv + h].rgbRed * 3 +
bitmap->pixdata[vi + hh]) / 4;
bmi->bmiColors[vv + h].rgbGreen =
(bmi->bmiColors[vv + h].rgbGreen * 3 +
bitmap->pixdata[vi + hh + 1]) / 4;
bmi->bmiColors[vv + h].rgbBlue =
(bmi->bmiColors[vv + h].rgbBlue * 3 +
bitmap->pixdata[vi + hh + 2]) / 4;
bmi->bmiColors[vv + h].rgbRed =
(bmi->bmiColors[vv + h].rgbRed * 3 +
bitmap->pixdata[vi + hh]) / 4;
bmi->bmiColors[vv + h].rgbGreen =
(bmi->bmiColors[vv + h].rgbGreen * 3 +
bitmap->pixdata[vi + hh + 1]) / 4;
}
*/ }
}
SetDIBitsToDevice(hdc, x, y, bitmap->width, bitmap->height,
0, 0, 0, bitmap->height, (const void *) bmi->bmiColors,
bmi, DIB_RGB_COLORS);
0, 0, 0, bitmap->height, (const void *) bmi->bmiColors,
bmi, DIB_RGB_COLORS);
r.left = x;
r.top = y;
@ -771,13 +767,13 @@ static bool bitmap(int x, int y, int width, int height,
}
/* ValidateRect(current_hwnd, &r);
*/ free(bmi);
*/ free(bmi);
/* SelectClipRgn(hdc, NULL);
*/ DeleteObject(clipregion);
*/ DeleteObject(clipregion);
DeleteObject(MemBMh);
DeleteDC(Memhdc);
if (!doublebuffering)
ReleaseDC(current_hwnd, hdc);
ReleaseDC(current_hwnd, hdc);
return true;
}

View File

@ -21,8 +21,6 @@
extern HWND current_hwnd;
extern struct gui_window *current_gui;
extern HDC bufferdc;
extern bool doublebuffering;
extern bool thumbnail;
void nsws_plot_set_scale(float s);

View File

@ -41,7 +41,7 @@ thumbnail_create(hlcache_handle *content,
BITMAPINFOHEADER bmih;
LOG(("creating thumbnail %p for url %s content %p", bitmap, url, content));
return false;
bmi = malloc(sizeof(BITMAPINFOHEADER) + (bitmap->width * bitmap->height * 4));
if (bmi == NULL) {
return false;
@ -59,7 +59,7 @@ thumbnail_create(hlcache_handle *content,
bmih.biClrUsed = 0;
bmih.biClrImportant = 0;
bmi->bmiHeader = bmih;
/*
doublebuffering = true;
if (bufferdc != NULL)
@ -85,9 +85,9 @@ thumbnail_create(hlcache_handle *content,
content_redraw(content, 0, 0, width, height, 0, 0,
width, height, 1.0, 0xFFFFFF);
thumbnail = false;
*/
/* scale bufferbm to minibm */
/*
minidc = CreateCompatibleDC(hdc);
if (minidc == NULL) {
doublebuffering = false;
@ -123,9 +123,9 @@ thumbnail_create(hlcache_handle *content,
return false;
}
SelectObject(minidc, minibm2);
*/
/* save data from minibm bmi */
GetDIBits(minidc, minibm, 0, 1 - bitmap->height,
/* GetDIBits(minidc, minibm, 0, 1 - bitmap->height,
bmi->bmiColors, bmi, DIB_RGB_COLORS);
pixdata = (uint8_t *)(bitmap->pixdata);
@ -147,4 +147,5 @@ thumbnail_create(hlcache_handle *content,
doublebuffering = false;
return true;
*/
}

612
windows/windbg.c Normal file
View File

@ -0,0 +1,612 @@
#include <stdio.h>
#include "windbg.h"
const char *msg_num_to_name(int msg)
{
static char str[256];
switch (msg) {
case 32768:
return "WM_APP";
case 6:
return "WM_ACTIVATE ";
case 28:
return "WM_ACTIVATEAPP ";
case 864:
return "WM_AFXFIRST ";
case 895:
return "WM_AFXLAST ";
case 780:
return "WM_ASKCBFORMATNAME ";
case 75:
return "WM_CANCELJOURNAL ";
case 31:
return "WM_CANCELMODE ";
case 533:
return "WM_CAPTURECHANGED ";
case 781:
return "WM_CHANGECBCHAIN ";
case 258:
return "WM_CHAR ";
case 47:
return "WM_CHARTOITEM ";
case 34:
return "WM_CHILDACTIVATE ";
case 771:
return "WM_CLEAR ";
case 16:
return "WM_CLOSE ";
case 273:
return "WM_COMMAND ";
case 68:
return "WM_COMMNOTIFY ";
case 65:
return "WM_COMPACTING ";
case 57:
return "WM_COMPAREITEM ";
case 123:
return "WM_CONTEXTMENU ";
case 769:
return "WM_COPY ";
case 74:
return "WM_COPYDATA ";
case 1:
return "WM_CREATE ";
case 309:
return "WM_CTLCOLORBTN ";
case 310:
return "WM_CTLCOLORDLG ";
case 307:
return "WM_CTLCOLOREDIT ";
case 308:
return "WM_CTLCOLORLISTBOX ";
case 306:
return "WM_CTLCOLORMSGBOX ";
case 311:
return "WM_CTLCOLORSCROLLBAR ";
case 312:
return "WM_CTLCOLORSTATIC ";
case 768:
return "WM_CUT ";
case 259:
return "WM_DEADCHAR ";
case 45:
return "WM_DELETEITEM ";
case 2:
return "WM_DESTROY ";
case 775:
return "WM_DESTROYCLIPBOARD ";
case 537:
return "WM_DEVICECHANGE ";
case 27:
return "WM_DEVMODECHANGE ";
case 126:
return "WM_DISPLAYCHANGE ";
case 776:
return "WM_DRAWCLIPBOARD ";
case 43:
return "WM_DRAWITEM ";
case 563:
return "WM_DROPFILES ";
case 10:
return "WM_ENABLE ";
case 22:
return "WM_ENDSESSION ";
case 289:
return "WM_ENTERIDLE ";
case 529:
return "WM_ENTERMENULOOP ";
case 561:
return "WM_ENTERSIZEMOVE ";
case 20:
return "WM_ERASEBKGND ";
case 530:
return "WM_EXITMENULOOP ";
case 562:
return "WM_EXITSIZEMOVE ";
case 29:
return "WM_FONTCHANGE ";
case 135:
return "WM_GETDLGCODE ";
case 49:
return "WM_GETFONT ";
case 51:
return "WM_GETHOTKEY ";
case 127:
return "WM_GETICON ";
case 36:
return "WM_GETMINMAXINFO ";
case 13:
return "WM_GETTEXT ";
case 14:
return "WM_GETTEXTLENGTH ";
case 856:
return "WM_HANDHELDFIRST ";
case 863:
return "WM_HANDHELDLAST ";
case 83:
return "WM_HELP ";
case 786:
return "WM_HOTKEY ";
case 276:
return "WM_HSCROLL ";
case 782:
return "WM_HSCROLLCLIPBOARD ";
case 39:
return "WM_ICONERASEBKGND ";
case 272:
return "WM_INITDIALOG ";
case 278:
return "WM_INITMENU ";
case 279:
return "WM_INITMENUPOPUP ";
case 0x00FF:
return "WM_INPUT ";
case 81:
return "WM_INPUTLANGCHANGE ";
case 80:
return "WM_INPUTLANGCHANGEREQUEST ";
case 256:
return "WM_KEYDOWN ";
case 257:
return "WM_KEYUP ";
case 8:
return "WM_KILLFOCUS ";
case 546:
return "WM_MDIACTIVATE ";
case 551:
return "WM_MDICASCADE ";
case 544:
return "WM_MDICREATE ";
case 545:
return "WM_MDIDESTROY ";
case 553:
return "WM_MDIGETACTIVE ";
case 552:
return "WM_MDIICONARRANGE ";
case 549:
return "WM_MDIMAXIMIZE ";
case 548:
return "WM_MDINEXT ";
case 564:
return "WM_MDIREFRESHMENU ";
case 547:
return "WM_MDIRESTORE ";
case 560:
return "WM_MDISETMENU ";
case 550:
return "WM_MDITILE ";
case 44:
return "WM_MEASUREITEM ";
case 0x003D:
return "WM_GETOBJECT ";
case 0x0127:
return "WM_CHANGEUISTATE ";
case 0x0128:
return "WM_UPDATEUISTATE ";
case 0x0129:
return "WM_QUERYUISTATE ";
case 0x0125:
return "WM_UNINITMENUPOPUP ";
case 290:
return "WM_MENURBUTTONUP ";
case 0x0126:
return "WM_MENUCOMMAND ";
case 0x0124:
return "WM_MENUGETOBJECT ";
case 0x0123:
return "WM_MENUDRAG ";
case 0x0319:
return "WM_APPCOMMAND ";
case 288:
return "WM_MENUCHAR ";
case 287:
return "WM_MENUSELECT ";
case 531:
return "WM_NEXTMENU ";
case 3:
return "WM_MOVE ";
case 534:
return "WM_MOVING ";
case 134:
return "WM_NCACTIVATE ";
case 131:
return "WM_NCCALCSIZE ";
case 129:
return "WM_NCCREATE ";
case 130:
return "WM_NCDESTROY ";
case 132:
return "WM_NCHITTEST ";
case 163:
return "WM_NCLBUTTONDBLCLK ";
case 161:
return "WM_NCLBUTTONDOWN ";
case 162:
return "WM_NCLBUTTONUP ";
case 169:
return "WM_NCMBUTTONDBLCLK ";
case 167:
return "WM_NCMBUTTONDOWN ";
case 168:
return "WM_NCMBUTTONUP ";
case 171:
return "WM_NCXBUTTONDOWN ";
case 172:
return "WM_NCXBUTTONUP ";
case 173:
return "WM_NCXBUTTONDBLCLK ";
case 0x02A0:
return "WM_NCMOUSEHOVER ";
case 0x02A2:
return "WM_NCMOUSELEAVE ";
case 160:
return "WM_NCMOUSEMOVE ";
case 133:
return "WM_NCPAINT ";
case 166:
return "WM_NCRBUTTONDBLCLK ";
case 164:
return "WM_NCRBUTTONDOWN ";
case 165:
return "WM_NCRBUTTONUP ";
case 40:
return "WM_NEXTDLGCTL ";
case 78:
return "WM_NOTIFY ";
case 85:
return "WM_NOTIFYFORMAT ";
case 0:
return "WM_NULL ";
case 15:
return "WM_PAINT ";
case 777:
return "WM_PAINTCLIPBOARD ";
case 38:
return "WM_PAINTICON ";
case 785:
return "WM_PALETTECHANGED ";
case 784:
return "WM_PALETTEISCHANGING ";
case 528:
return "WM_PARENTNOTIFY ";
case 770:
return "WM_PASTE ";
case 896:
return "WM_PENWINFIRST ";
case 911:
return "WM_PENWINLAST ";
case 72:
return "WM_POWER ";
case 536:
return "WM_POWERBROADCAST ";
case 791:
return "WM_PRINT ";
case 792:
return "WM_PRINTCLIENT ";
case 55:
return "WM_QUERYDRAGICON ";
case 17:
return "WM_QUERYENDSESSION ";
case 783:
return "WM_QUERYNEWPALETTE ";
case 19:
return "WM_QUERYOPEN ";
case 35:
return "WM_QUEUESYNC ";
case 18:
return "WM_QUIT ";
case 774:
return "WM_RENDERALLFORMATS ";
case 773:
return "WM_RENDERFORMAT ";
case 32:
return "WM_SETCURSOR ";
case 7:
return "WM_SETFOCUS ";
case 48:
return "WM_SETFONT ";
case 50:
return "WM_SETHOTKEY ";
case 128:
return "WM_SETICON ";
case 11:
return "WM_SETREDRAW ";
case 12:
return "WM_SETTEXT ";
case 26:
return "WM_SETTINGCHANGE ";
case 24:
return "WM_SHOWWINDOW ";
case 5:
return "WM_SIZE ";
case 779:
return "WM_SIZECLIPBOARD ";
case 532:
return "WM_SIZING ";
case 42:
return "WM_SPOOLERSTATUS ";
case 125:
return "WM_STYLECHANGED ";
case 124:
return "WM_STYLECHANGING ";
case 262:
return "WM_SYSCHAR ";
case 21:
return "WM_SYSCOLORCHANGE ";
case 274:
return "WM_SYSCOMMAND ";
case 263:
return "WM_SYSDEADCHAR ";
case 260:
return "WM_SYSKEYDOWN ";
case 261:
return "WM_SYSKEYUP ";
case 82:
return "WM_TCARD ";
case 794:
return "WM_THEMECHANGED ";
case 30:
return "WM_TIMECHANGE ";
case 275:
return "WM_TIMER ";
case 772:
return "WM_UNDO ";
case 1024:
return "WM_USER ";
case 84:
return "WM_USERCHANGED ";
case 46:
return "WM_VKEYTOITEM ";
case 277:
return "WM_VSCROLL ";
case 778:
return "WM_VSCROLLCLIPBOARD ";
case 71:
return "WM_WINDOWPOSCHANGED ";
case 70:
return "WM_WINDOWPOSCHANGING ";
case 264:
return "WM_KEYLAST ";
case 136:
return "WM_SYNCPAINT ";
case 33:
return "WM_MOUSEACTIVATE ";
case 512:
return "WM_MOUSEMOVE ";
case 513:
return "WM_LBUTTONDOWN ";
case 514:
return "WM_LBUTTONUP ";
case 515:
return "WM_LBUTTONDBLCLK ";
case 516:
return "WM_RBUTTONDOWN ";
case 517:
return "WM_RBUTTONUP ";
case 518:
return "WM_RBUTTONDBLCLK ";
case 519:
return "WM_MBUTTONDOWN ";
case 520:
return "WM_MBUTTONUP ";
case 521:
return "WM_MBUTTONDBLCLK ";
case 522:
return "WM_MOUSEWHEEL ";
case 523:
return "WM_XBUTTONDOWN ";
case 524:
return "WM_XBUTTONUP ";
case 525:
return "WM_XBUTTONDBLCLK ";
case 0x2A1:
return "WM_MOUSEHOVER ";
case 0x2A3:
return "WM_MOUSELEAVE ";
}
sprintf(str,"%d",msg);
return str;
}

1
windows/windbg.h Normal file
View File

@ -0,0 +1 @@
const char *msg_num_to_name(int msg);