Rev 8491 | Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8462 | leency | 1 | CANVAS canvas; |
2 | |||
3 | void TWebBrowser::Render() |
||
4 | { |
||
5 | unsigned px; //paint x coordinate |
||
6 | unsigned pw; //paint y coordinate |
||
7 | dword pc; //paint color |
||
8 | int zoom; |
||
9 | |||
10 | if (style.title) |
||
11 | { |
||
12 | strncpy(#header, #line, sizeof(TWebBrowser.header)-1); |
||
13 | strncat(#header, " - ", sizeof(TWebBrowser.header)-1); |
||
14 | strncat(#header, #version, sizeof(TWebBrowser.header)-1); |
||
15 | line = 0; |
||
16 | return; |
||
17 | } |
||
18 | if (t_html) && (!t_body) { |
||
19 | line = 0; |
||
20 | return; |
||
21 | } |
||
22 | |||
23 | if (line) |
||
24 | { |
||
25 | pw = strlen(#line) * list.font_w; |
||
26 | zoom = list.font_w / BASIC_CHAR_W; |
||
27 | |||
28 | style.cur_line_h = math.max(style.cur_line_h, list.item_h); |
||
29 | |||
30 | if (bg_colors.get_last() - bg_colors.get(0)) { |
||
31 | canvas.DrawBar(draw_x, draw_y, pw, list.item_h, bg_colors.get_last()); |
||
32 | } |
||
33 | |||
34 | if (style.image) { |
||
35 | canvas.DrawBar(draw_x, draw_y, pw, list.item_h-1, 0xF9DBCB); |
||
36 | } |
||
37 | if (style.button) { |
||
38 | canvas.DrawBar(draw_x, draw_y, pw, list.item_h - calc(zoom*2), 0xCCCccc); |
||
39 | canvas.DrawBar(draw_x, draw_y + list.item_h - calc(zoom*2), pw, zoom, 0x999999); |
||
40 | } |
||
41 | |||
42 | pc = text_colors.get_last(); |
||
43 | if (link) && (pc == text_colors.get(0)) pc = link_color_default; |
||
44 | |||
45 | canvas.WriteText(draw_x, draw_y, list.font_type, pc, #line, NULL); |
||
46 | if (style.b) canvas.WriteText(draw_x+1, draw_y, list.font_type, pc, #line, NULL); |
||
47 | if (style.s) canvas.DrawBar(draw_x, list.item_h / 2 - zoom + draw_y, pw, zoom, pc); |
||
48 | if (style.u) canvas.DrawBar(draw_x, list.item_h - zoom - zoom + draw_y, pw, zoom, pc); |
||
49 | if (link) { |
||
50 | if (line[0]==' ') && (line[1]==NULL) {} else { |
||
51 | canvas.DrawBar(draw_x, draw_y + list.item_h - calc(zoom*2)-1, pw, zoom, link_color_default); |
||
52 | links.add_text(draw_x, draw_y + list.y, pw, list.item_h - calc(zoom*2)-1, zoom); |
||
53 | } |
||
54 | } |
||
55 | draw_x += pw; |
||
56 | if (debug_mode) debugln(#line); |
||
57 | line = NULL; |
||
58 | } |
||
59 | } |
||
60 | |||
61 | bool TWebBrowser::RenderImage(dword cur_img) |
||
62 | { |
||
63 | int img_x, img_y, img_w, img_h; |
||
64 | dword imgbuf[44]; |
||
65 | |||
66 | if (!cur_img) return false; |
||
67 | |||
68 | img_h = ESDWORD[cur_img+8]; |
||
69 | img_w = ESDWORD[cur_img+4]; |
||
70 | |||
71 | if (img_w + draw_x >= draw_w) NewLine(); |
||
72 | img_y = draw_y; |
||
73 | if (img_h < list.item_h) img_y += list.item_h - img_h / 2 - 1; else img_y -= 2; |
||
74 | style.cur_line_h = math.max(style.cur_line_h, img_h); |
||
75 | |||
76 | img_w = math.min(img_w, canvas.bufw - draw_x); |
||
77 | |||
78 | if (link) links.add_text(draw_x + list.x, img_y + list.y, img_w, img_h, 0); |
||
79 | |||
80 | if (img_y + img_h >= canvas.bufh) canvas.IncreaseBufSize(); |
||
81 | |||
82 | if (ESDWORD[cur_img+20] != IMAGE_BPP32) { |
||
83 | img_convert stdcall(cur_img, 0, IMAGE_BPP32, 0, 0); |
||
84 | $push eax |
||
85 | img_destroy stdcall(cur_img); |
||
86 | $pop eax |
||
87 | cur_img = EAX; |
||
88 | if (!EAX) return false; |
||
89 | } |
||
90 | imgbuf[04] = canvas.bufw; |
||
91 | imgbuf[08] = canvas.bufh; |
||
92 | imgbuf[20] = IMAGE_BPP32; |
||
93 | imgbuf[24] = buf_data+8; |
||
94 | img_blend stdcall(#imgbuf, cur_img, draw_x, img_y, 0, 0, img_w, img_h); |
||
95 | img_destroy stdcall(cur_img); |
||
96 | |||
97 | draw_x += img_w; |
||
98 | if (draw_x >= draw_w) NewLine(); |
||
99 | return true; |
||
100 | }> |