OK another small tidy along the road to making the plotter API less mad This one removes the clg call altogether. It was used in four places, all of which set the clip rectangle just before clg was called!
This patch replaces these four calls with their direct equivalent fill calls and removes the clg call from the plotters. Removes another hundred lines of redundant code and makes the plotter API simpler. amiga/plotters.c | 1 - beos/beos_plotters.cpp | 23 ----------------------- desktop/knockout.c | 16 +--------------- desktop/plotters.h | 2 -- desktop/save_pdf/pdf_plotters.c | 7 ------- framebuffer/framebuffer.c | 1 - gtk/gtk_plotters.c | 7 ------- gtk/gtk_print.c | 7 ------- render/html_redraw.c | 2 +- render/textplain.c | 2 +- riscos/plotters.c | 20 -------------------- riscos/print.c | 9 +++------ riscos/save_draw.c | 11 ----------- riscos/window.c | 2 +- 14 files changed, 7 insertions(+), 103 deletions(-) -- Regards Vincent http://www.kyllikki.org/
Index: render/textplain.c
===================================================================
--- render/textplain.c (revision 8202)
+++ render/textplain.c (working copy)
@@ -358,7 +358,7 @@
if (line1 < line0)
line1 = line0;
- if (!plot.clg(0xffffff))
+ if (!plot.fill(clip_x0, clip_y0, clip_x1, clip_y1, 0xffffff))
return false;
if (!line)
Index: render/html_redraw.c
===================================================================
--- render/html_redraw.c (revision 8202)
+++ render/html_redraw.c (working copy)
@@ -147,7 +147,7 @@
result = plot.clip(clip_x0, clip_y0, clip_x1, clip_y1);
if (c->data.html.background_colour != TRANSPARENT)
background_colour = c->data.html.background_colour;
- result &= plot.clg(background_colour);
+ result &= plot.fill(clip_x0, clip_y0, clip_x1, clip_y1, background_colour);
result &= html_redraw_box(box, x, y,
clip_x0, clip_y0, clip_x1, clip_y1,
Index: framebuffer/framebuffer.c
===================================================================
--- framebuffer/framebuffer.c (revision 8202)
+++ framebuffer/framebuffer.c (working copy)
@@ -217,7 +217,6 @@
}
struct plotter_table plot = {
- .clg = nsfb_lplot_clg,
.rectangle = nsfb_lplot_rectangle,
.line = nsfb_lplot_line,
.polygon = nsfb_lplot_polygon,
Index: gtk/gtk_print.c
===================================================================
--- gtk/gtk_print.c (revision 8202)
+++ gtk/gtk_print.c (working copy)
@@ -45,7 +45,6 @@
#include "utils/log.h"
#include "utils/utils.h"
-static bool nsgtk_print_plot_clg(colour c);
static bool nsgtk_print_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
static bool nsgtk_print_plot_line(int x0, int y0, int x1, int y1, int width,
@@ -89,7 +88,6 @@
static GdkRectangle cliprect;
static const struct plotter_table nsgtk_print_plotters = {
- .clg = nsgtk_print_plot_clg,
.rectangle = nsgtk_print_plot_rectangle,
.line = nsgtk_print_plot_line,
.polygon = nsgtk_print_plot_polygon,
@@ -110,11 +108,6 @@
gtk_print_end
};
-bool nsgtk_print_plot_clg(colour c)
-{
- return true;
-}
-
bool nsgtk_print_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed)
{
Index: gtk/gtk_plotters.c
===================================================================
--- gtk/gtk_plotters.c (revision 8202)
+++ gtk/gtk_plotters.c (working copy)
@@ -49,7 +49,6 @@
GdkGC *current_gc;
cairo_t *current_cr;
-static bool nsgtk_plot_clg(colour c);
static bool nsgtk_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
static bool nsgtk_plot_line(int x0, int y0, int x1, int y1, int width,
@@ -78,7 +77,6 @@
struct plotter_table plot;
const struct plotter_table nsgtk_plotters = {
- .clg = nsgtk_plot_clg,
.rectangle = nsgtk_plot_rectangle,
.line = nsgtk_plot_line,
.polygon = nsgtk_plot_polygon,
@@ -93,11 +91,6 @@
};
-bool nsgtk_plot_clg(colour c)
-{
- return true;
-}
-
bool nsgtk_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed)
{
Index: beos/beos_plotters.cpp
===================================================================
--- beos/beos_plotters.cpp (revision 8202)
+++ beos/beos_plotters.cpp (working copy)
@@ -61,7 +61,6 @@
* the right-bottom pixel is actually part of the BRect!
*/
-static bool nsbeos_plot_clg(colour c);
static bool nsbeos_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
static bool nsbeos_plot_line(int x0, int y0, int x1, int y1, int width,
@@ -95,7 +94,6 @@
struct plotter_table plot;
const struct plotter_table nsbeos_plotters = {
- nsbeos_plot_clg,
nsbeos_plot_rectangle,
nsbeos_plot_line,
nsbeos_plot_polygon,
@@ -141,27 +139,6 @@
current_view = view;
}
-
-bool nsbeos_plot_clg(colour c)
-{
-#warning BView::Invalidate() ?
-
- BView *view;
-
- view = nsbeos_current_gc/*_lock*/();
- if (view == NULL) {
- warn_user("No GC", 0);
- return false;
- }
-
- nsbeos_set_colour(c);
- view->FillRect(view->Bounds());
-
- //nsbeos_current_gc_unlock();
-
- return true;
-}
-
bool nsbeos_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed)
{
Index: riscos/save_draw.c
===================================================================
--- riscos/save_draw.c (revision 8202)
+++ riscos/save_draw.c (working copy)
@@ -37,8 +37,6 @@
#include "utils/log.h"
#include "utils/utils.h"
-
-static bool ro_save_draw_clg(colour c);
static bool ro_save_draw_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
static bool ro_save_draw_line(int x0, int y0, int x1, int y1, int width,
@@ -63,7 +61,6 @@
static const struct plotter_table ro_save_draw_plotters = {
- .clg = ro_save_draw_clg,
.rectangle = ro_save_draw_rectangle,
.line = ro_save_draw_line,
.polygon = ro_save_draw_polygon,
@@ -146,14 +143,6 @@
return true;
}
-
-bool ro_save_draw_clg(colour c)
-{
- return ro_save_draw_fill(0, 0, ro_save_draw_width, ro_save_draw_height,
- c);
-}
-
-
bool ro_save_draw_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed)
{
Index: riscos/window.c
===================================================================
--- riscos/window.c (revision 8202)
+++ riscos/window.c (working copy)
@@ -1483,7 +1483,7 @@
plot.clip(clip_x0, clip_y0, clip_x1, clip_y1);
if (c->type != CONTENT_HTML)
- plot.clg(0x00ffffff);
+ plot.fill(clip_x0, clip_y0, clip_x1, clip_y1, 0x00ffffff);
/* Redraw the clip rectangle area of the content */
content_redraw(c, 0, 0,
Index: riscos/plotters.c
===================================================================
--- riscos/plotters.c (revision 8202)
+++ riscos/plotters.c (working copy)
@@ -34,7 +34,6 @@
#include "utils/log.h"
-static bool ro_plot_clg(colour c);
static bool ro_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
static bool ro_plot_line(int x0, int y0, int x1, int y1, int width,
@@ -60,7 +59,6 @@
struct plotter_table plot;
const struct plotter_table ro_plotters = {
- .clg = ro_plot_clg,
.rectangle = ro_plot_rectangle,
.line = ro_plot_line,
.polygon = ro_plot_polygon,
@@ -82,24 +80,6 @@
bool ro_plot_patterned_lines = true;
-bool ro_plot_clg(colour c)
-{
- os_error *error;
- error = xcolourtrans_set_gcol(c << 8,
- colourtrans_SET_BG_GCOL | colourtrans_USE_ECFS_GCOL,
- os_ACTION_OVERWRITE, 0, 0);
- if (error) {
- LOG(("xcolourtrans_set_gcol: 0x%x: %s",
- error->errnum, error->errmess));
- return false;
- }
- error = xos_clg();
- if (error) {
- LOG(("xos_clg: 0x%x: %s", error->errnum, error->errmess));
- return false;
- }
- return true;
-}
bool ro_plot_rectangle(int x0, int y0, int width, int height,
Index: riscos/print.c
===================================================================
--- riscos/print.c (revision 8202)
+++ riscos/print.c (working copy)
@@ -97,7 +97,6 @@
static bool print_send_printtypeknown(wimp_message *m);
static bool print_document(struct gui_window *g, const char *filename);
static const char *print_declare_fonts(struct content *content);
-static bool print_fonts_plot_clg(colour c);
static bool print_fonts_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
static bool print_fonts_plot_line(int x0, int y0, int x1, int y1, int width,
@@ -126,7 +125,6 @@
/** 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 = {
- .clg = print_fonts_plot_clg,
.rectangle = print_fonts_plot_rectangle,
.line = print_fonts_plot_line,
.polygon = print_fonts_plot_polygon,
@@ -809,24 +807,23 @@
}
-bool print_fonts_plot_clg(colour c)
-{
- return true;
-}
bool print_fonts_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed)
{
return true;
}
+
bool print_fonts_plot_line(int x0, int y0, int x1, int y1, int width,
colour c, bool dotted, bool dashed)
{
return true;
}
+
bool print_fonts_plot_polygon(const int *p, unsigned int n, colour fill)
{
return true;
}
+
bool print_fonts_plot_fill(int x0, int y0, int x1, int y1, colour c)
{
return true;
Index: desktop/save_pdf/pdf_plotters.c
===================================================================
--- desktop/save_pdf/pdf_plotters.c (revision 8202)
+++ desktop/save_pdf/pdf_plotters.c (working copy)
@@ -45,7 +45,6 @@
/* #define PDF_DEBUG */
/* #define PDF_DEBUG_DUMPGRID */
-static bool pdf_plot_clg(colour c);
static bool pdf_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
static bool pdf_plot_line(int x0, int y0, int x1, int y1, int width,
@@ -124,7 +123,6 @@
static const struct print_settings *settings;
static const struct plotter_table pdf_plotters = {
- .clg = pdf_plot_clg,
.rectangle = pdf_plot_rectangle,
.line = pdf_plot_line,
.polygon = pdf_plot_polygon,
@@ -148,11 +146,6 @@
static char *owner_pass;
static char *user_pass;
-bool pdf_plot_clg(colour c)
-{
- return true;
-}
-
bool pdf_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed)
{
Index: desktop/plotters.h
===================================================================
--- desktop/plotters.h (revision 8202)
+++ desktop/plotters.h (working copy)
@@ -38,7 +38,6 @@
/** Set of target specific plotting functions.
*
* The functions are:
- * clg - Clears plotting area to a flat colour (if needed)
* arc - Plots an arc, around (x,y), from anticlockwise from angle1 to
* angle2. Angles are measured anticlockwise from horizontal, in
* degrees.
@@ -95,7 +94,6 @@
* 3 | | | | | |
*/
struct plotter_table {
- bool (*clg)(colour c);
bool (*rectangle)(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
bool (*line)(int x0, int y0, int x1, int y1, int width,
Index: desktop/knockout.c
===================================================================
--- desktop/knockout.c (revision 8202)
+++ desktop/knockout.c (working copy)
@@ -86,7 +86,6 @@
static bool knockout_plot_bitmap_recursive(struct knockout_box *box,
struct knockout_entry *entry);
-static bool knockout_plot_clg(colour c);
static bool knockout_plot_rectangle(int x0, int y0, int width, int height,
int line_width, colour c, bool dotted, bool dashed);
static bool knockout_plot_line(int x0, int y0, int x1, int y1, int width,
@@ -111,7 +110,6 @@
const struct plotter_table knockout_plotters = {
- .clg = knockout_plot_clg,
.rectangle = knockout_plot_rectangle,
.line = knockout_plot_line,
.polygon = knockout_plot_polygon,
@@ -130,7 +128,6 @@
typedef enum {
- KNOCKOUT_PLOT_CLG, /* translated to _FILL */
KNOCKOUT_PLOT_RECTANGLE,
KNOCKOUT_PLOT_LINE,
KNOCKOUT_PLOT_POLYGON,
@@ -163,9 +160,6 @@
struct knockout_box *box; /* relating series of knockout clips */
union {
struct {
- colour c;
- } clg;
- struct {
int x0;
int y0;
int width;
@@ -270,7 +264,7 @@
/* check if we're recursing */
if (nested_depth++ > 0) {
/* we should already have the knockout renderer as default */
- assert(plotter->clg == knockout_plotters.clg);
+ assert(plotter->rectangle == knockout_plotters.rectangle);
return true;
}
@@ -323,10 +317,6 @@
for (i = 0; i < knockout_entry_cur; i++) {
switch (knockout_entries[i].type) {
- case KNOCKOUT_PLOT_CLG:
- success &= plot.clg(
- knockout_entries[i].data.clg.c);
- break;
case KNOCKOUT_PLOT_RECTANGLE:
success &= plot.rectangle(
knockout_entries[i].data.rectangle.x0,
@@ -634,10 +624,6 @@
return success;
}
-bool knockout_plot_clg(colour c)
-{
- return knockout_plot_fill(clip_x0_cur, clip_y0_cur, clip_x1_cur, clip_y1_cur, c);
-}
bool knockout_plot_rectangle(int x0, int y0, int width, int height,
Index: amiga/plotters.c
===================================================================
--- amiga/plotters.c (revision 8202)
+++ amiga/plotters.c (working copy)
@@ -60,7 +60,6 @@
struct plotter_table plot;
const struct plotter_table amiplot = {
- .clg = ami_clg,
.rectangle = ami_rectangle,
.line = ami_line,
.polygon = ami_polygon,
signature.asc
Description: Digital signature
