diff options
Diffstat (limited to 'riscos')
-rw-r--r-- | riscos/dialog.c | 143 | ||||
-rw-r--r-- | riscos/gui.h | 18 | ||||
-rw-r--r-- | riscos/history.c | 7 | ||||
-rw-r--r-- | riscos/hotlist.c | 27 | ||||
-rw-r--r-- | riscos/htmlredraw.c | 8 | ||||
-rw-r--r-- | riscos/image.c | 42 | ||||
-rw-r--r-- | riscos/image.h | 2 | ||||
-rw-r--r-- | riscos/menus.c | 55 | ||||
-rw-r--r-- | riscos/options.h | 16 | ||||
-rw-r--r-- | riscos/plotters.c | 4 | ||||
-rw-r--r-- | riscos/sprite.c | 2 | ||||
-rw-r--r-- | riscos/thumbnail.c | 132 | ||||
-rw-r--r-- | riscos/tinct.h | 25 | ||||
-rw-r--r-- | riscos/window.c | 17 |
14 files changed, 304 insertions, 194 deletions
diff --git a/riscos/dialog.c b/riscos/dialog.c index 9246def29..32dbb2ddc 100644 --- a/riscos/dialog.c +++ b/riscos/dialog.c @@ -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; } } @@ -810,6 +859,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. */ @@ -825,6 +913,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); diff --git a/riscos/gui.h b/riscos/gui.h index 6dc19ece0..d034cabb9 100644 --- a/riscos/gui.h +++ b/riscos/gui.h @@ -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. diff --git a/riscos/history.c b/riscos/history.c index 8a11f4cb7..bb6adc17f 100644 --- a/riscos/history.c +++ b/riscos/history.c @@ -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, diff --git a/riscos/hotlist.c b/riscos/hotlist.c index f7ed7516b..2e9797f13 100644 --- a/riscos/hotlist.c +++ b/riscos/hotlist.c @@ -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; } diff --git a/riscos/htmlredraw.c b/riscos/htmlredraw.c index 20dfddae6..9822e9cb0 100644 --- a/riscos/htmlredraw.c +++ b/riscos/htmlredraw.c @@ -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; diff --git a/riscos/image.c b/riscos/image.c index e0b06b6ca..cddb378f9 100644 --- a/riscos/image.c +++ b/riscos/image.c @@ -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; diff --git a/riscos/image.h b/riscos/image.h index 17b9f08b6..b2f8b9b09 100644 --- a/riscos/image.h +++ b/riscos/image.h @@ -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 diff --git a/riscos/menus.c b/riscos/menus.c index cdf2592f8..137beb741 100644 --- a/riscos/menus.c +++ b/riscos/menus.c @@ -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; diff --git a/riscos/options.h b/riscos/options.h index 66970ca28..932486569 100644 --- a/riscos/options.h +++ b/riscos/options.h @@ -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 }, \ diff --git a/riscos/plotters.c b/riscos/plotters.c index 982fe7b15..33a618cac 100644 --- a/riscos/plotters.c +++ b/riscos/plotters.c @@ -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);
}
diff --git a/riscos/sprite.c b/riscos/sprite.c index f4a187f1d..0174cc1bd 100644 --- a/riscos/sprite.c +++ b/riscos/sprite.c @@ -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 diff --git a/riscos/thumbnail.c b/riscos/thumbnail.c index 763a7b57f..4f2b9399c 100644 --- a/riscos/thumbnail.c +++ b/riscos/thumbnail.c @@ -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; - - /* 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); + if (content->width) scale = (float) width / (float) content->width; - /* 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; + /* Set up plotters + */ + plot = ro_plotters; + ro_plot_origin_x = 0; + ro_plot_origin_y = height * 2; + ro_plot_set_scale(scale); - /* Switch output to the final sprite - */ + /* 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); + + /* 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; diff --git a/riscos/tinct.h b/riscos/tinct.h index 9bf05c8ab..2a1a4a44e 100644 --- a/riscos/tinct.h +++ b/riscos/tinct.h @@ -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 diff --git a/riscos/window.c b/riscos/window.c index 0ef336453..b86fb61e9 100644 --- a/riscos/window.c +++ b/riscos/window.c @@ -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" @@ -364,6 +365,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. * * \param g gui_window to redraw @@ -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; |