NetSurf
Functions | Variables
redraw_border.c File Reference

Redrawing CONTENT_HTML borders implementation. More...

#include <stdbool.h>
#include <stdlib.h>
#include "utils/utils.h"
#include "utils/log.h"
#include "netsurf/plotters.h"
#include "netsurf/css.h"
#include "html/box.h"
#include "html/private.h"
Include dependency graph for redraw_border.c:

Go to the source code of this file.

Functions

static nserror plot_clipped_rectangle (const struct redraw_context *ctx, const plot_style_t *style, const struct rect *clip, struct rect *rect)
 
static nserror html_redraw_border_plot (const int side, const int *p, colour c, enum css_border_style_e style, int thickness, bool rectangular, const struct rect *clip, const struct redraw_context *ctx)
 Draw one border. More...
 
bool html_redraw_borders (struct box *box, int x_parent, int y_parent, int p_width, int p_height, const struct rect *clip, float scale, const struct redraw_context *ctx)
 Draw borders for a box. More...
 
bool html_redraw_inline_borders (struct box *box, struct rect b, const struct rect *clip, float scale, bool first, bool last, const struct redraw_context *ctx)
 Draw an inline's borders. More...
 

Variables

static plot_style_t plot_style_bdr
 
static plot_style_t plot_style_fillbdr
 
static plot_style_t plot_style_fillbdr_dark
 
static plot_style_t plot_style_fillbdr_light
 
static plot_style_t plot_style_fillbdr_ddark
 
static plot_style_t plot_style_fillbdr_dlight
 

Detailed Description

Redrawing CONTENT_HTML borders implementation.

Definition in file redraw_border.c.

Function Documentation

◆ html_redraw_border_plot()

static nserror html_redraw_border_plot ( const int  side,
const int *  p,
colour  c,
enum css_border_style_e  style,
int  thickness,
bool  rectangular,
const struct rect clip,
const struct redraw_context ctx 
)
static

Draw one border.

Parameters
sideindex of border side (TOP, RIGHT, BOTTOM, LEFT)
parray of precomputed border vertices
ccolour for border
styleborder line style
thicknessborder thickness
rectangularwhether border is rectangular
clipcliping area for redrawing border.
ctxcurrent redraw context
Returns
NSERROR_OK if successful otherwise appropriate error code

Definition at line 93 of file redraw_border.c.

References clip(), darken_colour, double_darken_colour, double_lighten_colour, fallthrough, plot_style_s::fill_colour, LEFT, lighten_colour, plotter_table::line, NS_TRANSPARENT, NSERROR_OK, redraw_context::plot, plot_clipped_rectangle(), PLOT_OP_TYPE_DASH, PLOT_OP_TYPE_DOT, plot_style_bdr, plot_style_fillbdr, plot_style_fillbdr_dark, plot_style_fillbdr_ddark, plot_style_fillbdr_dlight, plot_style_fillbdr_light, PLOT_STYLE_RADIX, plotter_table::polygon, RIGHT, plot_style_s::stroke_colour, plot_style_s::stroke_type, plot_style_s::stroke_width, TOP, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by html_redraw_borders(), and html_redraw_inline_borders().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ html_redraw_borders()

bool html_redraw_borders ( struct box box,
int  x_parent,
int  y_parent,
int  p_width,
int  p_height,
const struct rect clip,
float  scale,
const struct redraw_context ctx 
)

Draw borders for a box.

Parameters
boxbox to draw
x_parentcoordinate of left padding edge of parent of box
y_parentcoordinate of top padding edge of parent of box
p_widthwidth of padding box
p_heightheight of padding box
clipcliping area for redrawing border.
scalescale for redraw
ctxcurrent redraw context
Returns
true if successful, false otherwise

Definition at line 444 of file redraw_border.c.

References box::border, BOTTOM, box_border::c, clip(), html_redraw_border_plot(), LEFT, nscss_color_is_transparent, nscss_color_to_ns, NSERROR_OK, RIGHT, box_border::style, box::style, TOP, box_border::width, box::x, and box::y.

Referenced by html_redraw_box().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ html_redraw_inline_borders()

bool html_redraw_inline_borders ( struct box box,
struct rect  b,
const struct rect clip,
float  scale,
bool  first,
bool  last,
const struct redraw_context ctx 
)

Draw an inline's borders.

Parameters
boxBOX_INLINE which created the border
bcoordinates of border edge rectangle
clipcliping area for redrawing border.
scalescale for redraw
firsttrue if this is the first rectangle associated with the inline
lasttrue if this is the last rectangle associated with the inline
ctxcurrent redraw context
Returns
true if successful, false otherwise

Definition at line 707 of file redraw_border.c.

References box::border, BOTTOM, box_border::c, clip(), html_redraw_border_plot(), LEFT, nscss_color_is_transparent, nscss_color_to_ns, NSERROR_OK, RIGHT, box_border::style, box::style, TOP, box_border::width, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by html_redraw_box().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ plot_clipped_rectangle()

static nserror plot_clipped_rectangle ( const struct redraw_context ctx,
const plot_style_t style,
const struct rect clip,
struct rect rect 
)
inlinestatic

Definition at line 58 of file redraw_border.c.

References clip(), NSERROR_OK, redraw_context::plot, plotter_table::rectangle, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by html_redraw_border_plot().

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ plot_style_bdr

plot_style_t plot_style_bdr
static
Initial value:
= {
.stroke_type = PLOT_OP_TYPE_DASH,
}
@ PLOT_OP_TYPE_DASH
Dashed plot.
Definition: plot_style.h:69

Definition at line 37 of file redraw_border.c.

Referenced by html_redraw_border_plot().

◆ plot_style_fillbdr

plot_style_t plot_style_fillbdr
static
Initial value:
= {
.fill_type = PLOT_OP_TYPE_SOLID,
}
@ PLOT_OP_TYPE_SOLID
Solid colour.
Definition: plot_style.h:67

Definition at line 40 of file redraw_border.c.

Referenced by html_redraw_border_plot().

◆ plot_style_fillbdr_dark

plot_style_t plot_style_fillbdr_dark
static
Initial value:
= {
.fill_type = PLOT_OP_TYPE_SOLID,
}

Definition at line 43 of file redraw_border.c.

Referenced by html_redraw_border_plot().

◆ plot_style_fillbdr_ddark

plot_style_t plot_style_fillbdr_ddark
static
Initial value:
= {
.fill_type = PLOT_OP_TYPE_SOLID,
}

Definition at line 49 of file redraw_border.c.

Referenced by html_redraw_border_plot().

◆ plot_style_fillbdr_dlight

plot_style_t plot_style_fillbdr_dlight
static
Initial value:
= {
.fill_type = PLOT_OP_TYPE_SOLID,
}

Definition at line 52 of file redraw_border.c.

Referenced by html_redraw_border_plot().

◆ plot_style_fillbdr_light

plot_style_t plot_style_fillbdr_light
static
Initial value:
= {
.fill_type = PLOT_OP_TYPE_SOLID,
}

Definition at line 46 of file redraw_border.c.

Referenced by html_redraw_border_plot().