Vincent Sanders wrote:
> I look forward to a single function patch from you to achive this once
> this current refactor has been merged.
>
Hi Vince,
well as I'm not one for prevaricating :-) here's a patch for current
trunk in case it'll patch cleanly, I'll happily update it as / when
necessary
Best regards
Mark
http://www.halloit.com
Key ID 046B65CF
Index: render/html.c
===================================================================
--- render/html.c (revision 8511)
+++ render/html.c (working copy)
@@ -113,7 +113,7 @@
html->base_url = c->url;
html->base_target = NULL;
html->layout = 0;
- html->background_colour = TRANSPARENT;
+ html->background_colour = NS_TRANSPARENT;
html->stylesheet_count = 0;
html->stylesheet_content = 0;
html->style = 0;
Index: render/html_redraw.c
===================================================================
--- render/html_redraw.c (revision 8511)
+++ render/html_redraw.c (working copy)
@@ -146,7 +146,7 @@
/* clear to background colour */
result = plot.clip(clip_x0, clip_y0, clip_x1, clip_y1);
- if (c->data.html.background_colour != TRANSPARENT)
+ if (c->data.html.background_colour != NS_TRANSPARENT)
pstyle_fill_bg.fill_colour = c->data.html.background_colour;
result &= plot.rectangle(clip_x0, clip_y0, clip_x1, clip_y1, &pstyle_fill_bg);
@@ -368,17 +368,17 @@
if (!box->parent) {
/* Root box */
if (box->style &&
- (box->style->background_color != TRANSPARENT ||
+ (box->style->background_color != NS_TRANSPARENT ||
box->background)) {
/* With its own background */
bg_box = box;
} else if (!box->style ||
- (box->style->background_color == TRANSPARENT &&
+ (box->style->background_color == NS_TRANSPARENT &&
!box->background)) {
/* Without its own background */
if (box->children && box->children->style &&
(box->children->style->
- background_color != TRANSPARENT ||
+ background_color != NS_TRANSPARENT ||
box->children->background)) {
/* But body has one, so use that */
bg_box = box->children;
@@ -387,12 +387,12 @@
} else if (box->parent && !box->parent->parent) {
/* Body box */
if (box->style &&
- (box->style->background_color != TRANSPARENT ||
+ (box->style->background_color != NS_TRANSPARENT ||
box->background)) {
/* With a background */
if (box->parent->style &&
(box->parent->style->background_color !=
- TRANSPARENT ||
+ NS_TRANSPARENT ||
box->parent->background)) {
/* Root has own background; process normally */
bg_box = box;
@@ -413,7 +413,7 @@
bg_box->type != BOX_TEXT &&
bg_box->type != BOX_INLINE_END &&
(bg_box->type != BOX_INLINE || bg_box->object) &&
- ((bg_box->style->background_color != TRANSPARENT) ||
+ ((bg_box->style->background_color != NS_TRANSPARENT) ||
(bg_box->background))) {
/* find intersection of clip box and border edge */
int px0, py0, px1, py1;
@@ -469,7 +469,7 @@
/* backgrounds and borders for non-replaced inlines */
if (box->style && box->type == BOX_INLINE && box->inline_end &&
- (box->style->background_color != TRANSPARENT ||
+ (box->style->background_color != NS_TRANSPARENT ||
box->background || border_top || border_right ||
border_bottom || border_left)) {
/* inline backgrounds and borders span other boxes and may
@@ -1099,7 +1099,7 @@
.fill_type = PLOT_OP_TYPE_NONE,
};
- if (c == TRANSPARENT)
+ if (c == NS_TRANSPARENT)
return true;
switch (style) {
@@ -1513,7 +1513,7 @@
/* <td> attributes override <tr> */
if ((clip_x0 >= clip_x1) || (clip_y0 >= clip_y1) ||
(clip_box->style->background_color !=
- TRANSPARENT) ||
+ NS_TRANSPARENT) ||
(clip_box->background &&
clip_box->background->bitmap &&
bitmap_get_opaque(
@@ -1522,7 +1522,7 @@
}
/* plot the background colour */
- if (background->style->background_color != TRANSPARENT) {
+ if (background->style->background_color != NS_TRANSPARENT) {
*background_colour =
background->style->background_color;
pstyle_fill_bg.fill_colour =
@@ -1690,7 +1690,7 @@
}
/* plot the background colour */
- if (box->style->background_color != TRANSPARENT) {
+ if (box->style->background_color != NS_TRANSPARENT) {
*background_colour =
box->style->background_color;
pstyle_fill_bg.fill_colour =
Index: image/svg.c
===================================================================
--- image/svg.c (revision 8511)
+++ image/svg.c (working copy)
@@ -108,7 +108,7 @@
transform[4] = x;
transform[5] = y;
-#define BGR(c) ((c) == svgtiny_TRANSPARENT ? TRANSPARENT : ((svgtiny_RED((c))) | (svgtiny_GREEN((c)) << 8) | (svgtiny_BLUE((c)) << 16)))
+#define BGR(c) ((c) == svgtiny_TRANSPARENT ? NS_TRANSPARENT : ((svgtiny_RED((c))) | (svgtiny_GREEN((c)) << 8) | (svgtiny_BLUE((c)) << 16)))
for (i = 0; i != diagram->shape_count; i++) {
if (diagram->shape[i].path) {
Index: gtk/gtk_plotters.c
===================================================================
--- gtk/gtk_plotters.c (revision 8511)
+++ gtk/gtk_plotters.c (working copy)
@@ -396,10 +396,10 @@
cairo_set_matrix(current_cr, &old_ctm);
/* Now draw path */
- if (fill != TRANSPARENT) {
+ if (fill != NS_TRANSPARENT) {
nsgtk_set_colour(fill);
- if (c != TRANSPARENT) {
+ if (c != NS_TRANSPARENT) {
/* Fill & Stroke */
cairo_fill_preserve(current_cr);
nsgtk_set_colour(c);
@@ -408,7 +408,7 @@
/* Fill only */
cairo_fill(current_cr);
}
- } else if (c != TRANSPARENT) {
+ } else if (c != NS_TRANSPARENT) {
/* Stroke only */
nsgtk_set_colour(c);
cairo_stroke(current_cr);
Index: css/ruleset.c
===================================================================
--- css/ruleset.c (revision 8511)
+++ css/ruleset.c (working copy)
@@ -462,7 +462,7 @@
{ "teal", 0x808000 },
{ "thistle", 0xd8bfd8 },
{ "tomato", 0x4763ff },
- { "transparent", TRANSPARENT },
+ { "transparent", NS_TRANSPARENT },
{ "turquoise", 0xd0e040 },
{ "violet", 0xee82ee },
{ "violetred", 0x9020d0 }, /* not SVG-1.0*/
@@ -902,7 +902,7 @@
void parse_background(struct css_style * const s,
const struct css_node * v)
{
- colour c = TRANSPARENT, c2;
+ colour c = NS_TRANSPARENT, c2;
css_background_image_type bi = CSS_BACKGROUND_IMAGE_NONE, bi2;
char *bi_uri = 0;
css_background_repeat br = CSS_BACKGROUND_REPEAT_REPEAT, br2;
Index: css/css.c
===================================================================
--- css/css.c (revision 8511)
+++ css/css.c (working copy)
@@ -314,7 +314,7 @@
* and the 'Initial value' otherwise. */
const struct css_style css_blank_style = {
CSS_BACKGROUND_ATTACHMENT_SCROLL,
- TRANSPARENT,
+ NS_TRANSPARENT,
{ CSS_BACKGROUND_IMAGE_NONE, 0 },
{ { CSS_BACKGROUND_POSITION_PERCENT, { 0.0 } },
{ CSS_BACKGROUND_POSITION_PERCENT, { 0.0 } } },
@@ -1596,7 +1596,7 @@
#define DUMP_COLOR(z, s) \
if (style->z != CSS_COLOR_NOT_SET) { \
- if (style->z == TRANSPARENT) \
+ if (style->z == NS_TRANSPARENT) \
fprintf(stream, s ": transparent; "); \
else if (style->z == CSS_COLOR_NONE) \
fprintf(stream, s ": none; "); \
@@ -1751,7 +1751,7 @@
css_border_style_name[
style->border[i].style]);
- if (style->border[i].color == TRANSPARENT)
+ if (style->border[i].color == NS_TRANSPARENT)
fprintf(stream, " transparent");
else if (style->border[i].color == CSS_COLOR_NONE)
fprintf(stream, " none");
@@ -2144,7 +2144,7 @@
fprintf(stream, " invert");
break;
case CSS_OUTLINE_COLOR_COLOR:
- if (style->outline.color.value == TRANSPARENT)
+ if (style->outline.color.value == NS_TRANSPARENT)
fprintf(stream, " transparent");
else if (style->outline.color.value == CSS_COLOR_NONE)
fprintf(stream, " none");
Index: css/css.h
===================================================================
--- css/css.h (revision 8511)
+++ css/css.h (working copy)
@@ -42,7 +42,7 @@
typedef uint32_t colour; /* 0xbbggrr */
-#define TRANSPARENT 0x1000000
+#define NS_TRANSPARENT 0x1000000
#define CSS_COLOR_INHERIT 0x2000000
#define CSS_COLOR_NONE 0x3000000
#define CSS_COLOR_NOT_SET 0x4000000
Index: riscos/save_draw.c
===================================================================
--- riscos/save_draw.c (revision 8511)
+++ riscos/save_draw.c (working copy)
@@ -319,8 +319,8 @@
}
pencil_code code = pencil_path(ro_save_draw_diagram, path, i + 1,
- fill == TRANSPARENT ? pencil_TRANSPARENT : fill << 8,
- c == TRANSPARENT ? pencil_TRANSPARENT : c << 8,
+ fill == NS_TRANSPARENT ? pencil_TRANSPARENT : fill << 8,
+ c == NS_TRANSPARENT ? pencil_TRANSPARENT : c << 8,
width, pencil_JOIN_MITRED,
pencil_CAP_BUTT, pencil_CAP_BUTT, 0, 0, false,
pencil_SOLID);
Index: riscos/plotters.c
===================================================================
--- riscos/plotters.c (revision 8511)
+++ riscos/plotters.c (working copy)
@@ -311,7 +311,7 @@
trfm.entries[2][0] = (ro_plot_origin_x + transform[4] * 2) * 256;
trfm.entries[2][1] = (ro_plot_origin_y - transform[5] * 2) * 256;
- if (fill != TRANSPARENT) {
+ if (fill != NS_TRANSPARENT) {
error = xcolourtrans_set_gcol(fill << 8, 0,
os_ACTION_OVERWRITE, 0, 0);
if (error) {
@@ -328,7 +328,7 @@
}
}
- if (c != TRANSPARENT) {
+ if (c != NS_TRANSPARENT) {
error = xcolourtrans_set_gcol(c << 8, 0,
os_ACTION_OVERWRITE, 0, 0);
if (error) {
Index: desktop/save_pdf/pdf_plotters.c
===================================================================
--- desktop/save_pdf/pdf_plotters.c (revision 8511)
+++ desktop/save_pdf/pdf_plotters.c (working copy)
@@ -151,7 +151,7 @@
if (pstyle->fill_type != PLOT_OP_TYPE_NONE) {
- apply_clip_and_mode(false, pstyle->fill_colour, TRANSPARENT, 0., DashPattern_eNone);
+ apply_clip_and_mode(false, pstyle->fill_colour, NS_TRANSPARENT, 0., DashPattern_eNone);
/* Normalize boundaries of the area - to prevent
overflows. It is needed only in a few functions,
@@ -187,7 +187,7 @@
}
apply_clip_and_mode(false,
- TRANSPARENT,
+ NS_TRANSPARENT,
pstyle->stroke_colour,
pstyle->stroke_width,
dash);
@@ -219,7 +219,7 @@
}
apply_clip_and_mode(false,
- TRANSPARENT,
+ NS_TRANSPARENT,
pstyle->stroke_colour,
pstyle->stroke_width,
dash);
@@ -242,7 +242,7 @@
if (n == 0)
return true;
- apply_clip_and_mode(false, fill, TRANSPARENT, 0., DashPattern_eNone);
+ apply_clip_and_mode(false, fill, NS_TRANSPARENT, 0., DashPattern_eNone);
HPDF_Page_MoveTo(pdf_page, p[0], page_height - p[1]);
for (i = 1 ; i<n ; i++) {
@@ -298,7 +298,7 @@
if (length == 0)
return true;
- apply_clip_and_mode(true, c, TRANSPARENT, 0., DashPattern_eNone);
+ apply_clip_and_mode(true, c, NS_TRANSPARENT, 0., DashPattern_eNone);
haru_nsfont_apply_style(style, pdf_doc, pdf_page, &pdf_font, &size);
pdfw_gs_font(pdf_page, pdf_font, size);
@@ -326,7 +326,7 @@
/* FIXME: line width 1 is ok ? */
apply_clip_and_mode(false,
- filled ? c : TRANSPARENT, filled ? TRANSPARENT : c,
+ filled ? c : NS_TRANSPARENT, filled ? NS_TRANSPARENT : c,
1., DashPattern_eNone);
HPDF_Page_Circle(pdf_page, x, page_height - y, radius);
@@ -346,7 +346,7 @@
#endif
/* FIXME: line width 1 is ok ? */
- apply_clip_and_mode(false, TRANSPARENT, c, 1., DashPattern_eNone);
+ apply_clip_and_mode(false, NS_TRANSPARENT, c, 1., DashPattern_eNone);
/* Normalize angles */
angle1 %= 360;
@@ -376,7 +376,7 @@
if (width == 0 || height == 0)
return true;
- apply_clip_and_mode(false, TRANSPARENT, TRANSPARENT, 0., DashPattern_eNone);
+ apply_clip_and_mode(false, NS_TRANSPARENT, NS_TRANSPARENT, 0., DashPattern_eNone);
image = pdf_extract_image(bitmap);
if (!image)
@@ -487,14 +487,14 @@
* colour, line width and dash pattern parameters.
* \param selectTextMode true if text mode needs to be entered if required;
* false otherwise.
- * \param fillCol Desired fill colour, use TRANSPARENT if no update is
+ * \param fillCol Desired fill colour, use NS_TRANSPARENT if no update is
* required.
- * \param strokeCol Desired stroke colour, use TRANSPARENT if no update is
+ * \param strokeCol Desired stroke colour, use NS_TRANSPARENT if no update is
* required.
* \param lineWidth Desired line width. Only taken into account when strokeCol
- * is different from TRANSPARENT.
+ * is different from NS_TRANSPARENT.
* \param dash Desired dash pattern. Only taken into account when strokeCol
- * is different from TRANSPARENT.
+ * is different from NS_TRANSPARENT.
*/
static void apply_clip_and_mode(bool selectTextMode, colour fillCol,
colour strokeCol, float lineWidth, DashPattern_e dash)
@@ -508,9 +508,9 @@
* outside the text mode anyway (i.e. selectTextMode is false).
*/
if (in_text_mode && (!selectTextMode || clip_update_needed
- || (fillCol != TRANSPARENT
+ || (fillCol != NS_TRANSPARENT
&& fillCol != pdfw_gs[pdfw_gs_level].fillColour)
- /* || (strokeCol != TRANSPARENT
+ /* || (strokeCol != NS_TRANSPARENT
&& (strokeCol != pdfw_gs[pdfw_gs_level].strokeColour
|| lineWidth != pdfw_gs[pdfw_gs_level].lineWidth
|| dash != pdfw_gs[pdfw_gs_level].dash)) */)) {
@@ -522,9 +522,9 @@
pdfw_gs_restore(pdf_page);
/* Update fill/stroke colour, linewidth and dash when needed. */
- if (fillCol != TRANSPARENT)
+ if (fillCol != NS_TRANSPARENT)
pdfw_gs_fillcolour(pdf_page, fillCol);
- if (strokeCol != TRANSPARENT) {
+ if (strokeCol != NS_TRANSPARENT) {
pdfw_gs_strokecolour(pdf_page, strokeCol);
pdfw_gs_linewidth(pdf_page, lineWidth);
pdfw_gs_dash(pdf_page, dash);
@@ -573,7 +573,7 @@
if (n == 0)
return true;
- if (c == TRANSPARENT && fill == TRANSPARENT)
+ if (c == NS_TRANSPARENT && fill == NS_TRANSPARENT)
return true;
if (p[0] != PLOTTER_PATH_MOVE)
@@ -619,8 +619,8 @@
return true;
}
- if (fill != TRANSPARENT) {
- if (c != TRANSPARENT)
+ if (fill != NS_TRANSPARENT) {
+ if (c != NS_TRANSPARENT)
HPDF_Page_FillStroke(pdf_page);
else
HPDF_Page_Fill(pdf_page);
@@ -679,7 +679,7 @@
#endif
clip_update_needed = false;
if (pdf_page != NULL) {
- apply_clip_and_mode(false, TRANSPARENT, TRANSPARENT, 0.,
+ apply_clip_and_mode(false, NS_TRANSPARENT, NS_TRANSPARENT, 0.,
DashPattern_eNone);
pdfw_gs_restore(pdf_page);
}
@@ -716,7 +716,7 @@
#endif
clip_update_needed = false;
if (pdf_page != NULL) {
- apply_clip_and_mode(false, TRANSPARENT, TRANSPARENT, 0.,
+ apply_clip_and_mode(false, NS_TRANSPARENT, NS_TRANSPARENT, 0.,
DashPattern_eNone);
pdfw_gs_restore(pdf_page);
}
Index: amiga/plotters.c
===================================================================
--- amiga/plotters.c (revision 8511)
+++ amiga/plotters.c (working copy)
@@ -732,10 +732,10 @@
cairo_set_matrix(glob->cr, &old_ctm);
/* Now draw path */
- if (fill != TRANSPARENT) {
+ if (fill != NS_TRANSPARENT) {
ami_cairo_set_colour(glob->cr,fill);
- if (c != TRANSPARENT) {
+ if (c != NS_TRANSPARENT) {
/* Fill & Stroke */
cairo_fill_preserve(glob->cr);
ami_cairo_set_colour(glob->cr,c);
@@ -744,7 +744,7 @@
/* Fill only */
cairo_fill(glob->cr);
}
- } else if (c != TRANSPARENT) {
+ } else if (c != NS_TRANSPARENT) {
/* Stroke only */
ami_cairo_set_colour(glob->cr,c);
cairo_stroke(glob->cr);