diff options
author | Vincent Sanders <vince@netsurf-browser.org> | 2009-06-30 13:02:23 +0000 |
---|---|---|
committer | Vincent Sanders <vince@netsurf-browser.org> | 2009-06-30 13:02:23 +0000 |
commit | aa2684341170424783f9937d8fe441fb3984d825 (patch) | |
tree | b7b1adaf3867666f15d7bf9bacf804846372eff7 /riscos | |
parent | 38356d46ff15fe669c59bdf6aa96b7f4248d1b6a (diff) | |
download | netsurf-aa2684341170424783f9937d8fe441fb3984d825.tar.gz netsurf-aa2684341170424783f9937d8fe441fb3984d825.tar.bz2 |
Improve bitmap plotter API
svn path=/trunk/netsurf/; revision=8195
Diffstat (limited to 'riscos')
-rw-r--r-- | riscos/plotters.c | 55 | ||||
-rw-r--r-- | riscos/print.c | 46 | ||||
-rw-r--r-- | riscos/save_draw.c | 45 |
3 files changed, 56 insertions, 90 deletions
diff --git a/riscos/plotters.c b/riscos/plotters.c index 0cab39041..2ec82b55a 100644 --- a/riscos/plotters.c +++ b/riscos/plotters.c @@ -53,31 +53,25 @@ static bool ro_plot_disc(int x, int y, int radius, colour colour, bool filled); static bool ro_plot_arc(int x, int y, int radius, int angle1, int angle2, colour c); static bool ro_plot_bitmap(int x, int y, int width, int height, - struct bitmap *bitmap, colour bg, struct content *content); -static bool ro_plot_bitmap_tile(int x, int y, int width, int height, struct bitmap *bitmap, colour bg, - bool repeat_x, bool repeat_y, struct content *content); + bitmap_flags_t flags); struct plotter_table plot; const struct plotter_table ro_plotters = { - ro_plot_clg, - ro_plot_rectangle, - ro_plot_line, - ro_plot_polygon, - ro_plot_fill, - ro_plot_clip, - ro_plot_text, - ro_plot_disc, - ro_plot_arc, - ro_plot_bitmap, - ro_plot_bitmap_tile, - NULL, - NULL, - NULL, - ro_plot_path, - true + .clg = ro_plot_clg, + .rectangle = ro_plot_rectangle, + .line = ro_plot_line, + .polygon = ro_plot_polygon, + .fill = ro_plot_fill, + .clip = ro_plot_clip, + .text = ro_plot_text, + .disc = ro_plot_disc, + .arc = ro_plot_arc, + .bitmap = ro_plot_bitmap, + .path = ro_plot_path, + .option_knockout = true, }; int ro_plot_origin_x = 0; @@ -498,10 +492,15 @@ bool ro_plot_arc(int x, int y, int radius, int angle1, int angle2, colour c) return true; } + + bool ro_plot_bitmap(int x, int y, int width, int height, - struct bitmap *bitmap, colour bg, struct content *content) + struct bitmap *bitmap, colour bg, + bitmap_flags_t flags) { const uint8_t *buffer; + bool repeat_x = (flags & BITMAPF_REPEAT_X); + bool repeat_y = (flags & BITMAPF_REPEAT_Y); buffer = bitmap_get_buffer(bitmap); if (!buffer) { @@ -509,6 +508,7 @@ bool ro_plot_bitmap(int x, int y, int width, int height, return false; } + if (!(repeat_x || repeat_y)) { return image_redraw(bitmap->sprite_area, ro_plot_origin_x + x * 2, ro_plot_origin_y - y * 2, @@ -519,20 +519,7 @@ bool ro_plot_bitmap(int x, int y, int width, int height, false, false, false, bitmap_get_opaque(bitmap) ? IMAGE_PLOT_TINCT_OPAQUE : IMAGE_PLOT_TINCT_ALPHA); -} - - -bool ro_plot_bitmap_tile(int x, int y, int width, int height, - struct bitmap *bitmap, colour bg, - bool repeat_x, bool repeat_y, struct content *content) -{ - const uint8_t *buffer; - - buffer = bitmap_get_buffer(bitmap); - if (!buffer) { - LOG(("bitmap_get_buffer failed")); - return false; - } + } return image_redraw(bitmap->sprite_area, ro_plot_origin_x + x * 2, diff --git a/riscos/print.c b/riscos/print.c index 7cd391a58..a663b3d1c 100644 --- a/riscos/print.c +++ b/riscos/print.c @@ -114,10 +114,7 @@ static bool print_fonts_plot_arc(int x, int y, int radius, int angle1, int angle colour c); static bool print_fonts_plot_bitmap(int x, int y, int width, int height, struct bitmap *bitmap, colour bg, - struct content *content); -static bool print_fonts_plot_bitmap_tile(int x, int y, int width, int height, - struct bitmap *bitmap, colour bg, - bool repeat_x, bool repeat_y, struct content *content); + bitmap_flags_t flags); static bool print_fonts_plot_path(const float *p, unsigned int n, colour fill, float width, colour c, const float transform[6]); static void print_fonts_callback(void *context, @@ -129,22 +126,18 @@ static void print_fonts_callback(void *context, /** Plotter for print_declare_fonts(). All the functions do nothing except for * print_fonts_plot_text, which records the fonts used. */ static const struct plotter_table print_fonts_plotters = { - print_fonts_plot_clg, - print_fonts_plot_rectangle, - print_fonts_plot_line, - print_fonts_plot_polygon, - print_fonts_plot_fill, - print_fonts_plot_clip, - print_fonts_plot_text, - print_fonts_plot_disc, - print_fonts_plot_arc, - print_fonts_plot_bitmap, - print_fonts_plot_bitmap_tile, - NULL, - NULL, - NULL, - print_fonts_plot_path, - false + .clg = print_fonts_plot_clg, + .rectangle = print_fonts_plot_rectangle, + .line = print_fonts_plot_line, + .polygon = print_fonts_plot_polygon, + .fill = print_fonts_plot_fill, + .clip = print_fonts_plot_clip, + .text = print_fonts_plot_text, + .disc = print_fonts_plot_disc, + .arc = print_fonts_plot_arc, + .bitmap = print_fonts_plot_bitmap, + .path = print_fonts_plot_path, + .option_knockout = false, }; @@ -838,32 +831,31 @@ bool print_fonts_plot_fill(int x0, int y0, int x1, int y1, colour c) { return true; } + bool print_fonts_plot_clip(int clip_x0, int clip_y0, int clip_x1, int clip_y1) { return true; } + bool print_fonts_plot_disc(int x, int y, int radius, colour colour, bool filled) { return true; } + bool print_fonts_plot_arc(int x, int y, int radius, int angle1, int angle2, colour c) { return true; } + bool print_fonts_plot_bitmap(int x, int y, int width, int height, - struct bitmap *bitmap, colour bg, struct content *content) -{ - return true; -} -bool print_fonts_plot_bitmap_tile(int x, int y, int width, int height, - struct bitmap *bitmap, colour bg, - bool repeat_x, bool repeat_y, struct content *content) + struct bitmap *bitmap, colour bg, bitmap_flags_t flags) { return true; } + bool print_fonts_plot_path(const float *p, unsigned int n, colour fill, float width, colour c, const float transform[6]) { diff --git a/riscos/save_draw.c b/riscos/save_draw.c index 812b9409a..7c76210c2 100644 --- a/riscos/save_draw.c +++ b/riscos/save_draw.c @@ -56,32 +56,27 @@ static bool ro_save_draw_disc(int x, int y, int radius, colour colour, static bool ro_save_draw_arc(int x, int y, int radius, int angle1, int angle2, colour c); static bool ro_save_draw_bitmap(int x, int y, int width, int height, - struct bitmap *bitmap, colour bg, struct content *content); -static bool ro_save_draw_bitmap_tile(int x, int y, int width, int height, - struct bitmap *bitmap, colour bg, - bool repeat_x, bool repeat_y, struct content *content); + struct bitmap *bitmap, colour bg, bitmap_flags_t flags); static bool ro_save_draw_group_start(const char *name); static bool ro_save_draw_group_end(void); static bool ro_save_draw_error(pencil_code code); static const struct plotter_table ro_save_draw_plotters = { - ro_save_draw_clg, - ro_save_draw_rectangle, - ro_save_draw_line, - ro_save_draw_polygon, - ro_save_draw_fill, - ro_save_draw_clip, - ro_save_draw_text, - ro_save_draw_disc, - ro_save_draw_arc, - ro_save_draw_bitmap, - ro_save_draw_bitmap_tile, - ro_save_draw_group_start, - ro_save_draw_group_end, - NULL, - ro_save_draw_path, - false + .clg = ro_save_draw_clg, + .rectangle = ro_save_draw_rectangle, + .line = ro_save_draw_line, + .polygon = ro_save_draw_polygon, + .fill = ro_save_draw_fill, + .clip = ro_save_draw_clip, + .text = ro_save_draw_text, + .disc = ro_save_draw_disc, + .arc = ro_save_draw_arc, + .bitmap = ro_save_draw_bitmap, + .group_start = ro_save_draw_group_start, + .group_end = ro_save_draw_group_end, + .path = ro_save_draw_path, + .option_knockout = false, }; static struct pencil_diagram *ro_save_draw_diagram; @@ -378,7 +373,7 @@ bool ro_save_draw_arc(int x, int y, int radius, int angle1, int angle2, } bool ro_save_draw_bitmap(int x, int y, int width, int height, - struct bitmap *bitmap, colour bg, struct content *content) + struct bitmap *bitmap, colour bg, bitmap_flags_t flags) { pencil_code code; const uint8_t *buffer; @@ -400,14 +395,6 @@ bool ro_save_draw_bitmap(int x, int y, int width, int height, } -bool ro_save_draw_bitmap_tile(int x, int y, int width, int height, - struct bitmap *bitmap, colour bg, - bool repeat_x, bool repeat_y, struct content *content) -{ - return true; -} - - bool ro_save_draw_group_start(const char *name) { pencil_code code; |