[project @ 2004-11-02 23:23:07 by rjw]

Fix for recent GIF decoding bug. Rectangular pixel mode-friendly sprites for hotlist. Slight change to history image size to please Tinct. Support for foreground and background image quality settings. Support for error diffusion and bi-linear filtering (Tinct still requires some further work)

svn path=/import/netsurf/; revision=1336
This commit is contained in:
Richard Wilson 2004-11-02 23:23:07 +00:00
parent be3ce1f3a9
commit 1fbcdd14d5
24 changed files with 329 additions and 198 deletions

View File

@ -1,4 +1,4 @@
| Run file for NetSurf. ( $Revision: 1.30 $ )
| Run file for NetSurf. ( $Revision: 1.31 $ )
|
| This file ensures that the system resources required by NetSurf are
| present. Additionally, it forces setting of system variables related
@ -54,8 +54,8 @@ RMEnsure MimeMap 0.10 Error NetSurf requires MimeMap 0.10 or later
| Ensure Tinct is loaded
| http://www.tinct.net
RMEnsure Tinct 0.07 RMLoad System:Modules.Tinct
RMEnsure Tinct 0.07 Error NetSurf requires Tinct 0.07 or later. This can be downloaded from http://www.tinct.net
RMEnsure Tinct 0.09 RMLoad System:Modules.Tinct
RMEnsure Tinct 0.09 Error NetSurf requires Tinct 0.09 or later. This can be downloaded from http://www.tinct.net
| Ensure Iconv
| http://moose.mine.nu:6888/iconv002.zip

Binary file not shown.

View File

@ -78,6 +78,13 @@ ProxyNone:Keine
ProxyBasic:Basic
ProxyNTLM:NTLM
# Image redraw style
Display:Display
ImgStyle0:Use OS
ImgStyle1:Direct to screen
ImgStyle2:Dithered
ImgStyle3:Error diffused
# Hotlist menus
Hotlist:Hotlist
New:Neu

Binary file not shown.

View File

@ -78,6 +78,13 @@ ProxyNone:None
ProxyBasic:Basic
ProxyNTLM:NTLM
# Image redraw style
Display:Display
ImgStyle0:Use OS
ImgStyle1:Direct to screen
ImgStyle2:Dithered
ImgStyle3:Error diffused
# Toolbar menus
Toolbar:Toolbar
Icons:Buttons

Binary file not shown.

View File

@ -78,6 +78,13 @@ ProxyNone:Aucune
ProxyBasic:Basique
ProxyNTLM:NTLM
# Image redraw style
Display:Display
ImgStyle0:Use OS
ImgStyle1:Direct to screen
ImgStyle2:Dithered
ImgStyle3:Error diffused
# Hotlist menus
Hotlist:Favoris
New:Nouveau

Binary file not shown.

View File

@ -64,7 +64,7 @@ typedef struct gif_animation {
bool global_colours; /**< whether the GIF has a global colour table */
unsigned int *global_colour_table; /**< global colour table */
unsigned int *local_colour_table; /**< local colour table */
bool dirty_frame; /**< whether the curent frame needs erasing on animation */
unsigned int dirty_frame; /**< the current dirty frame, or -1 for none */
struct bitmap *frame_image; /**< currently decoded image */
} gif_animation;

View File

@ -162,7 +162,7 @@ utils/translit.c: transtab
# available), remove */*.[ch] from the line below.
# Under RISC OS, you may require *Set UnixFS$sfix "", if perl gives
# "No such file or directory" errors.
depend: */*.[ch]
depend:
@echo "--> modified files $?"
@echo "--> updating dependencies"
@-mkdir -p $(OBJDIR_RISCOS) $(OBJDIR_NCOS) $(OBJDIR_DEBUG) $(OBJDIR_GTK)

View File

@ -43,7 +43,7 @@ wimp_w dialog_info, dialog_saveas, dialog_config, dialog_config_br,
dialog_zoom, dialog_pageinfo, dialog_objinfo, dialog_tooltip,
dialog_warning, dialog_config_th_pane, dialog_debug,
dialog_folder, dialog_entry, dialog_search, dialog_print,
dialog_config_font;
dialog_config_font, dialog_config_image;
static int ro_gui_choices_font_size;
static int ro_gui_choices_font_min_size;
@ -53,6 +53,9 @@ static int ro_gui_choices_http_proxy_auth;
static int config_br_icon = -1;
static const char *ro_gui_choices_lang = 0;
static const char *ro_gui_choices_alang = 0;
static int ro_gui_choices_image_edit_type = 0;
static unsigned int ro_gui_choices_fg_plot_style = 0;
static unsigned int ro_gui_choices_bg_plot_style = 0;
struct toolbar_display {
@ -75,6 +78,10 @@ static const char *ro_gui_proxy_auth_name[] = {
"ProxyNone", "ProxyBasic", "ProxyNTLM"
};
static const char *ro_gui_image_name[] = {
"ImgStyle0", "ImgStyle1", "ImgStyle2", "ImgStyle3"
};
/* A simple mapping of parent and child
*/
@ -84,10 +91,12 @@ static struct {
} persistant_dialog[MAX_PERSISTANT];
static void ro_gui_dialog_config_prepare(void);
static void ro_gui_dialog_set_image_quality(int icon, unsigned int tinct_options);
static void ro_gui_dialog_config_set(void);
static void ro_gui_dialog_click_config(wimp_pointer *pointer);
static void ro_gui_dialog_click_config_br(wimp_pointer *pointer);
static void ro_gui_dialog_click_config_prox(wimp_pointer *pointer);
static void ro_gui_dialog_click_config_image(wimp_pointer *pointer);
static void ro_gui_dialog_config_proxy_update(void);
static void ro_gui_dialog_click_config_th(wimp_pointer *pointer);
static void ro_gui_dialog_click_config_th_pane(wimp_pointer *pointer);
@ -129,6 +138,7 @@ void ro_gui_dialog_init(void)
dialog_search = ro_gui_dialog_create("search");
dialog_print = ro_gui_dialog_create("print");
dialog_config_font = ro_gui_dialog_create("config_font");
dialog_config_image = ro_gui_dialog_create("config_img");
}
@ -419,6 +429,8 @@ void ro_gui_dialog_click(wimp_pointer *pointer)
ro_gui_dialog_click_config_br(pointer);
else if (pointer->w == dialog_config_prox)
ro_gui_dialog_click_config_prox(pointer);
else if (pointer->w == dialog_config_image)
ro_gui_dialog_click_config_image(pointer);
else if (pointer->w == dialog_config_th)
ro_gui_dialog_click_config_th(pointer);
else if (pointer->w == dialog_config_th_pane)
@ -461,6 +473,8 @@ void ro_gui_dialog_open_config(void)
false);
ro_gui_set_icon_selected_state(dialog_config, ICON_CONFIG_FONT,
false);
ro_gui_set_icon_selected_state(dialog_config, ICON_CONFIG_IMAGE,
false);
ro_gui_dialog_open(dialog_config);
ro_gui_open_pane(dialog_config, dialog_config_br, 0);
}
@ -543,8 +557,29 @@ void ro_gui_dialog_config_prepare(void)
"Homerton.Medium");
ro_gui_set_icon_selected_state(dialog_config_font,
ICON_CONFIG_FONT_USE_UFONT, option_font_ufont);
/* image pane */
ro_gui_choices_fg_plot_style = option_fg_plot_style;
ro_gui_choices_bg_plot_style = option_bg_plot_style;
ro_gui_dialog_set_image_quality(ICON_CONFIG_IMG_FG_DISP, option_fg_plot_style);
ro_gui_dialog_set_image_quality(ICON_CONFIG_IMG_BG_DISP, option_bg_plot_style);
}
void ro_gui_dialog_set_image_quality(int icon, unsigned int tinct_options) {
int i = 1;
if (tinct_options & tinct_USE_OS_SPRITE_OP) {
i = 0;
} else if (tinct_options & tinct_ERROR_DIFFUSE) {
i = 3;
} else if (tinct_options & tinct_DITHER) {
i = 2;
}
ro_gui_set_icon_string(dialog_config_image, icon,
messages_get(ro_gui_image_name[i]));
ro_gui_set_icon_selected_state(dialog_config_image, icon + 3,
(tinct_options & tinct_BILINEAR_FILTER));
}
/**
* Set the current options to the settings in the choices panes.
@ -639,6 +674,14 @@ void ro_gui_dialog_config_set(void) {
dialog_config_font, ICON_CONFIG_FONT_DEF));
option_font_ufont = ro_gui_get_icon_selected_state(
dialog_config_font, ICON_CONFIG_FONT_USE_UFONT);
/* image pane */
if ((option_fg_plot_style != (int)ro_gui_choices_fg_plot_style) ||
(option_bg_plot_style != (int)ro_gui_choices_bg_plot_style)) {
option_fg_plot_style = ro_gui_choices_fg_plot_style;
option_bg_plot_style = ro_gui_choices_bg_plot_style;
ro_gui_window_redraw_all();
}
}
@ -712,6 +755,12 @@ void ro_gui_dialog_click_config(wimp_pointer *pointer)
ICON_CONFIG_FONT, true);
ro_gui_open_pane(dialog_config, dialog_config_font, 0);
break;
case ICON_CONFIG_IMAGE:
if (pointer->buttons == wimp_CLICK_ADJUST)
ro_gui_set_icon_selected_state(dialog_config,
ICON_CONFIG_IMAGE, true);
ro_gui_open_pane(dialog_config, dialog_config_image, 0);
break;
}
}
@ -809,6 +858,45 @@ void ro_gui_dialog_click_config_prox(wimp_pointer *pointer)
}
/**
* Handle clicks in the Proxy Choices pane.
*/
void ro_gui_dialog_click_config_image(wimp_pointer *pointer)
{
switch (pointer->i) {
case ICON_CONFIG_IMG_FG_MENU:
ro_gui_choices_image_edit_type = 1;
ro_gui_menu_prepare_image_quality(ro_gui_choices_fg_plot_style);
ro_gui_popup_menu(image_quality_menu, dialog_config_image,
pointer->i);
break;
case ICON_CONFIG_IMG_FG_FILTER:
if (ro_gui_get_icon_selected_state(dialog_config_image,
ICON_CONFIG_IMG_FG_FILTER)) {
ro_gui_choices_fg_plot_style |= tinct_BILINEAR_FILTER;
} else {
ro_gui_choices_fg_plot_style &= ~tinct_BILINEAR_FILTER;
}
break;
case ICON_CONFIG_IMG_BG_MENU:
ro_gui_choices_image_edit_type = 2;
ro_gui_menu_prepare_image_quality(ro_gui_choices_bg_plot_style);
ro_gui_popup_menu(image_quality_menu, dialog_config_image,
pointer->i);
break;
case ICON_CONFIG_IMG_BG_FILTER:
if (ro_gui_get_icon_selected_state(dialog_config_image,
ICON_CONFIG_IMG_BG_FILTER)) {
ro_gui_choices_bg_plot_style |= tinct_BILINEAR_FILTER;
} else {
ro_gui_choices_bg_plot_style &= ~tinct_BILINEAR_FILTER;
}
break;
}
}
/**
* Handle a selection from the proxy auth method popup menu.
*/
@ -824,6 +912,35 @@ void ro_gui_dialog_proxyauth_menu_selection(int item)
}
/**
* Handle a selection from the image quality popup menu.
*/
void ro_gui_dialog_image_menu_selection(int item)
{
unsigned int tinct_options = 0;
if (item == 0) {
tinct_options = tinct_USE_OS_SPRITE_OP;
} else if (item == 2) {
tinct_options = tinct_DITHER;
} else if (item == 3) {
tinct_options = tinct_ERROR_DIFFUSE;
}
if (ro_gui_choices_image_edit_type == 1) {
ro_gui_choices_fg_plot_style &= tinct_BILINEAR_FILTER;
ro_gui_choices_fg_plot_style |= tinct_options;
ro_gui_dialog_set_image_quality(ICON_CONFIG_IMG_FG_DISP,
ro_gui_choices_fg_plot_style);
} else {
ro_gui_choices_bg_plot_style &= tinct_BILINEAR_FILTER;
ro_gui_choices_bg_plot_style |= tinct_options;
ro_gui_dialog_set_image_quality(ICON_CONFIG_IMG_BG_DISP,
ro_gui_choices_bg_plot_style);
}
ro_gui_menu_prepare_image_quality(tinct_options);
}
/**
* Update greying of icons in the proxy choices pane.
*/
@ -873,21 +990,21 @@ void ro_gui_dialog_click_config_th(wimp_pointer *pointer)
*/
void ro_gui_dialog_click_config_th_pane(wimp_pointer *pointer) {
struct toolbar_display *link;
int i = pointer->i;
if (i < 0) return;
int i = pointer->i;
if (i < 0) return;
/* Set the clicked theme as selected
*/
link = toolbars;
while (link) {
if ((link->icon_number == i) || (link->icon_number == (i - 1))) {
theme_choice = link->descriptor;
ro_gui_set_icon_selected_state(dialog_config_th_pane,
link->icon_number, true);
} else {
ro_gui_set_icon_selected_state(dialog_config_th_pane,
link->icon_number, false);
}
if ((link->icon_number == i) || (link->icon_number == (i - 1))) {
theme_choice = link->descriptor;
ro_gui_set_icon_selected_state(dialog_config_th_pane,
link->icon_number, true);
} else {
ro_gui_set_icon_selected_state(dialog_config_th_pane,
link->icon_number, false);
}
link = link->next;
}
}
@ -1333,8 +1450,8 @@ void ro_gui_dialog_load_themes(void) {
*/
link = toolbars;
while (link) {
ro_gui_set_icon_selected_state(dialog_config_th_pane,
link->icon_number, (link->descriptor == theme_choice));
ro_gui_set_icon_selected_state(dialog_config_th_pane,
link->icon_number, (link->descriptor == theme_choice));
link = link->next;
}
xwimp_force_redraw(dialog_config_th_pane, 0, -16384, 16384, 16384);

View File

@ -33,7 +33,8 @@ extern wimp_w dialog_info, dialog_saveas, dialog_config, dialog_config_br,
extern wimp_w history_window;
extern wimp_w hotlist_window;
extern wimp_menu *iconbar_menu, *browser_menu, *combo_menu, *hotlist_menu,
*proxyauth_menu, *languages_menu, *toolbar_menu;
*proxyauth_menu, *languages_menu, *toolbar_menu,
*image_quality_menu;
extern int iconbar_menu_height;
extern struct form_control *current_gadget;
extern bool gui_reformat_pending;
@ -85,8 +86,6 @@ struct gui_window {
/** Options. */
struct {
float scale; /**< Scale, 1.0 = 100%. */
bool dither_sprites; /**< Images should be dithered. */
bool filter_sprites; /**< Images should be smoothed. */
bool animate_images; /**< Animations should run. */
bool background_images; /**< Display background images. */
bool background_blending; /**< Perform background blending on text. */
@ -118,6 +117,7 @@ void ro_gui_popup_menu(wimp_menu *menu, wimp_w w, wimp_i i);
void ro_gui_menu_selection(wimp_selection* selection);
void ro_gui_menu_warning(wimp_message_menu_warning *warning);
void ro_gui_prepare_navigate(struct gui_window *gui);
void ro_gui_menu_prepare_image_quality(unsigned int tinct_options);
void ro_gui_menu_prepare_scale(void);
void ro_gui_menu_prepare_pageinfo(void);
void ro_gui_display_font_menu(const char *tick, wimp_w w, wimp_i i);
@ -136,6 +136,7 @@ void ro_gui_dialog_close(wimp_w close);
void ro_gui_menu_prepare_hotlist(void);
void ro_gui_dialog_open_config(void);
void ro_gui_dialog_proxyauth_menu_selection(int item);
void ro_gui_dialog_image_menu_selection(int item);
void ro_gui_dialog_languages_menu_selection(char *lang);
void ro_gui_dialog_font_menu_selection(char *name);
@ -188,6 +189,7 @@ int window_y_units(int y, wimp_window_state *state);
bool ro_gui_window_dataload(struct gui_window *g, wimp_message *message);
void ro_gui_window_process_reformats(void);
void ro_gui_window_default_options(struct browser_window *bw);
void ro_gui_window_redraw_all(void);
/* in history.c */
void ro_gui_history_init(void);
@ -294,6 +296,7 @@ void ro_plot_set_scale(float scale);
#define ICON_CONFIG_PROXY 4
#define ICON_CONFIG_THEME 5
#define ICON_CONFIG_FONT 7
#define ICON_CONFIG_IMAGE 8
#define ICON_CONFIG_BR_LANG 1
#define ICON_CONFIG_BR_LANG_PICK 2
@ -316,6 +319,15 @@ void ro_plot_set_scale(float scale);
#define ICON_CONFIG_TH_GET 0
#define ICON_CONFIG_TH_MANAGE 1
#define ICON_CONFIG_IMG_FG_DISP 3
#define ICON_CONFIG_IMG_FG_MENU 4
#define ICON_CONFIG_IMG_FG_VF 5
#define ICON_CONFIG_IMG_FG_FILTER 6
#define ICON_CONFIG_IMG_BG_DISP 10
#define ICON_CONFIG_IMG_BG_MENU 11
#define ICON_CONFIG_IMG_BG_VF 12
#define ICON_CONFIG_IMG_BG_FILTER 13
/* Note: The display icon numbers for font names *must* be ONE less
* than the icon number of the corresponding pick icon.
* This is assumed by ro_gui_dialog_click_font.

View File

@ -26,7 +26,7 @@
#define SIZE 10
#define WIDTH 200
#define HEIGHT 150
#define HEIGHT 152
#define MARGIN 32
#define FULL_WIDTH (WIDTH + MARGIN + MARGIN)
#define FULL_HEIGHT (HEIGHT + MARGIN + MARGIN)
@ -406,7 +406,7 @@ void ro_gui_history_redraw_tree(struct history_entry *he,
/* Because we're supporting people with OS3.1 we need to check if the
sprite we have is a legacy 256 colour one
*/
if (header->mode == (os_mode)0x301680b5) {
if (header->mode == (os_mode)tinct_SPRITE_MODE) {
/* We plot with no mask and no scaling as any EIG factors are
handled internally by Tinct
@ -415,7 +415,7 @@ void ro_gui_history_redraw_tree(struct history_entry *he,
(char *)(header),
x0 + he->x * FULL_WIDTH + MARGIN,
y0 - he->y * FULL_HEIGHT - FULL_HEIGHT + MARGIN,
(option_filter_sprites?tinct_BILINEAR_FILTER:0) | (option_dither_sprites?tinct_DITHER:0));
tinct_ERROR_DIFFUSE);
} else {
unsigned int size;
os_factors factors;
@ -424,7 +424,6 @@ void ro_gui_history_redraw_tree(struct history_entry *he,
area, (osspriteop_id)header,
colourtrans_CURRENT_MODE, colourtrans_CURRENT_PALETTE,
0, colourtrans_GIVEN_SPRITE, 0, 0, &size);
LOG(("Table size of %i", size));
table = xcalloc(size, 1);
xcolourtrans_generate_table_for_sprite(
area, (osspriteop_id)header,

View File

@ -1285,7 +1285,8 @@ int ro_gui_hotlist_redraw_tree(struct hotlist_entry *entry, int level, int x0, i
*/
if (first && (level == 0)) {
_swix(Tinct_Plot, _IN(2) | _IN(3) | _IN(4) | _IN(7),
sprite[HOTLIST_BLINE], x0 + 8, y0 - HOTLIST_LINE_HEIGHT, 0);
sprite[HOTLIST_BLINE], x0 + 8, y0 - HOTLIST_LINE_HEIGHT,
tinct_BILINEAR_FILTER);
y0 -= HOTLIST_LINE_HEIGHT;
height -= HOTLIST_LINE_HEIGHT;
}
@ -1294,7 +1295,8 @@ int ro_gui_hotlist_redraw_tree(struct hotlist_entry *entry, int level, int x0, i
*/
while (height > 0) {
_swix(Tinct_Plot, _IN(2) | _IN(3) | _IN(4) | _IN(7),
sprite[HOTLIST_LINE], x0 + 8, y0 - HOTLIST_LINE_HEIGHT, 0);
sprite[HOTLIST_LINE], x0 + 8, y0 - HOTLIST_LINE_HEIGHT,
tinct_BILINEAR_FILTER);
y0 -= HOTLIST_LINE_HEIGHT;
height -= HOTLIST_LINE_HEIGHT;
}
@ -1304,7 +1306,8 @@ int ro_gui_hotlist_redraw_tree(struct hotlist_entry *entry, int level, int x0, i
*/
if (!first || (level != 0)) {
_swix(Tinct_Plot, _IN(2) | _IN(3) | _IN(4) | _IN(7),
sprite[HOTLIST_TLINE], x0 + 8, y0 - 22, 0);
sprite[HOTLIST_TLINE], x0 + 8, y0 - 22,
tinct_BILINEAR_FILTER);
height -= HOTLIST_LINE_HEIGHT;
y0 -= HOTLIST_LINE_HEIGHT;
}
@ -1314,14 +1317,17 @@ int ro_gui_hotlist_redraw_tree(struct hotlist_entry *entry, int level, int x0, i
*/
if (entry->children == 0) {
_swix(Tinct_Plot, _IN(2) | _IN(3) | _IN(4) | _IN(7),
sprite[HOTLIST_ENTRY], x0, box_y0 - 23, 0);
sprite[HOTLIST_ENTRY], x0, box_y0 - 23,
tinct_BILINEAR_FILTER);
} else {
if (entry->expanded) {
_swix(Tinct_Plot, _IN(2) | _IN(3) | _IN(4) | _IN(7),
sprite[HOTLIST_COLLAPSE], x0, box_y0 - 31, 0);
sprite[HOTLIST_COLLAPSE], x0, box_y0 - 31,
tinct_BILINEAR_FILTER);
} else {
_swix(Tinct_Plot, _IN(2) | _IN(3) | _IN(4) | _IN(7),
sprite[HOTLIST_EXPAND], x0, box_y0 - 31, 0);
sprite[HOTLIST_EXPAND], x0, box_y0 - 31,
tinct_BILINEAR_FILTER);
}
}
@ -1430,13 +1436,16 @@ int ro_gui_hotlist_redraw_item(struct hotlist_entry *entry, int level, int x0, i
while (line_height > 0) {
if (line_height == HOTLIST_LINE_HEIGHT) {
_swix(Tinct_Plot, _IN(2) | _IN(3) | _IN(4) | _IN(7),
sprite[HOTLIST_TLINE], x0 + 16, line_y0 - 22, 0);
sprite[HOTLIST_TLINE], x0 + 16, line_y0 - 22,
tinct_BILINEAR_FILTER);
} else {
_swix(Tinct_Plot, _IN(2) | _IN(3) | _IN(4) | _IN(7),
sprite[HOTLIST_LINE], x0 + 16, line_y0 - HOTLIST_LINE_HEIGHT, 0);
sprite[HOTLIST_LINE], x0 + 16, line_y0 - HOTLIST_LINE_HEIGHT,
tinct_BILINEAR_FILTER);
}
_swix(Tinct_Plot, _IN(2) | _IN(3) | _IN(4) | _IN(7),
sprite[HOTLIST_ENTRY], x0 + 8, line_y0 - 23, 0);
sprite[HOTLIST_ENTRY], x0 + 8, line_y0 - 23,
tinct_BILINEAR_FILTER);
line_height -= HOTLIST_LINE_HEIGHT;
line_y0 -= HOTLIST_LINE_HEIGHT;
}

View File

@ -1023,7 +1023,7 @@ bool html_redraw_background(int xi, int yi, int width, int height,
box->background->width * 2,
box->background->height * 2,
background_colour,
repeat_x, repeat_y,
repeat_x, repeat_y, true,
((box->background->bitmap->opaque) ?
IMAGE_PLOT_TINCT_OPAQUE : IMAGE_PLOT_TINCT_ALPHA));
break;
@ -1036,7 +1036,7 @@ bool html_redraw_background(int xi, int yi, int width, int height,
box->background->width * 2,
box->background->height * 2,
background_colour,
repeat_x, repeat_y,
repeat_x, repeat_y, true,
((box->background->bitmap->opaque) ?
IMAGE_PLOT_TINCT_OPAQUE : IMAGE_PLOT_TINCT_ALPHA));
break;
@ -1048,7 +1048,7 @@ bool html_redraw_background(int xi, int yi, int width, int height,
box->background->width * 2,
box->background->height * 2,
background_colour,
repeat_x, repeat_y,
repeat_x, repeat_y, true,
IMAGE_PLOT_TINCT_OPAQUE);
break;
#endif
@ -1059,7 +1059,7 @@ bool html_redraw_background(int xi, int yi, int width, int height,
box->background->width * 2,
box->background->height * 2,
background_colour,
repeat_x, repeat_y,
repeat_x, repeat_y, true,
((box->background->bitmap->opaque) ?
IMAGE_PLOT_TINCT_OPAQUE : IMAGE_PLOT_TINCT_ALPHA));
break;

View File

@ -22,7 +22,7 @@
static bool image_redraw_tinct(osspriteop_area *area, int x, int y,
int req_width, int req_height, int width, int height,
unsigned long background_colour, bool repeatx, bool repeaty,
bool alpha);
bool alpha, unsigned int tinct_options);
static bool image_redraw_os(osspriteop_area *area, int x, int y,
int req_width, int req_height, int width, int height);
@ -39,31 +39,36 @@ static bool image_redraw_os(osspriteop_area *area, int x, int y,
* \param background_colour The background colour to blend to
* \param repeatx Repeat the image in the x direction
* \param repeaty Repeat the image in the y direction
* \param background Use background image settings (otherwise foreground)
* \param type The plot method to use
* \return true on success, false otherwise
*/
bool image_redraw(osspriteop_area *area, int x, int y, int req_width,
int req_height, int width, int height,
unsigned long background_colour,
bool repeatx, bool repeaty,image_type type)
bool repeatx, bool repeaty, bool background, image_type type)
{
unsigned int tinct_options;
req_width *= 2;
req_height *= 2;
width *= 2;
height *= 2;
tinct_options = background ? option_bg_plot_style : option_fg_plot_style;
switch (type) {
case IMAGE_PLOT_TINCT_ALPHA:
return image_redraw_tinct(area, x, y,
req_width, req_height,
width, height,
background_colour,
repeatx, repeaty, true);
repeatx, repeaty, true,
tinct_options);
case IMAGE_PLOT_TINCT_OPAQUE:
return image_redraw_tinct(area, x, y,
req_width, req_height,
width, height,
background_colour,
repeatx, repeaty, false);
repeatx, repeaty, false,
tinct_options);
case IMAGE_PLOT_OS:
return image_redraw_os(area, x, y, req_width,
req_height, width, height);
@ -88,38 +93,23 @@ bool image_redraw(osspriteop_area *area, int x, int y, int req_width,
* \param repeatx Repeat the image in the x direction
* \param repeaty Repeat the image in the y direction
* \param alpha Use the alpha channel
* \param tinct_options The base option set to use
* \return true on success, false otherwise
*/
bool image_redraw_tinct(osspriteop_area *area, int x, int y,
int req_width, int req_height, int width, int height,
unsigned long background_colour, bool repeatx, bool repeaty,
bool alpha)
bool alpha, unsigned int tinct_options)
{
unsigned int tinct_options;
_kernel_oserror *error;
if (ro_gui_current_redraw_gui) {
tinct_options =
(ro_gui_current_redraw_gui->option.filter_sprites ?
tinct_BILINEAR_FILTER : 0)
|
(ro_gui_current_redraw_gui->option.dither_sprites ?
tinct_DITHER : 0);
} else {
tinct_options =
(option_filter_sprites ? tinct_BILINEAR_FILTER : 0)
|
(option_dither_sprites ? tinct_DITHER : 0);
}
if (print_active) {
tinct_options |= tinct_USE_OS_SPRITE_OP |
background_colour << tinct_BACKGROUND_SHIFT;
}
/* Set up our flagword
*/
tinct_options |= background_colour << tinct_BACKGROUND_SHIFT;
if (print_active)
tinct_options |= tinct_USE_OS_SPRITE_OP;
if (repeatx)
tinct_options |= tinct_FILL_HORIZONTALLY;
if (repeaty)
tinct_options |= tinct_FILL_VERTICALLY;

View File

@ -19,6 +19,6 @@ typedef enum {
bool image_redraw(osspriteop_area *area, int x, int y, int req_width,
int req_height, int width, int height,
unsigned long background_colour,
bool repeatx, bool repeaty, image_type type);
bool repeatx, bool repeaty, bool background, image_type type);
#endif

View File

@ -25,6 +25,7 @@
#include "netsurf/riscos/gui.h"
#include "netsurf/riscos/help.h"
#include "netsurf/riscos/options.h"
#include "netsurf/riscos/tinct.h"
#include "netsurf/riscos/theme.h"
#include "netsurf/riscos/wimp.h"
#include "netsurf/utils/log.h"
@ -183,14 +184,12 @@ static wimp_MENU(5) navigate_menu = {
/* Image submenu
*/
static wimp_MENU(5) image_menu = {
static wimp_MENU(3) image_menu = {
{ "Images" }, 7,2,7,0, 300, 44, 0,
{
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS | wimp_ICON_SHADED, { "ForeImg" } },
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "BackImg" } },
{ wimp_MENU_SEPARATE, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "AnimImg" } },
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "DitherImg" } },
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "FilterImg" } }
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "AnimImg" } }
}
};
@ -402,6 +401,20 @@ static wimp_MENU(3) proxy_menu = {
wimp_menu *proxyauth_menu = (wimp_menu *) &proxy_menu;
/* Image display quality popup menu (used in image Choices dialog)
*/
static wimp_MENU(4) imageq_menu = {
{ "Display" }, 7,2,7,0, 200, 44, 0,
{
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ImgStyle0" } },
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ImgStyle1" } },
{ 0, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ImgStyle2" } },
{ wimp_MENU_LAST, wimp_NO_SUB_MENU, DEFAULT_FLAGS, { "ImgStyle3" } }
}
};
wimp_menu *image_quality_menu = (wimp_menu *) &imageq_menu;
/* Toolbar icon submenus.
The index of the name must be identical to the toolbar icon number.
*/
@ -531,6 +544,8 @@ void ro_gui_menus_init(void)
translate_menu(proxyauth_menu);
translate_menu(image_quality_menu);
build_languages_menu();
iconbar_menu->entries[0].sub_menu = (wimp_menu *) dialog_info;
@ -991,14 +1006,8 @@ void ro_gui_menu_selection(wimp_selection *selection)
!current_gui->option.background_images;
if (selection->items[2] == 2) current_gui->option.animate_images =
!current_gui->option.animate_images;
if (selection->items[2] == 3) current_gui->option.dither_sprites =
!current_gui->option.dither_sprites;
if (selection->items[2] == 4) current_gui->option.filter_sprites =
!current_gui->option.filter_sprites;
if (selection->items[2] >= 1) {
ro_gui_menu_prepare_images();
gui_window_redraw_window(current_gui);
}
ro_gui_menu_prepare_images();
gui_window_redraw_window(current_gui);
break;
case 2: /* Toolbars -> */
switch (selection->items[2]) {
@ -1118,7 +1127,8 @@ void ro_gui_menu_selection(wimp_selection *selection)
} else if (current_menu == proxyauth_menu) {
ro_gui_dialog_proxyauth_menu_selection(selection->items[0]);
} else if (current_menu == image_quality_menu) {
ro_gui_dialog_image_menu_selection(selection->items[0]);
} else if (current_menu == languages_menu) {
ro_gui_dialog_languages_menu_selection(languages_menu->entries[selection->items[0]].data.indirected_text.text);
} else if (current_menu == font_menu) {
@ -1591,10 +1601,6 @@ static void ro_gui_menu_prepare_images(void) {
if (current_gui->option.background_images) browser_image_menu->entries[1].menu_flags |= wimp_MENU_TICKED;
browser_image_menu->entries[2].menu_flags &= ~wimp_MENU_TICKED;
if (current_gui->option.animate_images) browser_image_menu->entries[2].menu_flags |= wimp_MENU_TICKED;
browser_image_menu->entries[3].menu_flags &= ~wimp_MENU_TICKED;
if (current_gui->option.dither_sprites) browser_image_menu->entries[3].menu_flags |= wimp_MENU_TICKED;
browser_image_menu->entries[4].menu_flags &= ~wimp_MENU_TICKED;
if (current_gui->option.filter_sprites) browser_image_menu->entries[4].menu_flags |= wimp_MENU_TICKED;
}
@ -1852,6 +1858,21 @@ void ro_gui_menu_prepare_view(void) {
}
}
void ro_gui_menu_prepare_image_quality(unsigned int tinct_options) {
for (int i = 0; i < 4; i++)
image_quality_menu->entries[i].menu_flags &= ~wimp_MENU_TICKED;
if (tinct_options & tinct_USE_OS_SPRITE_OP) {
image_quality_menu->entries[0].menu_flags |= wimp_MENU_TICKED;
} else if (tinct_options & tinct_ERROR_DIFFUSE) {
image_quality_menu->entries[3].menu_flags |= wimp_MENU_TICKED;
} else if (tinct_options & tinct_DITHER) {
image_quality_menu->entries[2].menu_flags |= wimp_MENU_TICKED;
} else {
image_quality_menu->entries[1].menu_flags |= wimp_MENU_TICKED;
}
}
void ro_gui_menu_prepare_pageinfo(void)
{
struct content *c = current_gui->bw->current_content;

View File

@ -15,15 +15,15 @@
#define _NETSURF_RISCOS_OPTIONS_H_
#include "netsurf/desktop/options.h"
#include "netsurf/riscos/tinct.h"
extern bool option_use_mouse_gestures;
extern bool option_allow_text_selection;
extern char *option_theme;
extern char *option_language;
extern bool option_dither_sprites;
extern bool option_filter_sprites;
extern int option_fg_plot_style; /* tinct flagword */
extern int option_bg_plot_style; /* tinct flagword */
extern bool option_thumbnail_32bpp;
extern int option_thumbnail_oversampling;
extern bool option_history_tooltip;
extern int option_scale;
extern int option_toolbar_status_width;
@ -78,10 +78,9 @@ bool option_use_mouse_gestures = false;\
bool option_allow_text_selection = true;\
char *option_theme = 0;\
char *option_language = 0;\
bool option_dither_sprites = true;\
bool option_filter_sprites = false;\
int option_fg_plot_style = tinct_ERROR_DIFFUSE;\
int option_bg_plot_style = tinct_DITHER;\
bool option_thumbnail_32bpp = true;\
int option_thumbnail_oversampling = 0;\
bool option_history_tooltip = true; \
int option_scale = 100; \
int option_toolbar_status_width = 5000; \
@ -136,10 +135,9 @@ bool option_font_ufont = false;
{ "allow_text_selection", OPTION_BOOL, &option_allow_text_selection },\
{ "theme", OPTION_STRING, &option_theme },\
{ "language", OPTION_STRING, &option_language },\
{ "dither_sprites", OPTION_BOOL, &option_dither_sprites },\
{ "filter_sprites", OPTION_BOOL, &option_filter_sprites },\
{ "plot_fg_quality", OPTION_INTEGER, &option_fg_plot_style },\
{ "plot_bg_quality", OPTION_INTEGER, &option_bg_plot_style },\
{ "thumbnail_32bpp", OPTION_BOOL, &option_thumbnail_32bpp },\
{ "thumbnail_oversampling", OPTION_INTEGER, &option_thumbnail_oversampling },\
{ "history_tooltip", OPTION_BOOL, &option_history_tooltip }, \
{ "scale", OPTION_INTEGER, &option_scale }, \
{ "toolbar_show_status", OPTION_BOOL, &option_toolbar_show_status }, \

View File

@ -358,7 +358,7 @@ bool ro_plot_bitmap(int x, int y, int width, int height,
bitmap->width,
bitmap->height,
bg,
false, false,
false, false, false,
bitmap->opaque ? IMAGE_PLOT_TINCT_OPAQUE :
IMAGE_PLOT_TINCT_ALPHA);
}
@ -375,7 +375,7 @@ bool ro_plot_bitmap_tile(int x, int y, int width, int height,
bitmap->width,
bitmap->height,
bg,
repeat_x, repeat_y,
repeat_x, repeat_y, true,
bitmap->opaque ? IMAGE_PLOT_TINCT_OPAQUE :
IMAGE_PLOT_TINCT_ALPHA);
}

View File

@ -105,6 +105,6 @@ bool sprite_redraw(struct content *c, int x, int y,
{
return image_redraw(c->data.sprite.data, x, y, width, height,
c->width * 2, c->height * 2, background_colour,
false, false, IMAGE_PLOT_OS);
false, false, false, IMAGE_PLOT_OS);
}
#endif

View File

@ -63,112 +63,64 @@ static void thumbnail_restore_output(struct thumbnail_save_area *save_area);
*/
void thumbnail_create(struct content *content, osspriteop_area *area,
osspriteop_header *sprite, int width, int height) {
float scale;
osspriteop_area *oversampled_area = NULL;
float scale = 1.0;
osspriteop_area *temp_area = NULL;
struct thumbnail_save_area *save_area;
osspriteop_area *render_area = NULL;
/* Check for 32bpp support in case we've been called for a sprite
we didn't set up.
*/
if (thumbnail_32bpp_available == -1) thumbnail_test();
/* Check our oversampling is within a usable range
*/
if (option_thumbnail_oversampling < 0) option_thumbnail_oversampling = 0;
if (option_thumbnail_oversampling > 4) option_thumbnail_oversampling = 4;
/* Get the oversampled sprite holder. We perform oversamling if either we
want to oversample, or the output sprite is 8bpp and we can do 32bpp and
thus improve the final rendition via dithering.
/* Get a secondary holder for non-32bpp sprites as we get a better quality by
going to a 32bpp sprite and then down to an [n]bpp one.
*/
if ((thumbnail_32bpp_available == 1) &&
((option_thumbnail_oversampling > 0) || (sprite->mode != (os_mode)0x301680b5))) {
oversampled_area = thumbnail_initialise(
width << option_thumbnail_oversampling,
height << option_thumbnail_oversampling,
(sprite->mode != (os_mode)tinct_SPRITE_MODE)) {
temp_area = thumbnail_initialise(
width, height,
(os_mode)0x301680b5);
render_area = temp_area;
}
if (temp_area == NULL) render_area = area;
/* Oversample if we have an oversampled sprite, don't otherwise
/* Calculate the scale
*/
if (oversampled_area != NULL) {
/* Scale up for oversampling
*/
width = width << option_thumbnail_oversampling;
height = height << option_thumbnail_oversampling;
if (content->width) scale = (float) width / (float) content->width;
/* Calculate the scale
*/
scale = (float) width / (float) content->width;
/* Set up plotters
*/
plot = ro_plotters;
ro_plot_origin_x = 0;
ro_plot_origin_y = height * 2;
ro_plot_set_scale(scale);
/* Set up plotters
*/
plot = ro_plotters;
ro_plot_origin_x = 0;
ro_plot_origin_y = height * 2;
ro_plot_set_scale(scale);
/* Switch output and redraw
*/
save_area = thumbnail_switch_output(render_area, sprite);
if (save_area == NULL) {
if (temp_area) free(temp_area);
return;
}
colourtrans_set_gcol(os_COLOUR_WHITE, colourtrans_SET_BG,
os_ACTION_OVERWRITE, 0);
os_clg();
content_redraw(content, 0, 0, width, height,
0, 0, width, height, scale, 0xFFFFFF);
thumbnail_restore_output(save_area);
/* Switch output and redraw oversampled
*/
save_area = thumbnail_switch_output(oversampled_area,
(osspriteop_header *)(oversampled_area + 1));
if (save_area == NULL) return;
content_redraw(content, 0, 0, width, height,
0, 0, width, height, scale, 0xFFFFFF);
thumbnail_restore_output(save_area);
/* Scale back
*/
width = width >> option_thumbnail_oversampling;
height = height >> option_thumbnail_oversampling;
/* Switch output to the final sprite
*/
/* Go back from 32bpp to [n]bpp if we should.
*/
if (temp_area != NULL) {
save_area = thumbnail_switch_output(area, sprite);
if (save_area == NULL) {
free(oversampled_area);
return;
if (save_area != NULL) {
_swix(Tinct_Plot, _IN(2) | _IN(3) | _IN(4) | _IN(7),
(char *)(temp_area + 1), 0, 0,
tinct_ERROR_DIFFUSE);
thumbnail_restore_output(save_area);
}
/* Get Tinct to dither and bilinear filter back to what we want.
*/
_swix(Tinct_PlotScaled, _IN(2) | _IN(3) | _IN(4) | _IN(5) | _IN(6) | _IN(7),
(char *)(oversampled_area + 1), 0, 0, width * 2, height * 2,
tinct_BILINEAR_FILTER | tinct_DITHER);
/* Restore output
*/
thumbnail_restore_output(save_area);
/* Free oversampled memory area
*/
free(oversampled_area);
} else {
/* Calculate the scale
*/
if (content->width)
scale = (float) width / (float) content->width;
else
scale = 1.0;
/* Set up plotters
*/
plot = ro_plotters;
ro_plot_origin_x = 0;
ro_plot_origin_y = height * 2;
ro_plot_set_scale(scale);
/* Switch output and redraw
*/
save_area = thumbnail_switch_output(area, sprite);
if (save_area == NULL) return;
colourtrans_set_gcol(os_COLOUR_WHITE, colourtrans_SET_BG,
os_ACTION_OVERWRITE, 0);
os_clg();
content_redraw(content, 0, 0, width, height,
0, 0, width, height, scale, 0xFFFFFF);
thumbnail_restore_output(save_area);
free(temp_area);
}
}
@ -310,7 +262,7 @@ static void thumbnail_test(void) {
/* Try to create a 32bpp sprite
*/
if (xosspriteop_create_sprite(osspriteop_NAME, sprite_area,
"test", false, 1, 1, (os_mode)0x301680b5)) {
"test", false, 1, 1, (os_mode)tinct_SPRITE_MODE)) {
thumbnail_32bpp_available = 0;
} else {
thumbnail_32bpp_available = 1;

View File

@ -1,7 +1,7 @@
/*
* This file is part of NetSurf, http://netsurf.sourceforge.net/
* Licensed under the GNU General Public License,
* http://www.opensource.org/licenses/gpl-license
* http://www.opensource.org/licenses/gpl-license
* Copyright 2004 Richard Wilson <not_ginger_matt@hotmail.com>
*
* Complete details on using Tinct are available from http://www.tinct.net.
@ -43,20 +43,23 @@
*/
#define Tinct_AvailableFeatures 0x57245
/* Flags
/* Flags
*/
#define tinct_READ_SCREEN_BASE 0x01 /** <-- Use when hardware scrolling */
#define tinct_BILINEAR_FILTER 0x02 /** <-- Perform bi-linear filtering */
#define tinct_DITHER 0x04 /** <-- Perform dithering */
#define tinct_ERROR_DIFFUSE 0x08 /** <-- Perform error diffusion */
#define tinct_DITHER_INVERTED 0x0C /** <-- Perform dithering with inverted pattern */
#define tinct_FILL_HORIZONTALLY 0x10 /** <-- Horizontally fill clipping region with image */
#define tinct_FILL_VERTICALLY 0x20 /** <-- Vertically fill clipping region with image */
#define tinct_READ_SCREEN_BASE 0x01 /** <-- Use when hardware scrolling */
#define tinct_BILINEAR_FILTER 0x02 /** <-- Perform bi-linear filtering */
#define tinct_DITHER 0x04 /** <-- Perform dithering */
#define tinct_ERROR_DIFFUSE 0x08 /** <-- Perform error diffusion */
#define tinct_DITHER_INVERTED 0x0C /** <-- Perform dithering with inverted pattern */
#define tinct_FILL_HORIZONTALLY 0x10 /** <-- Horizontally fill clipping region with image */
#define tinct_FILL_VERTICALLY 0x20 /** <-- Vertically fill clipping region with image */
#define tinct_FORCE_PALETTE_READ 0x40 /** <-- Use after a palette change when out of the desktop */
#define tinct_USE_OS_SPRITE_OP 0x80 /** <-- Use when printing */
#define tinct_USE_OS_SPRITE_OP 0x80 /** <-- Use when printing */
/* Shifts
*/
#define tinct_BACKGROUND_SHIFT 0x08
#define tinct_BACKGROUND_SHIFT 0x08
/* Sprite mode
*/
#define tinct_SPRITE_MODE 0x301680b5
#endif

View File

@ -22,6 +22,7 @@
#include "oslib/wimp.h"
#include "oslib/wimpspriteop.h"
#include "netsurf/utils/config.h"
#include "netsurf/content/content.h"
#include "netsurf/css/css.h"
#include "netsurf/desktop/plotters.h"
#include "netsurf/render/box.h"
@ -363,6 +364,18 @@ void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
}
/**
* Redraws the content for all windows.
*/
void ro_gui_window_redraw_all(void)
{
struct gui_window *g;
for (g = window_list; g; g = g->next)
gui_window_redraw_window(g);
}
/**
* Force a redraw of the entire contents of a browser window.
*
@ -1772,8 +1785,6 @@ void ro_gui_window_clone_options(struct browser_window *new_bw,
*/
if (!old_gui) {
new_gui->option.scale = ((float)option_scale) / 100;
new_gui->option.dither_sprites = option_dither_sprites;
new_gui->option.filter_sprites = option_filter_sprites;
new_gui->option.animate_images = option_animate_images;
new_gui->option.background_images = option_background_images;
new_gui->option.background_blending = option_background_blending;
@ -1824,8 +1835,6 @@ void ro_gui_window_default_options(struct browser_window *bw) {
/* Save the basic options
*/
option_scale = gui->option.scale * 100;
option_dither_sprites = gui->option.dither_sprites;
option_filter_sprites = gui->option.filter_sprites;
option_animate_images = gui->option.animate_images;
option_background_blending = gui->option.background_blending;
option_buffer_animations = gui->option.buffer_animations;