64 rect->
x0 = (clip->
x0 > rect->
x0) ? clip->
x0 : rect->
x0;
65 rect->
y0 = (clip->
y0 > rect->
y0) ? clip->
y0 : rect->
y0;
66 rect->
x1 = (clip->
x1 < rect->
x1) ? clip->
x1 : rect->
x1;
67 rect->
y1 = (clip->
y1 < rect->
y1) ? clip->
y1 : rect->
y1;
68 if ((rect->
x0 < rect->
x1) && (rect->
y0 < rect->
y1)) {
95 enum css_border_style_e style,
102 unsigned int light = side;
122 case CSS_BORDER_STYLE_DOTTED:
125 case CSS_BORDER_STYLE_DASHED:
126 rect.
x0 = (p[0] + p[2]) / 2;
127 rect.
y0 = (p[1] + p[3]) / 2;
128 rect.
x1 = (p[4] + p[6]) / 2;
129 rect.
y1 = (p[5] + p[7]) / 2;
130 res = ctx->
plot->
line(ctx, &plot_style_bdr, &rect);
133 case CSS_BORDER_STYLE_SOLID:
136 if (rectangular || thickness == 1) {
142 (p[4] - p[6] != 0)) {
152 if ((side ==
LEFT) &&
153 (p[1] - p[3] != 0)) {
164 res = ctx->
plot->
polygon(ctx, &plot_style_fillbdr, p, 4);
168 case CSS_BORDER_STYLE_DOUBLE:
171 z[2] = (p[0] * 2 + p[2]) / 3;
172 z[3] = (p[1] * 2 + p[3]) / 3;
173 z[4] = (p[6] * 2 + p[4]) / 3;
174 z[5] = (p[7] * 2 + p[5]) / 3;
177 res = ctx->
plot->
polygon(ctx, &plot_style_fillbdr, z, 4);
181 z[2] = (p[2] * 2 + p[0]) / 3;
182 z[3] = (p[3] * 2 + p[1]) / 3;
183 z[4] = (p[4] * 2 + p[6]) / 3;
184 z[5] = (p[5] * 2 + p[7]) / 3;
187 res = ctx->
plot->
polygon(ctx, &plot_style_fillbdr, z, 4);
191 case CSS_BORDER_STYLE_GROOVE:
194 case CSS_BORDER_STYLE_RIDGE:
205 if ((rectangular || thickness == 2) && thickness != 1) {
212 rect.
x0 = (p[0] + p[2]) / 2;
213 rect.
y0 = (p[1] + p[3]) / 2;
219 rect.
x1 = (p[0] + p[2]) / 2;
220 rect.
y1 = (p[1] + p[3]) / 2;
234 rect.
x1 = (p[6] + p[4]) / 2;
235 rect.
y1 = (p[7] + p[5]) / 2;
237 rect.
x0 = (p[6] + p[4]) / 2;
238 rect.
y0 = (p[7] + p[5]) / 2;
246 }
else if (thickness == 1) {
256 rect.
x1 = ((side ==
TOP) && (p[4] - p[6] != 0)) ?
257 rect.
x1 + p[4] - p[6] : rect.
x1;
268 rect.
y1 = ((side ==
LEFT) && (p[1] - p[3] != 0)) ?
269 rect.
y1 + p[1] - p[3] : rect.
y1;
281 z[2] = (p[0] + p[2]) / 2;
282 z[3] = (p[1] + p[3]) / 2;
283 z[4] = (p[6] + p[4]) / 2;
284 z[5] = (p[7] + p[5]) / 2;
287 res = ctx->
plot->
polygon(ctx, plot_style_bdr_in, z, 4);
301 case CSS_BORDER_STYLE_INSET:
302 light = (light + 2) % 4;
304 case CSS_BORDER_STYLE_OUTSET:
330 if ((rectangular || thickness == 2) && thickness != 1) {
337 rect.
x0 = (p[0] + p[2]) / 2;
338 rect.
y0 = (p[1] + p[3]) / 2;
344 rect.
x1 = (p[0] + p[2]) / 2;
345 rect.
y1 = (p[1] + p[3]) / 2;
359 rect.
x1 = (p[6] + p[4]) / 2;
360 rect.
y1 = (p[7] + p[5]) / 2;
362 rect.
x0 = (p[6] + p[4]) / 2;
363 rect.
y0 = (p[7] + p[5]) / 2;
371 }
else if (thickness == 1) {
381 rect.
x1 = ((side ==
TOP) && (p[4] - p[6] != 0)) ?
382 rect.
x1 + p[4] - p[6] : rect.
x1;
392 rect.
y1 = ((side ==
LEFT) && (p[1] - p[3] != 0)) ?
393 rect.
y1 + p[1] - p[3] : rect.
y1;
406 z[2] = (p[0] + p[2]) / 2;
407 z[3] = (p[1] + p[3]) / 2;
408 z[4] = (p[6] + p[4]) / 2;
409 z[5] = (p[7] + p[5]) / 2;
412 res = ctx->
plot->
polygon(ctx, plot_style_bdr_in, z, 4);
420 res = ctx->
plot->
polygon(ctx, plot_style_bdr_out, z, 4);
458 unsigned int i, side;
461 bool square_end_1 =
false;
462 bool square_end_2 =
false;
465 x = x_parent + box->
x;
466 y = y_parent + box->
y;
489 p[0] = x - left; p[1] = y - top;
491 p[4] = x + p_width; p[5] = y + p_height;
492 p[6] = x + p_width + right; p[7] = y + p_height + bottom;
494 for (i = 0; i != 4; i++) {
505 square_end_1 = (top == 0);
506 square_end_2 = (bottom == 0);
508 z[0] = p[0]; z[1] = p[7];
509 z[2] = p[2]; z[3] = p[5];
510 z[4] = p[2]; z[5] = p[3];
511 z[6] = p[0]; z[7] = p[1];
537 square_end_1 && square_end_2,
546 square_end_1 = (top == 0);
547 square_end_2 = (bottom == 0);
549 z[0] = p[6]; z[1] = p[1];
550 z[2] = p[4]; z[3] = p[3];
551 z[4] = p[4]; z[5] = p[5];
552 z[6] = p[6]; z[7] = p[7];
578 square_end_1 && square_end_2,
587 if (clip->
y0 > p[3]) {
594 square_end_1 = (left == 0);
595 square_end_2 = (right == 0);
597 z[0] = p[2]; z[1] = p[3];
598 z[2] = p[0]; z[3] = p[1];
599 z[4] = p[6]; z[5] = p[1];
600 z[6] = p[4]; z[7] = p[3];
626 square_end_1 && square_end_2,
635 if (clip->
y1 < p[5]) {
642 square_end_1 = (left == 0);
643 square_end_2 = (right == 0);
645 z[0] = p[4]; z[1] = p[5];
646 z[2] = p[6]; z[3] = p[7];
647 z[4] = p[0]; z[5] = p[7];
648 z[6] = p[2]; z[7] = p[5];
650 if (box->
border[BOTTOM].
style == CSS_BORDER_STYLE_SOLID &&
658 if (box->
border[BOTTOM].
style == CSS_BORDER_STYLE_SOLID &&
674 square_end_1 && square_end_2,
683 assert(side ==
TOP || side == BOTTOM ||
742 p[0] = b.
x0; p[1] = b.
y0;
743 p[2] = first ? b.
x0 + left : b.
x0; p[3] = b.
y0 + top;
744 p[4] = last ? b.
x1 - right : b.
x1; p[5] = b.
y1 - bottom;
745 p[6] = b.
x1; p[7] = b.
y1;
750 square_end_1 = (top == 0);
751 square_end_2 = (bottom == 0);
757 z[0] = p[0]; z[1] = p[7];
758 z[2] = p[2]; z[3] = p[5];
759 z[4] = p[2]; z[5] = p[3];
760 z[6] = p[0]; z[7] = p[1];
785 square_end_1 && square_end_2,
794 square_end_1 = (top == 0);
795 square_end_2 = (bottom == 0);
801 z[0] = p[6]; z[1] = p[1];
802 z[2] = p[4]; z[3] = p[3];
803 z[4] = p[4]; z[5] = p[5];
804 z[6] = p[6]; z[7] = p[7];
829 square_end_1 && square_end_2,
838 square_end_1 = (left == 0);
839 square_end_2 = (right == 0);
844 z[0] = p[2]; z[1] = p[3];
845 z[2] = p[0]; z[3] = p[1];
846 z[4] = p[6]; z[5] = p[1];
847 z[6] = p[4]; z[7] = p[3];
874 square_end_1 && square_end_2,
883 square_end_1 = (left == 0);
884 square_end_2 = (right == 0);
889 z[0] = p[4]; z[1] = p[5];
890 z[2] = p[6]; z[3] = p[7];
891 z[4] = p[0]; z[5] = p[7];
892 z[6] = p[2]; z[7] = p[5];
919 square_end_1 && square_end_2,
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.
Target independent plotting interface.
nserror(* polygon)(const struct redraw_context *ctx, const plot_style_t *pstyle, const int *p, unsigned int n)
Plot a polygon.
static nserror plot_clipped_rectangle(const struct redraw_context *ctx, const plot_style_t *style, const struct rect *clip, struct rect *rect)
const struct plotter_table * plot
Current plot operation table.
plot_operation_type_t stroke_type
Stroke plot type.
struct box_border border[4]
Border: TOP, RIGHT, BOTTOM, LEFT.
static plot_style_t plot_style_fillbdr_dlight
colour stroke_colour
Colour of stroke.
static plot_style_t plot_style_fillbdr_light
int x
Coordinate of left padding edge relative to parent box, or relative to ancestor that contains this bo...
colour fill_colour
Colour of fill.
int y
Coordinate of top padding edge, relative as for x.
static plot_style_t plot_style_bdr
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.
#define PLOT_STYLE_RADIX
22:10 fixed point
nserror
Enumeration of error codes.
Private data for text/html content.
#define NS_TRANSPARENT
Transparent colour value.
#define lighten_colour(c1)
uint32_t colour
Colour type: XBGR.
static plot_style_t plot_style_fillbdr
plot_operation_type_t fill_type
Fill plot type.
Plot style for stroke/fill plotters.
int width
border-width (pixels)
static plot_style_t plot_style_fillbdr_dark
#define double_lighten_colour(c1)
#define nscss_color_to_ns(c)
Convert a CSS color to a NetSurf colour primitive.
#define double_darken_colour(c1)
static plot_style_t plot_style_fillbdr_ddark
nserror(* rectangle)(const struct redraw_context *ctx, const plot_style_t *pstyle, const struct rect *rectangle)
Plots a rectangle.
nserror(* line)(const struct redraw_context *ctx, const plot_style_t *pstyle, const struct rect *line)
Plots a line.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
css_computed_style * style
Style for this box.
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.
enum css_border_style_e style
border-style
#define darken_colour(c1)
#define nscss_color_is_transparent(color)
Determine if a CSS color primitive is transparent.
plot_style_fixed stroke_width
Width of stroke, in pixels.
css_color c
border-color value