From fe7921a387c5a71c8ecba7bb605679b7dab4b86f Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sun, 13 Feb 2011 22:25:11 +0000 Subject: Pass clip rect as struct through content_redraw api. Update the front ends to use this. Note only RO build tested. svn path=/trunk/netsurf/; revision=11670 --- riscos/artworks.c | 8 ++++++-- riscos/artworks.h | 4 ++-- riscos/draw.c | 3 +-- riscos/draw.h | 4 ++-- riscos/plugin.c | 5 ++--- riscos/plugin.h | 4 ++-- riscos/print.c | 18 +++++++++++------- riscos/save_draw.c | 7 ++++++- riscos/sprite.c | 3 +-- riscos/sprite.h | 4 ++-- riscos/thumbnail.c | 7 ++++++- 11 files changed, 41 insertions(+), 26 deletions(-) (limited to 'riscos') diff --git a/riscos/artworks.c b/riscos/artworks.c index 385ec2b41..ecd3c3db2 100644 --- a/riscos/artworks.c +++ b/riscos/artworks.c @@ -224,8 +224,7 @@ void artworks_destroy(struct content *c) */ bool artworks_redraw(struct content *c, int x, int y, - int width, int height, - int clip_x0, int clip_y0, int clip_x1, int clip_y1, + int width, int height, struct rect *clip, float scale, colour background_colour) { static const ns_os_vdu_var_list vars = { @@ -243,6 +242,11 @@ bool artworks_redraw(struct content *c, int x, int y, os_trfm matrix; int vals[24]; + int clip_x0 = clip->x0; + int clip_y0 = clip->y0; + int clip_x1 = clip->x1; + int clip_y1 = clip->y1; + if (plot.flush && !plot.flush()) return false; diff --git a/riscos/artworks.h b/riscos/artworks.h index 1f88b5007..8642f76a9 100644 --- a/riscos/artworks.h +++ b/riscos/artworks.h @@ -24,6 +24,7 @@ #define _NETSURF_RISCOS_ARTWORKS_H_ struct content; +struct rect; struct content_artworks_data { int x0, y0, x1, y1; @@ -41,8 +42,7 @@ struct content_artworks_data { bool artworks_convert(struct content *c); void artworks_destroy(struct content *c); bool artworks_redraw(struct content *c, int x, int y, - int width, int height, - int clip_x0, int clip_y0, int clip_x1, int clip_y1, + int width, int height, struct rect *clip, float scale, colour background_colour); bool artworks_clone(const struct content *old, struct content *new_content); diff --git a/riscos/draw.c b/riscos/draw.c index fcde5a763..4c2cfd409 100644 --- a/riscos/draw.c +++ b/riscos/draw.c @@ -105,8 +105,7 @@ void draw_destroy(struct content *c) */ bool draw_redraw(struct content *c, int x, int y, - int width, int height, - int clip_x0, int clip_y0, int clip_x1, int clip_y1, + int width, int height, struct rect *clip, float scale, colour background_colour) { os_trfm matrix; diff --git a/riscos/draw.h b/riscos/draw.h index 854772e17..26c9ee08b 100644 --- a/riscos/draw.h +++ b/riscos/draw.h @@ -29,6 +29,7 @@ #include struct content; +struct rect; struct content_draw_data { int x0, y0; @@ -37,8 +38,7 @@ struct content_draw_data { bool draw_convert(struct content *c); void draw_destroy(struct content *c); bool draw_redraw(struct content *c, int x, int y, - int width, int height, - int clip_x0, int clip_y0, int clip_x1, int clip_y1, + int width, int height, struct rect *clip, float scale, colour background_colour); bool draw_clone(const struct content *old, struct content *new_content); diff --git a/riscos/plugin.c b/riscos/plugin.c index eae6ad0ed..71a0167a9 100644 --- a/riscos/plugin.c +++ b/riscos/plugin.c @@ -245,12 +245,11 @@ void plugin_destroy(struct content *c) * \param y Top of content box * \param width Width of content box * \param height Height of content box - * \param clip[xy][01] Clipping rectangle + * \param clip Clipping rectangle * \param scale Scale of page (1.0 = 100%) */ bool plugin_redraw(struct content *c, int x, int y, - int width, int height, - int clip_x0, int clip_y0, int clip_x1, int clip_y1, + int width, int height, struct rect *clip, float scale, colour background_colour) { /* do nothing */ diff --git a/riscos/plugin.h b/riscos/plugin.h index 6f288235a..290a00da3 100644 --- a/riscos/plugin.h +++ b/riscos/plugin.h @@ -31,6 +31,7 @@ struct browser_window; struct content; struct object_params; struct plugin_stream; +struct rect; /* We have one content per instance of a plugin */ struct content_plugin_data { @@ -58,8 +59,7 @@ bool plugin_convert(struct content *c, int width, int height); void plugin_reformat(struct content *c, int width, int height); void plugin_destroy(struct content *c); bool plugin_redraw(struct content *c, int x, int y, - int width, int height, - int clip_x0, int clip_y0, int clip_x1, int clip_y1, + int width, int height, struct rect *clip, float scale, colour background_colour); void plugin_open(struct content *c, struct browser_window *bw, struct content *page, unsigned int index, struct box *box, diff --git a/riscos/print.c b/riscos/print.c index 192fe5de4..575990f27 100644 --- a/riscos/print.c +++ b/riscos/print.c @@ -635,7 +635,7 @@ bool print_document(struct gui_window *g, const char *filename) print_active = true; do { - int clip_x0, clip_y0, clip_x1, clip_y1; + struct rect clip; os_box b; os_hom_trfm t; os_coord p; @@ -697,14 +697,14 @@ bool print_document(struct gui_window *g, const char *filename) while (more) { LOG(("redrawing area: [(%d, %d), (%d, %d)]", b.x0, b.y0, b.x1, b.y1)); - clip_x0 = (b.x0 - ro_plot_origin_x) / 2; - clip_y0 = (ro_plot_origin_y - b.y1) / 2; - clip_x1 = (b.x1 - ro_plot_origin_x) / 2; - clip_y1 = (ro_plot_origin_y - b.y0) / 2; + clip.x0 = (b.x0 - ro_plot_origin_x) / 2; + clip.y0 = (ro_plot_origin_y - b.y1) / 2; + clip.x1 = (b.x1 - ro_plot_origin_x) / 2; + clip.y1 = (ro_plot_origin_y - b.y0) / 2; if (!content_redraw(h, 0, 0, content_get_width(h), content_get_height(h), - clip_x0, clip_y0, clip_x1, clip_y1, + &clip, print_scale, 0xFFFFFF)) { error_message = "redraw error"; @@ -805,6 +805,7 @@ error: const char *print_declare_fonts(hlcache_handle *h) { unsigned int i; + struct rect clip; const char *error_message = 0; os_error *error; @@ -813,10 +814,13 @@ const char *print_declare_fonts(hlcache_handle *h) print_fonts_count = 0; print_fonts_error = 0; + clip.x0 = clip.y0 = INT_MIN; + clip.x1 = clip.y1 = INT_MAX; + plot = print_fonts_plotters; if (!content_redraw(h, 0, 0, content_get_width(h), content_get_height(h), - INT_MIN, INT_MIN, INT_MAX, INT_MAX, 1, 0xffffff)) { + &clip, 1, 0xffffff)) { if (print_fonts_error) return print_fonts_error; return "Declaring fonts failed."; diff --git a/riscos/save_draw.c b/riscos/save_draw.c index a142c63da..5fa93e4f7 100644 --- a/riscos/save_draw.c +++ b/riscos/save_draw.c @@ -32,6 +32,7 @@ #include "content/content.h" #include "content/hlcache.h" #include "desktop/plotters.h" +#include "desktop/shape.h" #include "riscos/bitmap.h" #include "riscos/gui.h" #include "riscos/save_draw.h" @@ -89,6 +90,7 @@ bool save_as_draw(hlcache_handle *h, const char *path) { pencil_code code; char *drawfile_buffer; + struct rect clip; size_t drawfile_size; os_error *error; @@ -101,10 +103,13 @@ bool save_as_draw(hlcache_handle *h, const char *path) ro_save_draw_width = content_get_width(h); ro_save_draw_height = content_get_height(h); + clip.x0 = clip.y0 = INT_MIN; + clip.x1 = clip.y1 = INT_MAX; + plot = ro_save_draw_plotters; if (!content_redraw(h, 0, -ro_save_draw_height, ro_save_draw_width, ro_save_draw_height, - INT_MIN, INT_MIN, INT_MAX, INT_MAX, + &clip, 1, 0xFFFFFF)) { diff --git a/riscos/sprite.c b/riscos/sprite.c index ba7f78a85..cc75b54cd 100644 --- a/riscos/sprite.c +++ b/riscos/sprite.c @@ -112,8 +112,7 @@ void sprite_destroy(struct content *c) */ bool sprite_redraw(struct content *c, int x, int y, - int width, int height, - int clip_x0, int clip_y0, int clip_x1, int clip_y1, + int width, int height, struct rect *clip, float scale, colour background_colour) { if (plot.flush && !plot.flush()) diff --git a/riscos/sprite.h b/riscos/sprite.h index 2248cd400..44cc029d8 100644 --- a/riscos/sprite.h +++ b/riscos/sprite.h @@ -29,6 +29,7 @@ #ifdef WITH_SPRITE struct content; +struct rect; struct content_sprite_data { void *data; @@ -37,8 +38,7 @@ struct content_sprite_data { bool sprite_convert(struct content *c); void sprite_destroy(struct content *c); bool sprite_redraw(struct content *c, int x, int y, - int width, int height, - int clip_x0, int clip_y0, int clip_x1, int clip_y1, + int width, int height, struct rect *clip, float scale, colour background_colour); bool sprite_clone(const struct content *old, struct content *new_content); #endif diff --git a/riscos/thumbnail.c b/riscos/thumbnail.c index 82b885bfe..fba43f6bf 100644 --- a/riscos/thumbnail.c +++ b/riscos/thumbnail.c @@ -83,6 +83,7 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, { float scale = 1.0; struct thumbnail_save_area *save_area; + struct rect clip; osspriteop_area *sprite_area = NULL; osspriteop_header *sprite_header = NULL; _kernel_oserror *error; @@ -130,8 +131,12 @@ bool thumbnail_create(hlcache_handle *content, struct bitmap *bitmap, colourtrans_set_gcol(os_COLOUR_WHITE, colourtrans_SET_BG_GCOL, os_ACTION_OVERWRITE, 0); os_clg(); + clip.x0 = 0; + clip.y0 = 0; + clip.x1 = bitmap->width; + clip.y1 = bitmap->height; content_redraw(content, 0, 0, bitmap->width, bitmap->height, - 0, 0, bitmap->width, bitmap->height, scale, 0xFFFFFF); + &clip, scale, 0xFFFFFF); thumbnail_restore_output(save_area); rufl_invalidate_cache(); -- cgit v1.2.3