![]() |
Ansel 0.0
A darktable fork - bloat + design vision
|
#include "widgets/stroke_raster.h"#include <float.h>#include <limits.h>#include <math.h>#include <stdint.h>#include <string.h>
Include dependency graph for stroke_raster.c:Go to the source code of this file.
Data Structures | |
| struct | _touched_t |
| struct | _scratch_t |
| struct | _plane_t |
| struct | _segment_t |
| struct | _dash_t |
| struct | _composite_t |
| struct | _gather_t |
Typedefs | |
| typedef struct _touched_t | _touched_t |
| typedef struct _scratch_t | _scratch_t |
| typedef struct _plane_t | _plane_t |
| typedef struct _segment_t | _segment_t |
| typedef struct _dash_t | _dash_t |
| typedef struct _composite_t | _composite_t |
| typedef struct _gather_t | _gather_t |
Functions | |
| static _touched_t * | _touched_of (cairo_surface_t *surface, const gboolean create) |
| static void | _touched_add (cairo_surface_t *surface, const int x0, const int y0, const int x1, const int y1) |
| gboolean | dt_stroke_raster_touched (cairo_surface_t *surface, cairo_rectangle_int_t *touched) |
| void | dt_stroke_raster_touched_reset (cairo_surface_t *surface) |
| gboolean | dt_stroke_raster_can_paint (cairo_surface_t *surface) |
| static void | _scratch_free (void *data) |
| static _scratch_t * | _scratch_of (cairo_surface_t *surface) |
| static gboolean | _plane_acquire (cairo_surface_t *surface, _plane_t *plane, const int x0, const int y0, const int width, const int height) |
| static gboolean | _plane_stamp_row (_plane_t *const plane, const int y, const int x_first, const int x_last, const _segment_t *const seg, const double reach2) |
| static void | _plane_stamp_capsule (_plane_t *const plane, const _segment_t *const seg, const double reach) |
| static void | _plane_stamp_dashed (_plane_t *const plane, const _segment_t *const seg, const dt_stroke_style_t *style, const double reach, _dash_t *const dash) |
| static void | _polyline_stamp (_plane_t *const plane, const double *xy, const int count, const dt_stroke_style_t *style, const double reach, const gboolean closed, _dash_t *const dash) |
| static _dash_t | _dash_start (const dt_stroke_style_t *const style) |
| static uint32_t | _pixel_pack (const double a, const double r, const double g, const double b) |
| static void | _pixel_over (uint32_t *const pixel, const dt_stroke_pass_t *const pass, const double coverage) |
| static gboolean | _composite_row (const _plane_t *const plane, const int y, const _composite_t *const c, int *const tx0, int *const tx1) |
| static void | _plane_composite_and_clear (_plane_t *const plane, cairo_surface_t *surface, const dt_stroke_style_t *style, const double reach) |
| static gboolean | _stroke_polyline (cairo_surface_t *surface, const double *xy, const int count, const dt_stroke_style_t *style, const gboolean closed, _dash_t *const dash) |
| gboolean | dt_stroke_raster_polyline (cairo_surface_t *surface, const double *xy, int count, const dt_stroke_style_t *style) |
| static double | _matrix_scale (cairo_t *cr) |
| static void | _gather_flush (_gather_t *const g, cairo_surface_t *surface, const dt_stroke_style_t *style, _dash_t *const dash) |
| static void | _gather_point (_gather_t *const g, cairo_t *cr, const cairo_path_data_t *const point) |
| gboolean | dt_stroke_raster_path (cairo_t *cr, const dt_stroke_style_t *style) |
Variables | |
| static const cairo_user_data_key_t | _touched_key = { 0 } |
| static const cairo_user_data_key_t | _scratch_key = { 0 } |
| typedef struct _composite_t _composite_t |
| typedef struct _scratch_t _scratch_t |
| typedef struct _segment_t _segment_t |
| typedef struct _touched_t _touched_t |
|
inlinestatic |
Definition at line 414 of file stroke_raster.c.
References _pixel_over(), d, FALSE, MAX, MIN, row, _plane_t::span_max, _plane_t::span_min, TRUE, _plane_t::value, _plane_t::width, x, _plane_t::x0, and _plane_t::y0.
Referenced by _plane_composite_and_clear().
|
static |
Definition at line 364 of file stroke_raster.c.
References dt_stroke_style_t::dash_on, _dash_t::on, and TRUE.
Referenced by dt_stroke_raster_path(), and dt_stroke_raster_polyline().
|
static |
Definition at line 567 of file stroke_raster.c.
References _stroke_polyline(), FALSE, and g.
Referenced by dt_stroke_raster_path().
|
static |
Definition at line 576 of file stroke_raster.c.
References g, x, point::x, and point::y.
Referenced by dt_stroke_raster_path().
|
static |
Definition at line 533 of file stroke_raster.c.
Referenced by dt_stroke_raster_path().
|
inlinestatic |
Definition at line 399 of file stroke_raster.c.
References _pixel_pack(), dt_stroke_pass_t::alpha, dt_stroke_pass_t::blue, g, dt_stroke_pass_t::green, MIN, r, and dt_stroke_pass_t::red.
Referenced by _composite_row().
|
static |
Definition at line 170 of file stroke_raster.c.
References _scratch_of(), _scratch_t::count, FALSE, height, _plane_t::height, _scratch_t::rows, _scratch_t::span_max, _plane_t::span_max, _scratch_t::span_min, _plane_t::span_min, TRUE, _scratch_t::value, _plane_t::value, width, _plane_t::width, _plane_t::x0, and _plane_t::y0.
Referenced by _stroke_polyline().
|
static |
Definition at line 438 of file stroke_raster.c.
References _composite_row(), _touched_add(), dt_stroke_pass_t::alpha, dt_stroke_style_t::bright, dt_stroke_style_t::dark, _plane_t::height, MAX, MIN, _plane_t::span_max, _plane_t::span_min, _plane_t::value, _plane_t::width, dt_stroke_pass_t::width, and _plane_t::y0.
Referenced by _stroke_polyline().
|
inlinestatic |
Definition at line 262 of file stroke_raster.c.
References _plane_stamp_row(), _segment_t::ax, _segment_t::ay, _segment_t::bx, _segment_t::by, _plane_t::height, MAX, MIN, _plane_t::span_max, _plane_t::span_min, _plane_t::width, _plane_t::x0, and _plane_t::y0.
Referenced by _plane_stamp_dashed(), and _polyline_stamp().
|
static |
Definition at line 293 of file stroke_raster.c.
References _plane_stamp_capsule(), _segment_t::ax, _segment_t::ay, _segment_t::bx, _segment_t::by, _segment_t::cap_a, _segment_t::cap_b, dt_stroke_style_t::dash_off, dt_stroke_style_t::dash_on, FALSE, _dash_t::fresh, _dash_t::left, MIN, _dash_t::on, dt_stroke_style_t::round_caps, and TRUE.
Referenced by _polyline_stamp().
|
inlinestatic |
Definition at line 233 of file stroke_raster.c.
References _segment_t::ax, _segment_t::ay, _segment_t::bx, _segment_t::by, _segment_t::cap_b, double(), FALSE, row, t, TRUE, _plane_t::value, _plane_t::width, x, _plane_t::x0, and _plane_t::y0.
Referenced by _plane_stamp_capsule().
|
static |
Definition at line 332 of file stroke_raster.c.
References _plane_stamp_capsule(), _plane_stamp_dashed(), _segment_t::ax, dt_stroke_style_t::dash_off, dt_stroke_style_t::dash_on, i, dt_stroke_style_t::round_caps, and TRUE.
Referenced by _stroke_polyline().
Definition at line 134 of file stroke_raster.c.
References _scratch_t::span_max, _scratch_t::span_min, and _scratch_t::value.
Referenced by _scratch_of().
|
static |
Definition at line 144 of file stroke_raster.c.
References _scratch_free(), and _scratch_key.
Referenced by _plane_acquire().
|
static |
Definition at line 486 of file stroke_raster.c.
References _plane_acquire(), _plane_composite_and_clear(), _polyline_stamp(), dt_stroke_style_t::bright, dt_stroke_style_t::dark, FALSE, i, MAX, MIN, TRUE, and dt_stroke_pass_t::width.
Referenced by _gather_flush(), and dt_stroke_raster_polyline().
|
static |
Definition at line 62 of file stroke_raster.c.
References _touched_of(), _touched_t::any, MAX, MIN, TRUE, _touched_t::x0, _touched_t::x1, _touched_t::y0, and _touched_t::y1.
Referenced by _plane_composite_and_clear().
|
static |
Definition at line 49 of file stroke_raster.c.
References _touched_key.
Referenced by _touched_add(), dt_stroke_raster_touched(), and dt_stroke_raster_touched_reset().
| gboolean dt_stroke_raster_can_paint | ( | cairo_surface_t * | surface | ) |
Is surface something this rasteriser can paint into: an ARGB32 image surface.
Definition at line 101 of file stroke_raster.c.
Referenced by dt_stroke_raster_path(), and dt_stroke_raster_polyline().
| gboolean dt_stroke_raster_path | ( | cairo_t * | cr, |
| const dt_stroke_style_t * | style | ||
| ) |
Stroke the current path of cr with style, then consume the path, as a pair of cairo_stroke() calls would. The path is flattened and mapped through cr's matrix into the pixels of the surface cr is drawing on – the current group's, if one is pushed – and the style's widths and dashes, given in USER units as the cairo calls receive them, are mapped through the same matrix. Returns FALSE, leaving the path in place, when that surface is not one this can paint into; the caller then strokes it with cairo instead.
Definition at line 592 of file stroke_raster.c.
References _dash_start(), _gather_flush(), _gather_point(), _matrix_scale(), dt_stroke_style_t::bright, _gather_t::closed, dt_stroke_style_t::dark, dt_stroke_style_t::dash_off, dt_stroke_style_t::dash_on, dt_stroke_raster_can_paint(), FALSE, _gather_t::first_x, _gather_t::first_y, i, _gather_t::offset_x, _gather_t::offset_y, _gather_t::scale_x, _gather_t::scale_y, TRUE, _gather_t::vertices, and dt_stroke_pass_t::width.
Referenced by _a_device_scaled_surface_is_painted_in_its_pixels(), _a_path_in_a_pushed_group_lands_where_cairo_puts_it(), _a_surface_it_cannot_write_is_refused_and_the_path_kept(), _the_matrix_scales_widths_and_positions(), and dt_draw_shape_lines().
| gboolean dt_stroke_raster_polyline | ( | cairo_surface_t * | surface, |
| const double * | xy, | ||
| int | count, | ||
| const dt_stroke_style_t * | style | ||
| ) |
Stroke count device-space vertices (x, y pairs, in the pixel grid of surface) as one open polyline into surface. The style's widths and dashes are device pixels. Returns FALSE, having painted nothing, when the surface is not one this can paint into (see dt_stroke_raster_can_paint()) or when there is nothing to draw.
Definition at line 523 of file stroke_raster.c.
References _dash_start(), _stroke_polyline(), dt_stroke_raster_can_paint(), and FALSE.
Referenced by _a_horizontal_line_paints_a_band_of_its_width(), _dashes_leave_gaps_along_the_line(), _flat_caps_stop_at_the_ends(), _the_bright_pass_paints_over_the_dark_one(), and _the_touched_record_resets().
| gboolean dt_stroke_raster_touched | ( | cairo_surface_t * | surface, |
| cairo_rectangle_int_t * | touched | ||
| ) |
The pixel rectangle everything painted into surface through this file has touched since the last reset, so a caller can composite or clear that much and no more. Returns FALSE when nothing was painted.
Definition at line 82 of file stroke_raster.c.
References _touched_of(), _touched_t::any, FALSE, TRUE, _touched_t::x0, _touched_t::x1, _touched_t::y0, and _touched_t::y1.
Referenced by _a_horizontal_line_paints_a_band_of_its_width(), _overlay_dirty(), and _the_touched_record_resets().
| void dt_stroke_raster_touched_reset | ( | cairo_surface_t * | surface | ) |
Forget the touched rectangle of surface.
Definition at line 94 of file stroke_raster.c.
References _touched_of(), _touched_t::any, and FALSE.
Referenced by _canvas_begin(), and _the_touched_record_resets().
|
static |
Definition at line 132 of file stroke_raster.c.
Referenced by _scratch_of().
|
static |
Definition at line 47 of file stroke_raster.c.
Referenced by _touched_of().