summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2004-06-25 16:52:01 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2004-06-25 16:52:01 +0000
commitb3d4ce088308f6f53380688dbe6bef1b62743fdd (patch)
treecac0b1bf71f1dd334f5d0c452109da623a022e41 /riscos
parentaa6e904604cde92ff4883725caa69472be9159aa (diff)
downloadnetsurf-b3d4ce088308f6f53380688dbe6bef1b62743fdd.tar.gz
netsurf-b3d4ce088308f6f53380688dbe6bef1b62743fdd.tar.bz2
[project @ 2004-06-25 16:52:01 by jmb]
Background blend fonts if we can (and the user wants us to). Turned off by default. svn path=/import/netsurf/; revision=1007
Diffstat (limited to 'riscos')
-rw-r--r--riscos/htmlredraw.c47
-rw-r--r--riscos/options.h7
2 files changed, 38 insertions, 16 deletions
diff --git a/riscos/htmlredraw.c b/riscos/htmlredraw.c
index ce5ce211a..2b6f82ac5 100644
--- a/riscos/htmlredraw.c
+++ b/riscos/htmlredraw.c
@@ -103,6 +103,7 @@ void html_redraw_box(struct content *content, struct box * box,
int padding_width, padding_height;
int x0, y0, x1, y1;
int colour;
+ font_string_flags font_flags;
x += box->x * 2 * scale;
y -= box->y * 2 * scale;
@@ -221,18 +222,24 @@ void html_redraw_box(struct content *content, struct box * box,
int py1 = y < y1 ? y : y1;
/* background colour */
- /* optimisation: skip if fully repeated background image */
- if (box->style->background_color != TRANSPARENT &&
- (!box->background ||
+ if (box->style->background_color != TRANSPARENT) {
+ /* optimisation: skip if fully repeated bg image */
+ if (!box->background ||
box->style->background_repeat !=
- CSS_BACKGROUND_REPEAT_REPEAT)) {
- colourtrans_set_gcol(box->style->background_color << 8,
+ CSS_BACKGROUND_REPEAT_REPEAT) {
+
+ colourtrans_set_gcol(
+ box->style->background_color << 8,
colourtrans_USE_ECFS,
os_ACTION_OVERWRITE, 0);
- os_plot(os_MOVE_TO, px0, py0);
- if (px0 < px1 && py0 < py1)
- os_plot(os_PLOT_RECTANGLE | os_PLOT_TO,
+
+ os_plot(os_MOVE_TO, px0, py0);
+
+ if (px0 < px1 && py0 < py1)
+ os_plot(os_PLOT_RECTANGLE | os_PLOT_TO,
px1, py1);
+ }
+ /* set current background color for font painting */
current_background_color = box->style->background_color;
}
@@ -364,17 +371,29 @@ void html_redraw_box(struct content *content, struct box * box,
colourtrans_set_gcol((unsigned int)box->style->color << 8, colourtrans_USE_ECFS, os_ACTION_OVERWRITE, 0);
}
+ font_flags = font_OS_UNITS | font_GIVEN_FONT | font_KERN |
+ font_GIVEN_LENGTH;
+
+ /* font background blending (RO3.7+) */
+ if (option_background_blending) {
+ int version;
+ os_error *e;
+
+ /* Font manager versions below 3.35 complain
+ * about this flag being set.
+ */
+ e = xfont_cache_addr(&version, 0, 0);
+ /**\todo should we do anything else on error? */
+ if (!e && version >= 335)
+ font_flags |= font_BLEND_FONT;
+ }
if (scale == 1)
- font_paint(box->font->handle, box->text,
- font_OS_UNITS | font_GIVEN_FONT |
- font_KERN | font_GIVEN_LENGTH,
+ font_paint(box->font->handle, box->text, font_flags,
x, y - (int) (box->height * 1.5),
0, 0, (int) box->length);
else
font_paint(box->font->handle, box->text,
- font_OS_UNITS | font_GIVEN_FONT |
- font_KERN | font_GIVEN_LENGTH |
- font_GIVEN_TRFM,
+ font_flags | font_GIVEN_TRFM,
x, y - (int) (box->height * 1.5 * scale),
0, &trfm, (int) box->length);
diff --git a/riscos/options.h b/riscos/options.h
index 2c303dd92..bb00506ff 100644
--- a/riscos/options.h
+++ b/riscos/options.h
@@ -41,6 +41,7 @@ extern int option_window_screen_width;
extern int option_window_screen_height;
extern int option_minimum_gif_delay;
extern bool option_background_images;
+extern bool option_background_blending;
#define EXTRA_OPTION_DEFINE \
bool option_use_mouse_gestures = false;\
@@ -67,7 +68,8 @@ int option_window_height = 0; \
int option_window_screen_width = 0; \
int option_window_screen_height = 0; \
int option_minimum_gif_delay = 10; \
-bool option_background_images = true;
+bool option_background_images = true; \
+bool option_background_blending = false;
#define EXTRA_OPTION_TABLE \
{ "use_mouse_gestures", OPTION_BOOL, &option_use_mouse_gestures },\
@@ -94,6 +96,7 @@ bool option_background_images = true;
{ "window_screen_width", OPTION_INTEGER, &option_window_screen_width }, \
{ "window_screen_height", OPTION_INTEGER, &option_window_screen_height }, \
{ "minimum_gif_delay", OPTION_INTEGER, &option_minimum_gif_delay }, \
-{ "background_images", OPTION_BOOL, &option_background_images }
+{ "background_images", OPTION_BOOL, &option_background_images }, \
+{ "background_blending", OPTION_BOOL, &option_background_blending }
#endif