r4271 tlsa - in /trunk/netsurftest: haveproblems/floats-inside-overflow-scroll.html works/floats-inside-overflow-scroll.html
by netsurf@semichrome.net
Author: tlsa
Date: Fri Jun 6 09:57:55 2008
New Revision: 4271
URL: http://source.netsurf-browser.org?rev=4271&view=rev
Log:
Move test case from haveproblems/ to fixed/.
Added:
trunk/netsurftest/works/floats-inside-overflow-scroll.html
- copied unchanged from r4259, trunk/netsurftest/haveproblems/floats-inside-overflow-scroll.html
Removed:
trunk/netsurftest/haveproblems/floats-inside-overflow-scroll.html
Removed: trunk/netsurftest/haveproblems/floats-inside-overflow-scroll.html
URL: http://source.netsurf-browser.org/trunk/netsurftest/haveproblems/floats-i...
==============================================================================
--- trunk/netsurftest/haveproblems/floats-inside-overflow-scroll.html (original)
+++ trunk/netsurftest/haveproblems/floats-inside-overflow-scroll.html (removed)
@@ -1,44 +1,0 @@
-<html>
-<head>
-<style>
-#scroller {
- overflow: auto;
- width: 200px;
- height: 200px;
- border:thin solid black; }
-
-#scroller p {
- clear: both; }
-
-#scroller p img {
- float: left; }
-</style>
-</head>
-<body>
-
-
-<p style="background-color: #f88; padding:1em; margin: 1em;">Floats within an overflow:scroll should not be visible outside the area of the box. Also, they should scroll with the non floated content.</p>
-
-
- <div id="scroller">
- <p><img src="../images/1.jpg">Blah blah blah blah blah blah blah
- blah blah blah blah blah blah</p>
-
- <p><img src="../images/2.jpg">Blah blah blah blah blah blah blah
- blah blah blah blah blah blah</p>
-
- <p><img src="../images/3.jpg">Blah blah blah blah blah blah blah
- blah blah blah blah blah blah</p>
-
- <p><img src="../images/4.jpg">Blah blah blah blah blah blah blah
- blah blah blah blah blah blah</p>
-
- <p><img src="../images/5.jpg">Blah blah blah blah blah blah blah
- blah blah blah blah blah blah</p>
-
- <p><img src="../images/6.jpg">Blah blah blah blah blah blah blah
- blah blah blah blah blah blah</p>
- </div>
-
-</body>
-</html>
15 years
r4270 tlsa - /trunk/netsurf/render/layout.c
by netsurf@semichrome.net
Author: tlsa
Date: Fri Jun 6 09:54:19 2008
New Revision: 4270
URL: http://source.netsurf-browser.org?rev=4270&view=rev
Log:
Establish a new block formatting context for blocks with non-visisble overflow style. (9.4.1)
Modified:
trunk/netsurf/render/layout.c
Modified: trunk/netsurf/render/layout.c
URL: http://source.netsurf-browser.org/trunk/netsurf/render/layout.c?rev=4270&...
==============================================================================
--- trunk/netsurf/render/layout.c (original)
+++ trunk/netsurf/render/layout.c Fri Jun 6 09:54:19 2008
@@ -290,6 +290,9 @@
(box->style->position == CSS_POSITION_ABSOLUTE||
box->style->position == CSS_POSITION_FIXED)) {
box->x = box->parent->padding[LEFT];
+ /* absolute positioned; this element will establish
+ * its own block context when it gets laid out later,
+ * so no need to look at its children now. */
goto advance_to_next_box;
}
@@ -334,6 +337,36 @@
cy = y;
}
}
+
+ /* Unless the box has an overflow style of visible, the box
+ * establishes a new block context. */
+ if (box->type != BOX_INLINE_CONTAINER && box->style &&
+ box->style->overflow != CSS_OVERFLOW_VISIBLE) {
+ layout_block_context(box, content);
+
+ if (box->type == BOX_BLOCK || box->object)
+ cy += box->padding[TOP];
+
+ if (box->type == BOX_BLOCK && box->height == AUTO) {
+ box->height = 0;
+ layout_block_add_scrollbar(box, BOTTOM);
+ }
+
+ cy += box->height + box->padding[BOTTOM] +
+ box->border[BOTTOM];
+ max_pos_margin = max_neg_margin = 0;
+ if (max_pos_margin < box->margin[BOTTOM])
+ max_pos_margin = box->margin[BOTTOM];
+ else if (max_neg_margin < -box->margin[BOTTOM])
+ max_neg_margin = -box->margin[BOTTOM];
+ cx -= box->x;
+ y = box->y + box->padding[TOP] + box->height +
+ box->padding[BOTTOM] +
+ box->border[BOTTOM];
+ /* Skip children, because they are done in the new
+ * block context */
+ goto advance_to_next_box;
+ }
LOG(("box %p, cx %i, cy %i", box, cx, cy));
15 years
r4269 mmu_man - /trunk/netsurf/Docs/BUILDING-BeOS
by netsurf@semichrome.net
Author: mmu_man
Date: Fri Jun 6 09:41:30 2008
New Revision: 4269
URL: http://source.netsurf-browser.org?rev=4269&view=rev
Log:
Placeholder for infos on building the BeOS version.
Added:
trunk/netsurf/Docs/BUILDING-BeOS
Added: trunk/netsurf/Docs/BUILDING-BeOS
URL: http://source.netsurf-browser.org/trunk/netsurf/Docs/BUILDING-BeOS?rev=42...
==============================================================================
--- trunk/netsurf/Docs/BUILDING-BeOS (added)
+++ trunk/netsurf/Docs/BUILDING-BeOS Fri Jun 6 09:41:30 2008
@@ -1,0 +1,13 @@
+--------------------------------------------------------------------------------
+ Build Instructions for BeOS and Haiku NetSurf 06 June 2008
+--------------------------------------------------------------------------------
+
+ This document provides instructions for building the BeOS and Haiku version
+ of NetSurf and provides guidance on obtaining NetSurf's build dependencies.
+
+ BeOS NetSurf has been tested on Zeta only for now. There are still some
+ issues to sort out for other BeOs versions.
+
+
+ There are still pending fixes against SVN before it can be build from BeOS
+ or Haiku.
15 years
r4268 tlsa - in /trunk/netsurf: desktop/browser.c desktop/browser.h riscos/gui.c riscos/gui.h riscos/window.c
by netsurf@semichrome.net
Author: tlsa
Date: Fri Jun 6 08:58:56 2008
New Revision: 4268
URL: http://source.netsurf-browser.org?rev=4268&view=rev
Log:
+ Change core to handle different front end click behaviour
styles. (Act on mouse button press or on button release.)
+ Click hold on CSS scrollbar arrows now pauses before
starting to auto-repeat.
+ Click hold on scrollbar wells will now auto-repeat.
Modified:
trunk/netsurf/desktop/browser.c
trunk/netsurf/desktop/browser.h
trunk/netsurf/riscos/gui.c
trunk/netsurf/riscos/gui.h
trunk/netsurf/riscos/window.c
Modified: trunk/netsurf/desktop/browser.c
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.c?rev=426...
==============================================================================
--- trunk/netsurf/desktop/browser.c (original)
+++ trunk/netsurf/desktop/browser.c Fri Jun 6 08:58:56 2008
@@ -1976,10 +1976,12 @@
browser_mouse_state mouse, struct box *box,
int box_x, int box_y, int x, int y)
{
- const browser_mouse_state but1 = (BROWSER_MOUSE_CLICK_1 |
- BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_HOLDING_1);
- const browser_mouse_state but2 = (BROWSER_MOUSE_CLICK_2 |
- BROWSER_MOUSE_DRAG_2 | BROWSER_MOUSE_HOLDING_2);
+ bool but1 = (mouse & (BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_DRAG_1)) ||
+ ((mouse & BROWSER_MOUSE_HOLDING_1) &&
+ (mouse & BROWSER_MOUSE_DRAG_ON));
+ bool but2 = (mouse & (BROWSER_MOUSE_PRESS_2 | BROWSER_MOUSE_DRAG_2)) ||
+ ((mouse & BROWSER_MOUSE_HOLDING_2) &&
+ (mouse & BROWSER_MOUSE_DRAG_ON));;
const int w = SCROLLBAR_WIDTH;
bool vscroll, hscroll;
int well_height, bar_top, bar_height;
@@ -2027,27 +2029,30 @@
/* find icon in scrollbar and calculate scroll */
if (z < w) {
+ /* on scrollbar bump arrow button */
status = messages_get(vert ? "ScrollUp" : "ScrollLeft");
- if (mouse & but2)
+ if (but1)
+ scroll -= 16;
+ else if (but2)
scroll += 16;
- else if (mouse & but1)
- scroll -= 16;
} else if (z < w + bar_start + w / 4) {
+ /* in scrollbar well */
status = messages_get(vert ? "ScrollPUp" : "ScrollPLeft");
- if (mouse & BROWSER_MOUSE_CLICK_1)
+ if (but1)
scroll -= page;
- else if (mouse & BROWSER_MOUSE_CLICK_2)
+ else if (but2)
scroll += page;
} else if (z < w + bar_start + bar_size - w / 4) {
+ /* in scrollbar */
status = messages_get(vert ? "ScrollV" : "ScrollH");
/* respond on the click rather than the drag because it gives
the scrollbars a more solid, RISC OS feel */
- if (mouse & (BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_CLICK_2)) {
+ if (mouse & (BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_PRESS_2)) {
int x0 = 0, x1 = 0;
int y0 = 0, y1 = 0;
- if (mouse & BROWSER_MOUSE_CLICK_1) {
+ if (mouse & BROWSER_MOUSE_PRESS_1) {
bw->drag_type = vert ? DRAGGING_VSCROLL :
DRAGGING_HSCROLL;
} else
@@ -2067,17 +2072,19 @@
gui_window_hide_pointer(bw->window);
}
} else if (z < w + well_size) {
+ /* in scrollbar well */
status = messages_get(vert ? "ScrollPDown" : "ScrollPRight");
- if (mouse & BROWSER_MOUSE_CLICK_1)
+ if (but1)
scroll += page;
- else if (mouse & BROWSER_MOUSE_CLICK_2)
+ else if (but2)
scroll -= page;
} else {
+ /* on scrollbar bump arrow button */
status = messages_get(vert ? "ScrollDown" : "ScrollRight");
- if (mouse & but2)
+ if (but1)
+ scroll += 16;
+ else if (but2)
scroll -= 16;
- else if (mouse & but1)
- scroll += 16;
}
/* update box and redraw */
Modified: trunk/netsurf/desktop/browser.h
URL: http://source.netsurf-browser.org/trunk/netsurf/desktop/browser.h?rev=426...
==============================================================================
--- trunk/netsurf/desktop/browser.h (original)
+++ trunk/netsurf/desktop/browser.h Fri Jun 6 08:58:56 2008
@@ -174,18 +174,38 @@
};
+/* Mouse state. 1 is primary mouse button (e.g. Select on RISC OS).
+ * 2 is secondary mouse button (e.g. Adjust on RISC OS). */
typedef enum {
- BROWSER_MOUSE_CLICK_1 = 1, /* primary mouse button down (eg. Select) */
- BROWSER_MOUSE_CLICK_2 = 2,
-
- BROWSER_MOUSE_DRAG_1 = 8, /* start of drag operation */
- BROWSER_MOUSE_DRAG_2 = 16,
-
- BROWSER_MOUSE_HOLDING_1 = 64, /* whilst drag is in progress */
- BROWSER_MOUSE_HOLDING_2 = 128,
-
- BROWSER_MOUSE_MOD_1 = 512, /* primary modifier key pressed (eg. Shift) */
- BROWSER_MOUSE_MOD_2 = 1024
+ BROWSER_MOUSE_PRESS_1 = 1, /* button 1 pressed */
+ BROWSER_MOUSE_PRESS_2 = 2, /* button 2 pressed */
+
+ /* note: click meaning is different for
+ * different front ends. On RISC OS, it
+ * is standard to act on press, so a
+ * click is fired at the same time as a
+ * mouse button is pressed. With GTK, it
+ * is standard to act on release, so a
+ * click is fired when the mouse button
+ * is released, if the operation wasn't
+ * a drag. */
+ BROWSER_MOUSE_CLICK_1 = 4, /* button 1 clicked. */
+ BROWSER_MOUSE_CLICK_2 = 8, /* button 2 clicked. */
+
+ BROWSER_MOUSE_DRAG_1 = 16, /* start of button 1 drag operation */
+ BROWSER_MOUSE_DRAG_2 = 32, /* start of button 2 drag operation */
+
+ BROWSER_MOUSE_DRAG_ON = 64, /* a drag operation was started and
+ * a mouse button is still pressed */
+
+ BROWSER_MOUSE_HOLDING_1 = 128, /* while button 1 drag is in progress */
+ BROWSER_MOUSE_HOLDING_2 = 256, /* while button 2 drag is in progress */
+
+
+ BROWSER_MOUSE_MOD_1 = 512, /* primary modifier key pressed
+ * (eg. Shift) */
+ BROWSER_MOUSE_MOD_2 = 1024 /* secondary modifier key pressed
+ * (eg. Ctrl) */
} browser_mouse_state;
Modified: trunk/netsurf/riscos/gui.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/gui.c?rev=4268&r1=...
==============================================================================
--- trunk/netsurf/riscos/gui.c (original)
+++ trunk/netsurf/riscos/gui.c Fri Jun 6 08:58:56 2008
@@ -896,7 +896,8 @@
{
wimp_event_no event;
wimp_block block;
- const wimp_poll_flags mask = wimp_MASK_LOSE | wimp_MASK_GAIN | wimp_SAVE_FP;
+ const wimp_poll_flags mask = wimp_MASK_LOSE | wimp_MASK_GAIN |
+ wimp_SAVE_FP;
/* Poll wimp. */
xhourglass_off();
@@ -1019,7 +1020,8 @@
return;
xhourglass_off();
- event = wimp_poll(wimp_MASK_LOSE | wimp_MASK_GAIN | wimp_SAVE_FP, &block, 0);
+ event = wimp_poll(wimp_MASK_LOSE | wimp_MASK_GAIN | wimp_SAVE_FP,
+ &block, 0);
xhourglass_on();
gui_last_poll = clock();
@@ -1071,7 +1073,8 @@
if (gui_track_wimp_w == dialog_url_complete)
ro_gui_url_complete_mouse_at(&pointer);
else if (gui_track_gui_window)
- ro_gui_window_mouse_at(gui_track_gui_window, &pointer);
+ ro_gui_window_mouse_at(gui_track_gui_window,
+ &pointer);
break;
}
}
Modified: trunk/netsurf/riscos/gui.h
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/gui.h?rev=4268&r1=...
==============================================================================
--- trunk/netsurf/riscos/gui.h (original)
+++ trunk/netsurf/riscos/gui.h Fri Jun 6 08:58:56 2008
@@ -153,8 +153,10 @@
struct gui_window *ro_gui_window_lookup(wimp_w window);
struct gui_window *ro_gui_toolbar_lookup(wimp_w window);
void ro_gui_scroll_request(wimp_scroll *scroll);
-bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y, os_coord *pos);
-bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y, os_coord *pos);
+bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y,
+ os_coord *pos);
+bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y,
+ os_coord *pos);
bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message);
bool ro_gui_toolbar_dataload(struct gui_window *g, wimp_message *message);
void ro_gui_window_process_reformats(void);
Modified: trunk/netsurf/riscos/window.c
URL: http://source.netsurf-browser.org/trunk/netsurf/riscos/window.c?rev=4268&...
==============================================================================
--- trunk/netsurf/riscos/window.c (original)
+++ trunk/netsurf/riscos/window.c Fri Jun 6 08:58:56 2008
@@ -84,6 +84,9 @@
static bool iconise_used[64];
static int iconise_next = 0;
+/** Whether a pressed mouse button has become a drag */
+static bool mouse_drag;
+
/** List of all browser windows. */
static struct gui_window *window_list = 0;
/** GUI window which is being redrawn. Valid only during redraw. */
@@ -140,8 +143,8 @@
static void ro_gui_window_clone_options(struct browser_window *new_bw,
struct browser_window *old_bw);
static browser_mouse_state ro_gui_mouse_drag_state(wimp_mouse_state buttons);
-static bool ro_gui_window_import_text(struct gui_window *g, const char *filename,
- bool toolbar);
+static bool ro_gui_window_import_text(struct gui_window *g,
+ const char *filename, bool toolbar);
struct update_box {
int x0;
@@ -3003,11 +3006,19 @@
{
browser_mouse_state state = 0;
- if (buttons & (wimp_CLICK_SELECT)) state |= BROWSER_MOUSE_CLICK_1;
- if (buttons & (wimp_CLICK_ADJUST)) state |= BROWSER_MOUSE_CLICK_2;
-
- if (buttons & (wimp_DRAG_SELECT)) state |= BROWSER_MOUSE_DRAG_1;
- if (buttons & (wimp_DRAG_ADJUST)) state |= BROWSER_MOUSE_DRAG_2;
+ if (buttons & (wimp_CLICK_SELECT))
+ state |= BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_CLICK_1;
+ if (buttons & (wimp_CLICK_ADJUST))
+ state |= BROWSER_MOUSE_PRESS_2 | BROWSER_MOUSE_CLICK_2;
+
+ if (buttons & (wimp_DRAG_SELECT)) {
+ state |= BROWSER_MOUSE_DRAG_1;
+ mouse_drag = true;
+ }
+ if (buttons & (wimp_DRAG_ADJUST)) {
+ state |= BROWSER_MOUSE_DRAG_2;
+ mouse_drag = true;
+ }
if (ro_gui_shift_pressed()) state |= BROWSER_MOUSE_MOD_1;
if (ro_gui_ctrl_pressed()) state |= BROWSER_MOUSE_MOD_2;
@@ -3025,8 +3036,13 @@
{
browser_mouse_state state = 0;
+
if (buttons & (wimp_CLICK_SELECT)) state |= BROWSER_MOUSE_HOLDING_1;
if (buttons & (wimp_CLICK_ADJUST)) state |= BROWSER_MOUSE_HOLDING_2;
+
+ if (!(buttons & (wimp_CLICK_SELECT) || buttons & (wimp_CLICK_ADJUST)))
+ mouse_drag = false;
+ if (mouse_drag) state |= BROWSER_MOUSE_DRAG_ON;
if (ro_gui_shift_pressed()) state |= BROWSER_MOUSE_MOD_1;
if (ro_gui_ctrl_pressed()) state |= BROWSER_MOUSE_MOD_2;
15 years
r4267 adamblokus - in /branches/adamblokus/netsurf/pdf: TODO pdf_plotters.c
by netsurf@semichrome.net
Author: adamblokus
Date: Fri Jun 6 08:36:34 2008
New Revision: 4267
URL: http://source.netsurf-browser.org?rev=4267&view=rev
Log:
Added handling NULL-returns from all mallocs.
Added plot_bitmap_tile handling.
Changed code style a little.
Modified:
branches/adamblokus/netsurf/pdf/TODO
branches/adamblokus/netsurf/pdf/pdf_plotters.c
Modified: branches/adamblokus/netsurf/pdf/TODO
URL: http://source.netsurf-browser.org/branches/adamblokus/netsurf/pdf/TODO?re...
==============================================================================
--- branches/adamblokus/netsurf/pdf/TODO (original)
+++ branches/adamblokus/netsurf/pdf/TODO Fri Jun 6 08:36:34 2008
@@ -1,10 +1,13 @@
+- bitmap_tile at page-border
- finish all graphic primitives
- allow adding raw bitmaps
+- make image-aware (embed the image in its native/original type if possible)
+
- adjust content width to page width
- add text-scaling (if not yet using the original font - make the default one
have the same width)
-- make image-aware (embed the image in its native/original type if possible)
- add a save file.. dialogue
- divide output into multiple pages (not just the first one)
- rearrange file structure
- add utf support to Haru ( doable? )
+- wait for browser to end fetching?
Modified: branches/adamblokus/netsurf/pdf/pdf_plotters.c
URL: http://source.netsurf-browser.org/branches/adamblokus/netsurf/pdf/pdf_plo...
==============================================================================
--- branches/adamblokus/netsurf/pdf/pdf_plotters.c (original)
+++ branches/adamblokus/netsurf/pdf/pdf_plotters.c Fri Jun 6 08:36:34 2008
@@ -59,6 +59,8 @@
static void pdf_set_dashed();
static void pdf_set_dotted();
+static HPDF_Image pdf_extract_image(struct bitmap *bitmap, struct content *content);
+
bool pdf_begin(const char *);
void pdf_next_page();
void pdf_end(const char *);
@@ -72,8 +74,11 @@
static HPDF_Doc pdf_doc;
static HPDF_Page pdf_page;
static HPDF_Font pdf_font;
+
/*PDF Page size*/
static HPDF_REAL page_height, page_width;
+
+/*Remeber if pdf_plot_clip was invoked for current page*/
static bool page_clipped;
extern struct plotter_table plot;
@@ -105,14 +110,14 @@
#ifdef PDF_DEBUG
LOG(("."));
#endif
- HPDF_Page_SetLineWidth(pdf_page,line_width);
+ HPDF_Page_SetLineWidth(pdf_page, line_width);
if(dotted)
pdf_set_dotted();
else if(dashed)
pdf_set_dashed();
- HPDF_Page_SetRGBStroke(pdf_page,R(c),G(c),B(c));
+ HPDF_Page_SetRGBStroke(pdf_page, R(c), G(c), B(c));
HPDF_Page_Rectangle(pdf_page, x0, page_height - y0 + height, width, height);
HPDF_Page_Stroke(pdf_page);
@@ -122,20 +127,20 @@
return true;
}
-bool pdf_plot_line(int x0, int y0, int x1, int y1, int width,
+bool pdf_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed){
#ifdef PDF_DEBUG
LOG(("."));
#endif
- HPDF_Page_SetLineWidth(pdf_page,width);
+ HPDF_Page_SetLineWidth(pdf_page, width);
if(dotted)
pdf_set_dotted();
else if(dashed)
pdf_set_dashed();
- HPDF_Page_SetRGBStroke(pdf_page,R(c),G(c),B(c));
- HPDF_Page_SetLineWidth(pdf_page,width);
+ HPDF_Page_SetRGBStroke(pdf_page, R(c), G(c), B(c));
+ HPDF_Page_SetLineWidth(pdf_page, width);
HPDF_Page_MoveTo(pdf_page, x0, page_height - y0);
HPDF_Page_LineTo(pdf_page, x1, page_height - y1);
HPDF_Page_Stroke(pdf_page);
@@ -148,29 +153,29 @@
bool pdf_plot_polygon(int *p, unsigned int n, colour fill){
int i;
- int pmaxx=p[0],pmaxy=p[1];
- int pminx=p[0],pminy=p[1];
+ int pmaxx = p[0], pmaxy = p[1];
+ int pminx = p[0], pminy = p[1];
#ifdef PDF_DEBUG
LOG(("."));
#endif
- if(n==0)
+ if(n == 0)
return true;
- HPDF_Page_SetRGBFill(pdf_page,R(fill),G(fill),B(fill));
+ HPDF_Page_SetRGBFill(pdf_page, R(fill), G(fill), B(fill));
HPDF_Page_MoveTo(pdf_page, p[0], page_height - p[1]);
- for(i=1;i<n;i++){
+ for(i = 1 ; i<n ; i++){
HPDF_Page_LineTo(pdf_page, p[i*2], page_height - p[i*2+1]);
#ifdef PDF_DEBUG
- pmaxx=max(pmaxx,p[i*2]);
- pmaxy=max(pmaxy,p[i*2+1]);
- pminx=min(pminx,p[i*2]);
- pminy=min(pminy,p[i*2+1]);
-#endif
- }
-
-#ifdef PDF_DEBUG
- LOG(("%d %d %d %d %f",pminx,pminy, pmaxx, pmaxy, page_height-pminy));
+ pmaxx = max(pmaxx, p[i*2]);
+ pmaxy = max(pmaxy, p[i*2+1]);
+ pminx = min(pminx, p[i*2]);
+ pminy = min(pminy, p[i*2+1]);
+#endif
+ }
+
+#ifdef PDF_DEBUG
+ LOG(("%d %d %d %d %f", pminx, pminy, pmaxx, pmaxy, page_height-pminy));
#endif
HPDF_Page_LineTo(pdf_page, p[0], page_height - p[1]);
@@ -182,50 +187,50 @@
bool pdf_plot_fill(int x0, int y0, int x1, int y1, colour c){
#ifdef PDF_DEBUG
- LOG(("%d %d %d %d %f %X",x0,y0,x1,y1,page_height-y0,c));
+ LOG(("%d %d %d %d %f %X", x0, y0, x1, y1, page_height-y0, c));
#endif
/*Normalize boundaries of the area - to prevent overflows*/
- x0=min(max(x0,0),page_width);
- y0=min(max(y0,0),page_height);
- x1=min(max(x1,0),page_width);
- y1=min(max(y1,0),page_height);
-
- HPDF_Page_SetRGBFill(pdf_page,R(c),G(c),B(c));
+ x0 = min(max(x0, 0), page_width);
+ y0 = min(max(y0, 0), page_height);
+ x1 = min(max(x1, 0), page_width);
+ y1 = min(max(y1, 0), page_height);
+
+ HPDF_Page_SetRGBFill(pdf_page, R(c), G(c), B(c));
HPDF_Page_Rectangle(pdf_page, x0, page_height - y1, x1-x0, y1-y0);
HPDF_Page_Fill(pdf_page);
return true;
}
-bool pdf_plot_clip(int clip_x0, int clip_y0,
+bool pdf_plot_clip(int clip_x0, int clip_y0,
int clip_x1, int clip_y1){
#ifdef PDF_DEBUG
- LOG(("%d %d %d %d",clip_x0, clip_y0, clip_x1, clip_y1));
+ LOG(("%d %d %d %d", clip_x0, clip_y0, clip_x1, clip_y1));
#endif
if(page_clipped)
HPDF_Page_GRestore(pdf_page);
/*Normalize cllipping area - to prevent overflows*/
- clip_x0=min(max(clip_x0,0),page_width);
- clip_y0=min(max(clip_y0,0),page_height);
- clip_x1=min(max(clip_x1,0),page_width);
- clip_y1=min(max(clip_y1,0),page_height);
+ clip_x0 = min(max(clip_x0, 0), page_width);
+ clip_y0 = min(max(clip_y0, 0), page_height);
+ clip_x1 = min(max(clip_x1, 0), page_width);
+ clip_y1 = min(max(clip_y1, 0), page_height);
HPDF_Page_GSave(pdf_page);
- HPDF_Page_Rectangle(pdf_page, clip_x0, page_height-clip_y1,
- clip_x1-clip_x0, clip_y1-clip_y0);
+ HPDF_Page_Rectangle(pdf_page, clip_x0, page_height-clip_y1,
+ clip_x1-clip_x0, clip_y1-clip_y0);
HPDF_Page_Clip(pdf_page);
HPDF_Page_EndPath(pdf_page);
- page_clipped=true;
-
- return true;
-}
-
-bool pdf_plot_text(int x, int y, const struct css_style *style,
+ page_clipped = true;
+
+ return true;
+}
+
+bool pdf_plot_text(int x, int y, const struct css_style *style,
const char *text, size_t length, colour bg, colour c){
#ifdef PDF_DEBUG
LOG(("."));
@@ -233,17 +238,19 @@
char *word;
HPDF_REAL size;
- word=(char*)malloc(sizeof(char)*(length+1));
-
- strncpy(word,text,length);
- word[length]='\0';
-
- if (style->font_size.value.length.unit == CSS_UNIT_PX)
+ word = (char*)malloc(sizeof(char)*(length+1));
+ if(word == NULL)
+ return false;
+
+ strncpy(word, text, length);
+ word[length] = '\0';
+
+ if (style->font_size.value.length.unit == CSS_UNIT_PX)
size = style->font_size.value.length.value;
else
size = css_len2pt(&style->font_size.value.length, style);
- HPDF_Page_SetRGBFill(pdf_page,R(c),G(c),B(c));
+ HPDF_Page_SetRGBFill(pdf_page, R(c), G(c), B(c));
HPDF_Page_BeginText(pdf_page);
HPDF_Page_SetFontAndSize (pdf_page, pdf_font, size*1.5);
@@ -260,11 +267,11 @@
LOG(("."));
#endif
if(filled)
- HPDF_Page_SetRGBFill(pdf_page,R(c),G(c),B(c));
+ HPDF_Page_SetRGBFill(pdf_page, R(c), G(c), B(c));
else
- HPDF_Page_SetRGBStroke(pdf_page,R(c),G(c),B(c));
-
- HPDF_Page_Circle(pdf_page,x,page_height-y,radius);
+ HPDF_Page_SetRGBStroke(pdf_page, R(c), G(c), B(c));
+
+ HPDF_Page_Circle(pdf_page, x, page_height-y, radius);
if(filled)
HPDF_Page_Fill(pdf_page);
@@ -274,21 +281,21 @@
return true;
}
-bool pdf_plot_arc(int x, int y, int radius, int angle1, int angle2,
+bool pdf_plot_arc(int x, int y, int radius, int angle1, int angle2,
colour c){
#ifdef PDF_DEBUG
- LOG(("%d %d %d %d %d %X",x,y,radius,angle1,angle2,c));
+ LOG(("%d %d %d %d %d %X", x, y, radius, angle1, angle2, c));
#endif
/*Normalize angles*/
- angle1%=360;
- angle2%=360;
- if(angle1>angle2)
- angle1-=360;
-
- HPDF_Page_SetRGBStroke(pdf_page,R(c),G(c),B(c));
-
- HPDF_Page_Arc(pdf_page,x,page_height-y,radius,angle1,angle2);
+ angle1 %= 360;
+ angle2 %= 360;
+ if(angle1 > angle2)
+ angle1 -= 360;
+
+ HPDF_Page_SetRGBStroke(pdf_page, R(c), G(c), B(c));
+
+ HPDF_Page_Arc(pdf_page, x, page_height-y, radius, angle1, angle2);
HPDF_Page_Stroke(pdf_page);
return true;
@@ -296,31 +303,90 @@
bool pdf_plot_bitmap(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg, struct content *content){
-
- HPDF_Image image=NULL,smask;
- char *img_buffer,*rgb_buffer,*alpha_buffer;
- int img_width,img_height,img_rowstride;
- int i,j;
-
+
+ HPDF_Image image;
+
#ifdef PDF_DEBUG
LOG(("%d %d %d %d %X %X %X", x, y, width, height,
bitmap, bg, content));
#endif
+ image = pdf_extract_image(bitmap, content);
+
+ if(image){
+ HPDF_Page_DrawImage(pdf_page, image,
+ x, page_height-y-height,
+ width, height);
+ return true;
+ }
+ else
+ return false;
+}
+
+bool pdf_plot_bitmap_tile(int x, int y, int width, int height,
+ struct bitmap *bitmap, colour bg,
+ bool repeat_x, bool repeat_y, struct content *content){
+
+ HPDF_Image image;
+
+#ifdef PDF_DEBUG
+ LOG(("%d %d %d %d %X %X %X", x, y, width, height,
+ bitmap, bg, content));
+#endif
+
+ image = pdf_extract_image(bitmap, content);
+
+ if(image){
+ //The position of the next tile
+ HPDF_REAL current_x, current_y ;
+ HPDF_REAL max_width, max_height;
+
+ max_width = (repeat_x ? page_width : width);
+ max_height = (repeat_y ? page_height: height);
+
+ current_y=0;
+ while(current_y < max_height){
+ current_x=0;
+ while(current_x < max_width){
+ HPDF_Page_DrawImage(pdf_page, image,
+ current_x,
+ page_height-current_y-height,
+ width, height);
+ current_x += width;
+ }
+ current_y += height;
+ }
+
+ return true;
+ }
+ else
+ return false;
+
+ return true;
+}
+
+HPDF_Image pdf_extract_image(struct bitmap *bitmap, struct content *content){
+ HPDF_Image image = NULL,smask;
+ char *img_buffer, *rgb_buffer, *alpha_buffer;
+ int img_width, img_height, img_rowstride;
+ int i, j;
+
if(content){
/*Not sure if I don't have to check if downloading has been
- finished.
- Other way - lock pdf plotting while fetching a website
+ finished.
+ Other way - lock pdf plotting while fetching a website
*/
switch(content->type){
/*Handle "embeddable" types of images*/
case CONTENT_JPEG:
- image=HPDF_LoadJpegImageFromMem(pdf_doc,content->source_data,
+ image = HPDF_LoadJpegImageFromMem(pdf_doc,
+ content->source_data,
content->total_size);
break;
case CONTENT_PNG:
- image=HPDF_LoadPngImageFromMem(pdf_doc,content->source_data,
+ image = HPDF_LoadPngImageFromMem(pdf_doc,
+ content->source_data,
content->total_size);
break;
}
@@ -334,49 +400,52 @@
img_height = bitmap_get_height(bitmap);
img_rowstride = bitmap_get_rowstride(bitmap);
- rgb_buffer = (char*)malloc(3*img_width*img_height);
- alpha_buffer = (char*)malloc(img_width*img_height);
- if(!(rgb_buffer&&alpha_buffer)){
- LOG(("Not enough memory?"));
- return false;
+ rgb_buffer = (char*)malloc(3 * img_width * img_height);
+ if(rgb_buffer == NULL){
+ LOG(("Not enough memory to create RGB buffer"));
+ return NULL;
}
+
+ alpha_buffer = (char*)malloc(img_width * img_height);
+ if(alpha_buffer == NULL){
+ LOG(("Not enough memory to create alpha buffer"));
+ free(rgb_buffer);
+ return NULL;
+ }
+
- for(i=0;i<img_height;i++)
- for(j=0;j<img_width;j++){
- rgb_buffer[(i*img_width+j)*3] = img_buffer[i*img_rowstride+j*4];
- rgb_buffer[(i*img_width+j)*3+1] = img_buffer[i*img_rowstride+j*4+1];
- rgb_buffer[(i*img_width+j)*3+2] = img_buffer[i*img_rowstride+j*4+2];
- alpha_buffer[i*img_width+j] = img_buffer[i*img_rowstride+j*4+3];
+ for (i = 0; i<img_height; i++)
+ for(j = 0 ; j<img_width ; j++){
+ rgb_buffer[((i * img_width) + j) * 3] =
+ img_buffer[(i * img_rowstride) + (j * 4)];
+
+ rgb_buffer[(((i * img_width) + j) * 3) + 1] =
+ img_buffer[(i * img_rowstride) + (j * 4) + 1];
+
+ rgb_buffer[(((i * img_width) + j) * 3) + 2] =
+ img_buffer[(i * img_rowstride) + (j * 4) + 2];
+
+ alpha_buffer[(i * img_width)+j] =
+ img_buffer[(i * img_rowstride) + (j * 4) + 3];
}
- smask=HPDF_LoadRawImageFromMem(pdf_doc,alpha_buffer,
- img_width,img_height,
- HPDF_CS_DEVICE_GRAY,8);
-
- image=HPDF_LoadRawImageFromMem(pdf_doc,rgb_buffer,
- img_width,img_height,
- HPDF_CS_DEVICE_RGB,8);
-
- HPDF_Image_AddSMask(pdf_doc,image,smask);
-
- free(rgb_buffer);
- free(alpha_buffer);
- }
-
- if(image)
- HPDF_Page_DrawImage(pdf_page,image,
- x, page_height-y-height,
- width, height);
-
- return true;
-}
-
-bool pdf_plot_bitmap_tile(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg,
- bool repeat_x, bool repeat_y, struct content *content){
-
- return true;
-}
+ smask = HPDF_LoadRawImageFromMem(pdf_doc, alpha_buffer,
+ img_width, img_height,
+ HPDF_CS_DEVICE_GRAY, 8);
+
+ image = HPDF_LoadRawImageFromMem(pdf_doc, rgb_buffer,
+ img_width, img_height,
+ HPDF_CS_DEVICE_RGB, 8);
+
+ HPDF_Image_AddSMask(pdf_doc, image,smask);
+
+ free(rgb_buffer);
+ free(alpha_buffer);
+ }
+
+ return image;
+}
+
bool pdf_plot_flush(){
return true;
@@ -384,11 +453,12 @@
static inline float transform_x(float *transform,float x,float y){
- return (transform[0] * (x) + transform[2] * -(y) + transform[4]) * 2;
+ return ((transform[0] * x) + (transform[2] * (-y) ) + transform[4]) * 2;
}
static inline float transform_y(float *transform,float x,float y){
- return page_height-(transform[1] * (x) + transform[3] * -(y) - transform[5]) * 2;
+ return page_height -
+ (((transform[1] * x) + (transform[3] * (-y)) - transform[5]) * 2);
}
bool pdf_plot_path(float *p, unsigned int n, colour fill, float width,
@@ -397,52 +467,52 @@
LOG(("."));
#endif
unsigned int i;
- bool empty_path=true;
+ bool empty_path = true;
- if(n==0)
+ if(n == 0)
return true;
- if(c==TRANSPARENT && fill==TRANSPARENT)
+ if((c == TRANSPARENT) && (fill == TRANSPARENT))
return true;
if (p[0] != PLOTTER_PATH_MOVE) {
return false;
}
- HPDF_Page_SetRGBFill(pdf_page,R(fill),G(fill),B(fill));
- HPDF_Page_SetRGBStroke(pdf_page,R(c),G(c),B(c));
-
- transform[0]=0.1;
- transform[1]=0;
- transform[2]=0;
- transform[3]=-0.1;
- transform[4]=0;
- transform[5]=0;
-
- for(i=0;i<n;){
- if(p[i]==PLOTTER_PATH_MOVE){
- HPDF_Page_MoveTo(pdf_page,
- transform_x(transform,p[i+1],p[i+2]),
- transform_y(transform,p[i+1],p[i+2]));
- i+=3;
+ HPDF_Page_SetRGBFill(pdf_page, R(fill), G(fill), B(fill));
+ HPDF_Page_SetRGBStroke(pdf_page, R(c), G(c), B(c));
+
+ transform[0] = 0.1;
+ transform[1] = 0;
+ transform[2] = 0;
+ transform[3] = -0.1;
+ transform[4] = 0;
+ transform[5] = 0;
+
+ for(i = 0 ; i<n ; ){
+ if(p[i] == PLOTTER_PATH_MOVE){
+ HPDF_Page_MoveTo(pdf_page,
+ transform_x(transform, p[i+1], p[i+2]),
+ transform_y(transform, p[i+1], p[i+2]));
+ i+= 3;
}else if (p[i] == PLOTTER_PATH_CLOSE) {
if(!empty_path)
HPDF_Page_ClosePath(pdf_page);
i++;
} else if (p[i] == PLOTTER_PATH_LINE) {
- HPDF_Page_LineTo(pdf_page,
- transform_x(transform,p[i+1],p[i+2]),
- transform_y(transform,p[i+1],p[i+2]));
+ HPDF_Page_LineTo(pdf_page,
+ transform_x(transform, p[i+1], p[i+2]),
+ transform_y(transform, p[i+1], p[i+2]));
i+=3;
empty_path = false;
} else if (p[i] == PLOTTER_PATH_BEZIER) {
- HPDF_Page_CurveTo(pdf_page,
- transform_x(transform,p[i+1],p[i+2]),
- transform_y(transform,p[i+1],p[i+2]),
- transform_x(transform,p[i+3],p[i+4]),
- transform_y(transform,p[i+3],p[i+4]),
- transform_x(transform,p[i+5],p[i+6]),
- transform_y(transform,p[i+5],p[i+6]));
+ HPDF_Page_CurveTo(pdf_page,
+ transform_x(transform, p[i+1], p[i+2]),
+ transform_y(transform, p[i+1], p[i+2]),
+ transform_x(transform, p[i+3], p[i+4]),
+ transform_y(transform, p[i+3], p[i+4]),
+ transform_x(transform, p[i+5], p[i+6]),
+ transform_y(transform, p[i+5], p[i+6]));
i += 7;
empty_path = false;
} else {
@@ -469,32 +539,32 @@
}
void pdf_set_solid(){
- HPDF_Page_SetDash(pdf_page,NULL,0,0);
+ HPDF_Page_SetDash(pdf_page, NULL, 0, 0);
}
void pdf_set_dashed(){
- HPDF_UINT16 dash_ptn[]={3};
- HPDF_Page_SetDash(pdf_page,dash_ptn,1,1);
+ HPDF_UINT16 dash_ptn[] = {3};
+ HPDF_Page_SetDash(pdf_page, dash_ptn, 1, 1);
}
void pdf_set_dotted(){
- HPDF_UINT16 dash_ptn[]={1};
- HPDF_Page_SetDash(pdf_page,dash_ptn,1,1);
+ HPDF_UINT16 dash_ptn[] = {1};
+ HPDF_Page_SetDash(pdf_page, dash_ptn, 1, 1);
}
bool pdf_begin(const char *path){
#ifdef PDF_DEBUG
- pdf_doc = HPDF_New(error_handler,NULL);
+ pdf_doc = HPDF_New(error_handler, NULL);
#else
- pdf_doc = HPDF_New(NULL,NULL);
+ pdf_doc = HPDF_New(NULL, NULL);
#endif
if(!pdf_doc){
LOG(("Error creating pdf_doc"));
return false;
}
- HPDF_SetCompressionMode(pdf_doc,HPDF_COMP_ALL); /*Compression on*/
+ HPDF_SetCompressionMode(pdf_doc, HPDF_COMP_ALL); /*Compression on*/
pdf_font = HPDF_GetFont (pdf_doc, "Times-Roman", "StandardEncoding");
#ifdef PDF_DEBUG
LOG(("pdf_begin finishes"));
@@ -509,7 +579,7 @@
page_width = HPDF_Page_GetWidth(pdf_page);
page_clipped = false;
#ifdef PDF_DEBUG
- LOG(("%f %f",page_width,page_height));
+ LOG(("%f %f", page_width, page_height));
#endif
}
@@ -517,8 +587,8 @@
#ifdef PDF_DEBUG
LOG(("pdf_end begins"));
- pdf_plot_grid(10,10,0xCCCCCC);
- pdf_plot_grid(100,100,0xCCCCFF);
+ pdf_plot_grid(10, 10, 0xCCCCCC);
+ pdf_plot_grid(100, 100, 0xCCCCFF);
#endif
HPDF_SaveToFile(pdf_doc, path);
@@ -529,26 +599,26 @@
#endif
}
-void error_handler (HPDF_STATUS error_no,
- HPDF_STATUS detail_no,
+void error_handler (HPDF_STATUS error_no,
+ HPDF_STATUS detail_no,
void *user_data)
{
- printf ("ERROR:\n\terror_no=%x\n\tdetail_no=%d\n",
- (HPDF_UINT)error_no,
+ printf ("ERROR:\n\terror_no=%x\n\tdetail_no=%d\n",
+ (HPDF_UINT)error_no,
(HPDF_UINT)detail_no);
exit(1);
}
-void pdf_plot_grid(int x_dist,int y_dist,unsigned int colour){
+void pdf_plot_grid(int x_dist, int y_dist, unsigned int colour){
int i;
- for(int i=x_dist;i<page_width;i+=x_dist)
- pdf_plot_line(i,0,i,page_height,1,colour,false,false);
-
- for(int i=y_dist;i<page_height;i+=x_dist)
- pdf_plot_line(0,i,page_width,i,1,colour,false,false);
-
-}
-
-
+ for(int i = x_dist ; i<page_width ; i+=x_dist)
+ pdf_plot_line(i, 0, i, page_height, 1, colour, false, false);
+
+ for(int i = y_dist ; i<page_height ; i+=x_dist)
+ pdf_plot_line(0, i, page_width, i, 1, colour, false, false);
+
+}
+
+
15 years
r4265 mmu_man - /trunk/netsurf/image/bmpread.c
by netsurf@semichrome.net
Author: mmu_man
Date: Thu Jun 5 18:04:54 2008
New Revision: 4265
URL: http://source.netsurf-browser.org?rev=4265&view=rev
Log:
Get rid of non ASCII \xa0 character in comments (copy-pasting a webpage ?) I also need config.h for a missing type on BeOS.
Modified:
trunk/netsurf/image/bmpread.c
Modified: trunk/netsurf/image/bmpread.c
URL: http://source.netsurf-browser.org/trunk/netsurf/image/bmpread.c?rev=4265&...
==============================================================================
--- trunk/netsurf/image/bmpread.c (original)
+++ trunk/netsurf/image/bmpread.c Thu Jun 5 18:04:54 2008
@@ -25,6 +25,7 @@
#include "image/bmpread.h"
#include "image/bitmap.h"
#include "utils/log.h"
+#include "utils/config.h"
#define READ_SHORT(a, o) (a[o]|(a[o+1]<<8))
#define READ_INT(a, o) (a[o]|(a[o+1]<<8)|(a[o+2]<<16)|(a[o+3]<<24))
@@ -160,10 +161,10 @@
/* the following header is for os/2 and windows 2.x and consists of:
*
* +0 INT size of this header (in bytes)
- * +4 SHORT image width (in pixels)
- * +6 SHORT image height (in pixels)
- * +8 SHORT number of color planes (always 1)
- * +10 SHORT number of bits per pixel
+ * +4 SHORT image width (in pixels)
+ * +6 SHORT image height (in pixels)
+ * +8 SHORT number of color planes (always 1)
+ * +10 SHORT number of bits per pixel
*/
width = READ_SHORT(data, 4);
height = READ_SHORT(data, 6);
@@ -186,34 +187,34 @@
/* the following header is for windows 3.x and onwards. it is a
* minimum of 40 bytes and (as of Windows 95) a maximum of 108 bytes.
*
- * +0 INT size of this header (in bytes)
- * +4 INT image width (in pixels)
- * +8 INT image height (in pixels)
- * +12 SHORT number of color planes (always 1)
- * +14 SHORT number of bits per pixel
- * +16 INT compression methods used
- * +20 INT size of bitmap (in bytes)
- * +24 INT horizontal resolution (in pixels per meter)
- * +28 INT vertical resolution (in pixels per meter)
- * +32 INT number of colors in the image
- * +36 INT number of important colors
- * +40 INT mask identifying bits of red component
- * +44 INT mask identifying bits of green component
- * +48 INT mask identifying bits of blue component
- * +52 INT mask identifying bits of alpha component
- * +56 INT color space type
- * +60 INT x coordinate of red endpoint
- * +64 INT y coordinate of red endpoint
- * +68 INT z coordinate of red endpoint
- * +72 INT x coordinate of green endpoint
- * +76 INT y coordinate of green endpoint
- * +80 INT z coordinate of green endpoint
- * +84 INT x coordinate of blue endpoint
- * +88 INT y coordinate of blue endpoint
- * +92 INT z coordinate of blue endpoint
- * +96 INT gamma red coordinate scale value
- * +100 INT gamma green coordinate scale value
- * +104 INT gamma blue coordinate scale value
+ * +0 INT size of this header (in bytes)
+ * +4 INT image width (in pixels)
+ * +8 INT image height (in pixels)
+ * +12 SHORT number of color planes (always 1)
+ * +14 SHORT number of bits per pixel
+ * +16 INT compression methods used
+ * +20 INT size of bitmap (in bytes)
+ * +24 INT horizontal resolution (in pixels per meter)
+ * +28 INT vertical resolution (in pixels per meter)
+ * +32 INT number of colors in the image
+ * +36 INT number of important colors
+ * +40 INT mask identifying bits of red component
+ * +44 INT mask identifying bits of green component
+ * +48 INT mask identifying bits of blue component
+ * +52 INT mask identifying bits of alpha component
+ * +56 INT color space type
+ * +60 INT x coordinate of red endpoint
+ * +64 INT y coordinate of red endpoint
+ * +68 INT z coordinate of red endpoint
+ * +72 INT x coordinate of green endpoint
+ * +76 INT y coordinate of green endpoint
+ * +80 INT z coordinate of green endpoint
+ * +84 INT x coordinate of blue endpoint
+ * +88 INT y coordinate of blue endpoint
+ * +92 INT z coordinate of blue endpoint
+ * +96 INT gamma red coordinate scale value
+ * +100 INT gamma green coordinate scale value
+ * +104 INT gamma blue coordinate scale value
*/
if (!bmp->ico) {
width = READ_INT(data, 4);
15 years
r4264 mmu_man - /trunk/netsurf/Makefile
by netsurf@semichrome.net
Author: mmu_man
Date: Thu Jun 5 17:54:49 2008
New Revision: 4264
URL: http://source.netsurf-browser.org?rev=4264&view=rev
Log:
BeOS: I can now use *ng and jpeg... Also link to libtranslation, it's used to load the throbber pngs. Switched from beres to rc as ressource compiler, it should allow importing external css and html files from resources.
Modified:
trunk/netsurf/Makefile
Modified: trunk/netsurf/Makefile
URL: http://source.netsurf-browser.org/trunk/netsurf/Makefile?rev=4264&r1=4263...
==============================================================================
--- trunk/netsurf/Makefile (original)
+++ trunk/netsurf/Makefile Thu Jun 5 17:54:49 2008
@@ -142,7 +142,7 @@
# some people do *not* have libm...
LDFLAGS := -L/boot/home/config/lib
LDFLAGS += -lxml2 -lz -lcurl -lssl -lcrypto -ljpeg -liconv
-#LDFLAGS += -lmng
+LDFLAGS += -lmng -ljpeg
else
LDFLAGS := $(shell $(PKG_CONFIG) --libs libxml-2.0 libcurl openssl)
LDFLAGS += -lz -lm -lmng -ljpeg
@@ -216,6 +216,7 @@
# -DDEBUG=1
BEOS_BERES := beres
+BEOS_RC := rc
BEOS_XRES := xres
BEOS_SETVER := setversion
BEOS_MIMESET := mimeset
@@ -247,7 +248,7 @@
# cross: Haiku ?
NETLDFLAGS := -lnetwork
endif
-LDFLAGS += -lbe $(NETLDFLAGS)
+LDFLAGS += -lbe -ltranslation $(NETLDFLAGS)
endif
@@ -318,7 +319,8 @@
ifeq ($(TARGET),beos)
$(RSRC_BEOS): $(RDEF_BEOS)
- $(Q)$(BEOS_BERES) -o $@ $<
+ $(VQ)echo " RC: $<"
+ $(Q)$(BEOS_RC) -o $@ $<
endif
clean-target:
15 years
r4263 adamblokus - in /branches/adamblokus/netsurf: gtk/gtk_bitmap.c pdf/pdf_plotters.c
by netsurf@semichrome.net
Author: adamblokus
Date: Thu Jun 5 07:20:32 2008
New Revision: 4263
URL: http://source.netsurf-browser.org?rev=4263&view=rev
Log:
Added hadling images other than png and jpeg - with transparency.
Modified:
branches/adamblokus/netsurf/gtk/gtk_bitmap.c
branches/adamblokus/netsurf/pdf/pdf_plotters.c
Modified: branches/adamblokus/netsurf/gtk/gtk_bitmap.c
URL: http://source.netsurf-browser.org/branches/adamblokus/netsurf/gtk/gtk_bit...
==============================================================================
--- branches/adamblokus/netsurf/gtk/gtk_bitmap.c (original)
+++ branches/adamblokus/netsurf/gtk/gtk_bitmap.c Thu Jun 5 07:20:32 2008
@@ -211,6 +211,14 @@
void (*invalidate)(struct bitmap *bitmap, void *private_word)) {
}
+int bitmap_get_width(struct bitmap *bitmap){
+ return gdk_pixbuf_get_width(bitmap->primary);
+}
+
+int bitmap_get_height(struct bitmap *bitmap){
+ return gdk_pixbuf_get_height(bitmap->primary);
+}
+
static GdkPixbuf *
gtk_bitmap_generate_pretile(GdkPixbuf *primary, int repeat_x, int repeat_y)
{
Modified: branches/adamblokus/netsurf/pdf/pdf_plotters.c
URL: http://source.netsurf-browser.org/branches/adamblokus/netsurf/pdf/pdf_plo...
==============================================================================
--- branches/adamblokus/netsurf/pdf/pdf_plotters.c (original)
+++ branches/adamblokus/netsurf/pdf/pdf_plotters.c Thu Jun 5 07:20:32 2008
@@ -22,6 +22,7 @@
#include "desktop/plotters.h"
#include "utils/log.h"
#include "utils/utils.h"
+#include "image/bitmap.h"
#include "hpdf.h"
@@ -296,7 +297,10 @@
bool pdf_plot_bitmap(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg, struct content *content){
- HPDF_Image image;
+ HPDF_Image image=NULL,smask;
+ char *img_buffer,*rgb_buffer,*alpha_buffer;
+ int img_width,img_height,img_rowstride;
+ int i,j;
#ifdef PDF_DEBUG
LOG(("%d %d %d %d %X %X %X", x, y, width, height,
@@ -311,28 +315,58 @@
switch(content->type){
/*Handle "embeddable" types of images*/
case CONTENT_JPEG:
-// image = HPDF_LoadJpegImageFromFile(pdf_doc,"testres/jpeg.jpeg");
image=HPDF_LoadJpegImageFromMem(pdf_doc,content->source_data,
content->total_size);
- HPDF_Page_DrawImage(pdf_page,image,
- x, page_height-y-height,
- width, height);
- return true;
+ break;
+
case CONTENT_PNG:
-// image = HPDF_LoadPngImageFromFile(pdf_doc,"testres/png.png");
image=HPDF_LoadPngImageFromMem(pdf_doc,content->source_data,
content->total_size);
- HPDF_Page_DrawImage(pdf_page,image,
- x, page_height-y-height,
- width, height);
- return true;
+ break;
}
}
- /*Handle pixmaps*/
- HPDF_Page_SetRGBFill(pdf_page,1,0,0);
- HPDF_Page_Rectangle(pdf_page,x,page_height-y-height,width,height);
- HPDF_Page_Fill(pdf_page);
+ if(!image){
+
+ /*Handle pixmaps*/
+ img_buffer = bitmap_get_buffer(bitmap);
+ img_width = bitmap_get_width(bitmap);
+ img_height = bitmap_get_height(bitmap);
+ img_rowstride = bitmap_get_rowstride(bitmap);
+
+ rgb_buffer = (char*)malloc(3*img_width*img_height);
+ alpha_buffer = (char*)malloc(img_width*img_height);
+ if(!(rgb_buffer&&alpha_buffer)){
+ LOG(("Not enough memory?"));
+ return false;
+ }
+
+ for(i=0;i<img_height;i++)
+ for(j=0;j<img_width;j++){
+ rgb_buffer[(i*img_width+j)*3] = img_buffer[i*img_rowstride+j*4];
+ rgb_buffer[(i*img_width+j)*3+1] = img_buffer[i*img_rowstride+j*4+1];
+ rgb_buffer[(i*img_width+j)*3+2] = img_buffer[i*img_rowstride+j*4+2];
+ alpha_buffer[i*img_width+j] = img_buffer[i*img_rowstride+j*4+3];
+ }
+
+ smask=HPDF_LoadRawImageFromMem(pdf_doc,alpha_buffer,
+ img_width,img_height,
+ HPDF_CS_DEVICE_GRAY,8);
+
+ image=HPDF_LoadRawImageFromMem(pdf_doc,rgb_buffer,
+ img_width,img_height,
+ HPDF_CS_DEVICE_RGB,8);
+
+ HPDF_Image_AddSMask(pdf_doc,image,smask);
+
+ free(rgb_buffer);
+ free(alpha_buffer);
+ }
+
+ if(image)
+ HPDF_Page_DrawImage(pdf_page,image,
+ x, page_height-y-height,
+ width, height);
return true;
}
15 years