NetSurf
Data Structures | Typedefs | Functions | Variables
plot.c File Reference
#include <assert.h>
#include <sys/types.h>
#include <stdint.h>
#include <string.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <mt_gem.h>
#include <mint/osbind.h>
#include "utils/log.h"
#include "utils/utf8.h"
#include "utils/utils.h"
#include "netsurf/bitmap.h"
#include "netsurf/plotters.h"
#include "netsurf/mouse.h"
#include "atari/gui.h"
#include "atari/osspec.h"
#include "atari/misc.h"
#include "atari/bitmap.h"
#include "utils/nsoption.h"
#include "atari/plot/eddi.h"
#include "atari/plot/fontplot.h"
#include "atari/plot/plot.h"
Include dependency graph for plot.c:

Go to the source code of this file.

Data Structures

struct  s_view
 

Typedefs

typedef bool(* bitmap_convert_fnc) (struct bitmap *img, int x, int y, GRECT *clip, uint32_t bg, uint32_t flags, MFDB *out)
 

Functions

void vq_scrninfo (VdiHdl handle, short *work_out)
 
static void snapshot_suspend (void)
 Garbage collection of the snapshot routine. More...
 
static void snapshot_destroy (void)
 destroy memory used by screenshot More...
 
const char * plot_err_str (int i)
 translate an error number More...
 
static void vsl_rgbcolor (short vdih, colour cin)
 Set line drawing color by passing netsurf XBGR "colour" type. More...
 
static void vsf_rgbcolor (short vdih, colour cin)
 Set fill color by passing netsurf XBGR "colour" type. More...
 
static void plot_get_visible_grect (GRECT *out)
 Get current visible coords. More...
 
static void update_visible_rect (void)
 
static bool fbrect_to_screen (GRECT box, GRECT *ret)
 Returns the visible parts of the box. More...
 
bool plot_copy_rect (GRECT src, GRECT dst)
 copy an rectangle from the plot buffer to screen More...
 
static void read_vdi_sysinfo (short vdih, struct s_vdi_sysinfo *info)
 Fill the screen info structure. More...
 
void rgb_to_vdi1000 (unsigned char *in, RGB1000 *out)
 Convert an RGB color to an VDI Color. More...
 
void vdi1000_to_rgb (unsigned short *in, unsigned char *out)
 
static void dump_vdi_info (short vdih)
 
static MFDB * snapshot_create_native_mfdb (int x, int y, int w, int h)
 Create an snapshot of the screen image in device format. More...
 
static struct bitmapsnapshot_create (int x, int y, int w, int h)
 Create an snapshot of the screen in netsurf ABGR format. More...
 
static uint32_t ablend (uint32_t pixel, uint32_t scrpixel)
 
static bool ablend_pixel (struct bitmap *img, uint32_t bg, GRECT *clip)
 Alpha blends an image, using one pixel as the background. More...
 
static bool ablend_bitmap (struct bitmap *img, struct bitmap *bg, GRECT *img_clip, GRECT *bg_clip)
 Aplha blends the foreground image onto thebackground images. More...
 
static bool bitmap_convert_tc (struct bitmap *img, int x, int y, GRECT *clip, uint32_t bg, uint32_t flags, MFDB *out)
 Convert bitmap to the native screen format. More...
 
static void convert_bitmap_done (void)
 
bool plot_blit_bitmap (struct bitmap *bmp, int x, int y, unsigned long bg, unsigned long flags)
 
bool plot_blit_mfdb (GRECT *loc, MFDB *insrc, short fgcolor, uint32_t flags)
 
int plot_init (const struct redraw_context *ctx, char *fdrvrname)
 Init screen and font driver objects. More...
 
int plot_finalise (void)
 
bool plot_lock (void)
 
bool plot_unlock (void)
 
bool plot_set_dimensions (const struct redraw_context *ctx, int x, int y, int w, int h)
 Set plot origin and canvas size. More...
 
bool plot_get_dimensions (GRECT *dst)
 Get current canvas size. More...
 
float plot_set_scale (float scale)
 set scale of plotter. More...
 
float plot_get_scale (void)
 
void plot_set_abs_clipping (const GRECT *area)
 Subsequent calls to plot_clip will be clipped by the absolute clip. More...
 
void plot_get_abs_clipping (struct rect *dst)
 Get the maximum clip extent, in absolute screen coords. More...
 
void plot_get_abs_clipping_grect (GRECT *dst)
 Get the maximum clip extent, in absolute screen coords. More...
 
VdiHdl plot_get_vdi_handle (void)
 
long plot_get_flags (void)
 
bool plot_get_clip (struct rect *out)
 
void plot_get_clip_grect (GRECT *out)
 Get clipping for current framebuffer as GRECT. More...
 
FONT_PLOTTER plot_get_text_plotter ()
 
void plot_set_text_plotter (FONT_PLOTTER font_plotter)
 
static nserror plot_clip (const struct redraw_context *ctx, const struct rect *clip)
 Sets a clip rectangle for subsequent plot operations. More...
 
static nserror plot_arc (const struct redraw_context *ctx, const plot_style_t *pstyle, int x, int y, int radius, int angle1, int angle2)
 Plots an arc. More...
 
static nserror plot_disc (const struct redraw_context *ctx, const plot_style_t *pstyle, int x, int y, int radius)
 Plots a circle. More...
 
static nserror plot_line (const struct redraw_context *ctx, const plot_style_t *pstyle, const struct rect *line)
 Plots a line. More...
 
static nserror plot_rectangle (const struct redraw_context *ctx, const plot_style_t *pstyle, const struct rect *rect)
 Plots a rectangle. More...
 
static nserror plot_polygon (const struct redraw_context *ctx, const plot_style_t *pstyle, const int *p, unsigned int n)
 Plot a polygon. More...
 
static nserror plot_path (const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
 Plots a path. More...
 
static nserror plot_bitmap (const struct redraw_context *ctx, struct bitmap *bitmap, int x, int y, int width, int height, colour bg, bitmap_flags_t flags)
 Plot a bitmap. More...
 
static nserror plot_text (const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
 Text plotting. More...
 

Variables

static const char * plot_error_codes []
 
FONT_PLOTTER fplotter = NULL
 
short vdih
 
static void * buf_packed
 
static int size_buf_packed
 
void * buf_planar
 
int size_buf_planar
 
static MFDB buf_scr
 
static int size_buf_scr
 
MFDB buf_std
 
int size_buf_std
 
struct bitmapbuf_scr_compat
 
static HermesFormat vfmt
 
static HermesFormat nsfmt
 
struct s_vdi_sysinfo vdi_sysinfo
 
static int atari_plot_bpp_virt
 
static struct s_view view
 
static HermesHandle hermes_cnv_h
 
static HermesHandle hermes_res_h
 
static struct bitmap snapshot
 
VdiHdl atari_plot_vdi_handle = -1
 
unsigned long atari_plot_flags
 
unsigned long atari_font_flags
 
static bitmap_convert_fnc bitmap_convert
 
const struct plotter_table atari_plotters
 atari plottr operation table More...
 

Typedef Documentation

◆ bitmap_convert_fnc

typedef bool(* bitmap_convert_fnc) (struct bitmap *img, int x, int y, GRECT *clip, uint32_t bg, uint32_t flags, MFDB *out)

Definition at line 212 of file plot.c.

Function Documentation

◆ ablend()

static uint32_t ablend ( uint32_t  pixel,
uint32_t  scrpixel 
)
inlinestatic

Definition at line 940 of file plot.c.

Referenced by ablend_bitmap(), and ablend_pixel().

Here is the caller graph for this function:

◆ ablend_bitmap()

static bool ablend_bitmap ( struct bitmap img,
struct bitmap bg,
GRECT *  img_clip,
GRECT *  bg_clip 
)
inlinestatic

Aplha blends the foreground image onto thebackground images.

The background receives the blended image pixels.

Definition at line 984 of file plot.c.

References ablend(), atari_bitmap_get_rowstride(), and bitmap::pixdata.

Referenced by bitmap_convert_tc().

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

◆ ablend_pixel()

static bool ablend_pixel ( struct bitmap img,
uint32_t  bg,
GRECT *  clip 
)
inlinestatic

Alpha blends an image, using one pixel as the background.

The bitmap receives the result.

Definition at line 961 of file plot.c.

References ablend(), atari_bitmap_get_rowstride(), clip(), and bitmap::pixdata.

Referenced by bitmap_convert_tc().

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

◆ bitmap_convert_tc()

static bool bitmap_convert_tc ( struct bitmap img,
int  x,
int  y,
GRECT *  clip,
uint32_t  bg,
uint32_t  flags,
MFDB *  out 
)
static

Convert bitmap to the native screen format.

Parameters
imgthe bitmap
xcoordinate where the bitmap REGION (described in clip) shall be drawn (screen coords)
ycoordinate where the bitmap REGION (described in clip) shall be drawn (screen coords)
clipwhich area of the bitmap shall be drawn
bgbackground color
flagsblit flags
outthe result MFDB

Definition at line 1308 of file plot.c.

References ablend_bitmap(), ablend_pixel(), atari_bitmap_destroy(), atari_bitmap_get_height(), atari_bitmap_get_opaque(), atari_bitmap_get_width(), atari_plot_bpp_virt, atari_plot_flags, BITMAPF_BUFFER_NATIVE, BITMAPF_MONOGLYPH, buf_packed, clip(), CONV_BLOCK_SIZE, bitmap::converted, ERR_NO_MEM, hermes_cnv_h, MFDB_STRIDE, bitmap::native, nsfmt, bitmap::opaque, bitmap::pixdata, PLOT_FLAG_TRANS, bitmap::rowstride, size_buf_packed, snapshot_create(), and vfmt.

Referenced by plot_init().

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

◆ convert_bitmap_done()

static void convert_bitmap_done ( void  )
inlinestatic

Definition at line 1468 of file plot.c.

References buf_packed, CONV_KEEP_LIMIT, and size_buf_packed.

Referenced by plot_blit_bitmap().

Here is the caller graph for this function:

◆ dump_vdi_info()

static void dump_vdi_info ( short  vdih)
static

Definition at line 710 of file plot.c.

References s_vdi_sysinfo::clut, s_vdi_sysinfo::colors, s_vdi_sysinfo::EdDiVersion, s_vdi_sysinfo::hicolors, s_vdi_sysinfo::mask_a, s_vdi_sysinfo::mask_b, s_vdi_sysinfo::mask_g, s_vdi_sysinfo::mask_r, s_vdi_sysinfo::maxintin, s_vdi_sysinfo::maxpolycoords, s_vdi_sysinfo::pitch, s_vdi_sysinfo::pixelsize, s_vdi_sysinfo::rasterscale, read_vdi_sysinfo(), s_vdi_sysinfo::scr_bpp, s_vdi_sysinfo::scr_h, s_vdi_sysinfo::scr_w, s_vdi_sysinfo::screen, s_vdi_sysinfo::screensize, s_vdi_sysinfo::vdi_handle, s_vdi_sysinfo::vdiformat, and vdih.

Referenced by plot_init().

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

◆ fbrect_to_screen()

static bool fbrect_to_screen ( GRECT  box,
GRECT *  ret 
)
inlinestatic

Returns the visible parts of the box.

The returned values are relative coords within framebuffer, relative to screen coords (normally starting at 0,0 )

Definition at line 335 of file plot.c.

References s_view::h, s_vdi_sysinfo::scr_h, s_vdi_sysinfo::scr_w, vdi_sysinfo, view, s_view::w, s_view::x, and s_view::y.

◆ plot_arc()

static nserror plot_arc ( const struct redraw_context ctx,
const plot_style_t pstyle,
int  x,
int  y,
int  radius,
int  angle1,
int  angle2 
)
static

Plots an arc.

plot an arc segment around (x,y), anticlockwise from angle1 to angle2. Angles are measured anticlockwise from horizontal, in degrees.

Parameters
ctxThe current redraw context.
pstyleStyle controlling the arc plot.
xThe x coordinate of the arc.
yThe y coordinate of the arc.
radiusThe radius of the arc.
angle1The start angle of the arc.
angle2The finish angle of the arc.
Returns
NSERROR_OK on success else error code.

Definition at line 2043 of file plot.c.

References atari_plot_vdi_handle, plot_style_s::fill_colour, plot_style_s::fill_type, NSERROR_OK, PLOT_OP_TYPE_NONE, PLOT_OP_TYPE_SOLID, plot_style_s::stroke_colour, view, vsf_rgbcolor(), vsl_rgbcolor(), s_view::x, and s_view::y.

Here is the call graph for this function:

◆ plot_bitmap()

static nserror plot_bitmap ( const struct redraw_context ctx,
struct bitmap bitmap,
int  x,
int  y,
int  width,
int  height,
colour  bg,
bitmap_flags_t  flags 
)
static

Plot a bitmap.

Tiled plot of a bitmap image. (x,y) gives the top left coordinate of an explicitly placed tile. From this tile the image can repeat in all four directions – up, down, left and right – to the extents given by the current clip rectangle.

The bitmap_flags say whether to tile in the x and y directions. If not tiling in x or y directions, the single image is plotted. The width and height give the dimensions the image is to be scaled to.

Parameters
ctxThe current redraw context.
bitmapThe bitmap to plot
xThe x coordinate to plot the bitmap
yThe y coordiante to plot the bitmap
widthThe width of area to plot the bitmap into
heightThe height of area to plot the bitmap into
bgthe background colour to alpha blend into
flagsthe flags controlling the type of plot operation
Returns
NSERROR_OK on success else error code.

Definition at line 2386 of file plot.c.

References atari_bitmap_get_height(), atari_bitmap_get_width(), atari_bitmap_resize(), bitmap(), BITMAPF_REPEAT_X, BITMAPF_REPEAT_Y, clip(), height, hermes_res_h, NSERROR_NOMEM, NSERROR_OK, nsfmt, plot_blit_bitmap(), plot_get_clip(), bitmap::resized, s_view::scale, view, and width.

Here is the call graph for this function:

◆ plot_blit_bitmap()

bool plot_blit_bitmap ( struct bitmap bmp,
int  x,
int  y,
unsigned long  bg,
unsigned long  flags 
)

Definition at line 1482 of file plot.c.

References atari_plot_vdi_handle, bitmap_convert, clip(), s_view::clipping, convert_bitmap_done(), bitmap::height, plot_get_visible_grect(), snapshot_suspend(), view, bitmap::width, s_view::x, rect::x0, rect::x1, s_view::y, rect::y0, and rect::y1.

Referenced by plot_bitmap().

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

◆ plot_blit_mfdb()

bool plot_blit_mfdb ( GRECT *  loc,
MFDB *  insrc,
short  fgcolor,
uint32_t  flags 
)

Definition at line 1551 of file plot.c.

References atari_plot_vdi_handle, init_mfdb(), PLOT_FLAG_TRANS, plot_get_clip_grect(), view, s_view::x, and s_view::y.

Here is the call graph for this function:

◆ plot_clip()

static nserror plot_clip ( const struct redraw_context ctx,
const struct rect clip 
)
static

Sets a clip rectangle for subsequent plot operations.

Parameters
ctxThe current redraw context.
clipThe rectangle to limit all subsequent plot operations within.
Returns
NSERROR_OK on success else error code.

Definition at line 1974 of file plot.c.

References atari_plot_vdi_handle, clip(), s_view::clipping, NSERROR_OK, plot_get_abs_clipping_grect(), plot_get_clip_grect(), plot_get_dimensions(), s_vdi_sysinfo::scr_h, s_vdi_sysinfo::scr_w, vdi_sysinfo, view, rect::x0, rect::x1, rect::y0, and rect::y1.

Here is the call graph for this function:

◆ plot_copy_rect()

bool plot_copy_rect ( GRECT  src,
GRECT  dst 
)

copy an rectangle from the plot buffer to screen

because this is an on-screen plotter, this is an screen to screen copy.

Definition at line 374 of file plot.c.

References atari_plot_vdi_handle, plot_get_visible_grect(), plot_lock(), plot_unlock(), view, s_view::x, and s_view::y.

Here is the call graph for this function:

◆ plot_disc()

static nserror plot_disc ( const struct redraw_context ctx,
const plot_style_t pstyle,
int  x,
int  y,
int  radius 
)
static

Plots a circle.

Plot a circle centered on (x,y), which is optionally filled.

Parameters
ctxThe current redraw context.
pstyleStyle controlling the circle plot.
xx coordinate of circle centre.
yy coordinate of circle centre.
radiuscircle radius.
Returns
NSERROR_OK on success else error code.

Definition at line 2090 of file plot.c.

References atari_plot_vdi_handle, plot_style_s::fill_colour, plot_style_s::fill_type, NSERROR_OK, PLOT_OP_TYPE_SOLID, plot_style_s::stroke_colour, view, vsf_rgbcolor(), s_view::x, and s_view::y.

Here is the call graph for this function:

◆ plot_err_str()

const char * plot_err_str ( int  i)

translate an error number

Definition at line 216 of file plot.c.

References plot_error_codes.

Referenced by plot_init().

Here is the caller graph for this function:

◆ plot_finalise()

int plot_finalise ( void  )

Definition at line 1748 of file plot.c.

References atari_plot_vdi_handle, buf_packed, buf_planar, delete_font_plotter(), fplotter, hermes_cnv_h, snapshot_destroy(), and vfmt.

Referenced by gui_quit().

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

◆ plot_get_abs_clipping()

void plot_get_abs_clipping ( struct rect dst)

Get the maximum clip extent, in absolute screen coords.

Parameters
dstthe structure that receives the absolute clipping

Definition at line 1899 of file plot.c.

References s_view::abs_clipping, and view.

◆ plot_get_abs_clipping_grect()

void plot_get_abs_clipping_grect ( GRECT *  dst)

Get the maximum clip extent, in absolute screen coords.

Parameters
dstthe structure that receives the absolute clipping

Definition at line 1909 of file plot.c.

References s_view::abs_clipping, view, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by plot_clip().

Here is the caller graph for this function:

◆ plot_get_clip()

bool plot_get_clip ( struct rect out)

Definition at line 1930 of file plot.c.

References s_view::clipping, view, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by plot_bitmap(), and plot_get_clip_grect().

Here is the caller graph for this function:

◆ plot_get_clip_grect()

void plot_get_clip_grect ( GRECT *  out)

Get clipping for current framebuffer as GRECT.

Definition at line 1940 of file plot.c.

References clip(), and plot_get_clip().

Referenced by plot_blit_mfdb(), and plot_clip().

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

◆ plot_get_dimensions()

bool plot_get_dimensions ( GRECT *  dst)

Get current canvas size.

Parameters
dstthe GRECT * which receives the canvas size

Definition at line 1838 of file plot.c.

References s_view::h, view, s_view::w, s_view::x, and s_view::y.

Referenced by plot_clip(), and plot_set_abs_clipping().

Here is the caller graph for this function:

◆ plot_get_flags()

long plot_get_flags ( void  )

Definition at line 1924 of file plot.c.

References atari_plot_flags.

Referenced by atari_treeview_redraw().

Here is the caller graph for this function:

◆ plot_get_scale()

float plot_get_scale ( void  )

Definition at line 1864 of file plot.c.

References s_view::scale, and view.

Referenced by atari_font_position(), atari_font_split(), and atari_font_width().

Here is the caller graph for this function:

◆ plot_get_text_plotter()

FONT_PLOTTER plot_get_text_plotter ( void  )

Definition at line 1953 of file plot.c.

References fplotter.

◆ plot_get_vdi_handle()

VdiHdl plot_get_vdi_handle ( void  )

Definition at line 1918 of file plot.c.

References atari_plot_vdi_handle.

Referenced by atari_about_show(), atari_treeview_redraw(), and window_redraw_favicon().

Here is the caller graph for this function:

◆ plot_get_visible_grect()

static void plot_get_visible_grect ( GRECT *  out)
inlinestatic

Get current visible coords.

Definition at line 279 of file plot.c.

References view, s_view::vis_h, s_view::vis_w, s_view::vis_x, and s_view::vis_y.

Referenced by plot_blit_bitmap(), and plot_copy_rect().

Here is the caller graph for this function:

◆ plot_init()

int plot_init ( const struct redraw_context ctx,
char *  fdrvrname 
)

Init screen and font driver objects.

Parameters
ctxThe current redraw context.
fdrvrnamefont driver name.
Returns
value > 1 when the objects could be succesfully created or <= 0 to indicate an error.

Definition at line 1612 of file plot.c.

References atari_font_flags, atari_plot_bpp_virt, atari_plot_flags, atari_plot_vdi_handle, bitmap_convert, bitmap_convert_tc(), buf_packed, buf_planar, clip(), plotter_table::clip, die(), dump_font_drivers(), dump_vdi_info(), FONTPLOT_FLAG_MONOGLYPH, fplotter, s_view::h, hermes_cnv_h, hermes_res_h, s_vdi_sysinfo::mask_a, s_vdi_sysinfo::mask_b, s_vdi_sysinfo::mask_g, s_vdi_sysinfo::mask_r, new_font_plotter(), nsfmt, NSLOG, nsoption_int, redraw_context::plot, plot_err_str(), PLOT_FLAG_DITHER, PLOT_FLAG_TRANS, plot_set_scale(), read_vdi_sysinfo(), rgb_to_vdi1000(), s_vdi_sysinfo::scr_bpp, size_buf_packed, size_buf_planar, update_visible_rect(), vdi1000_to_rgb(), VDI_FORMAT_PACK, vdi_sysinfo, s_vdi_sysinfo::vdiformat, verbose_log, vfmt, view, s_view::w, s_view::x, and s_view::y.

Referenced by gui_init().

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

◆ plot_line()

static nserror plot_line ( const struct redraw_context ctx,
const plot_style_t pstyle,
const struct rect line 
)
static

Plots a line.

plot a line from (x0,y0) to (x1,y1). Coordinates are at centre of line width/thickness.

Parameters
ctxThe current redraw context.
pstyleStyle controlling the line plot.
lineA rectangle defining the line to be drawn
Returns
NSERROR_OK on success else error code.

Definition at line 2121 of file plot.c.

References atari_plot_vdi_handle, s_view::h, line(), NSERROR_OK, NSLT2VDI, plot_style_fixed_to_int, plot_style_s::stroke_colour, plot_style_s::stroke_width, view, vsl_rgbcolor(), s_view::x, and s_view::y.

Here is the call graph for this function:

◆ plot_lock()

bool plot_lock ( void  )

Definition at line 1775 of file plot.c.

References atari_plot_flags, and PLOT_FLAG_LOCKED.

Referenced by atari_treeview_redraw(), plot_copy_rect(), and window_process_redraws().

Here is the caller graph for this function:

◆ plot_path()

static nserror plot_path ( const struct redraw_context ctx,
const plot_style_t pstyle,
const float *  p,
unsigned int  n,
const float  transform[6] 
)
static

Plots a path.

Path plot consisting of cubic Bezier curves. Line and fill colour is controlled by the plot style.

Parameters
ctxThe current redraw context.
pstyleStyle controlling the path plot.
pelements of path
nnunber of elements on path
transformA transform to apply to the path.
Returns
NSERROR_OK on success else error code.
Todo:
Implement atari path plot

Definition at line 2350 of file plot.c.

References NSERROR_OK.

◆ plot_polygon()

static nserror plot_polygon ( const struct redraw_context ctx,
const plot_style_t pstyle,
const int *  p,
unsigned int  n 
)
static

Plot a polygon.

Plots a filled polygon with straight lines between points. The lines around the edge of the ploygon are not plotted. The polygon is filled with the non-zero winding rule.

Parameters
ctxThe current redraw context.
pstyleStyle controlling the polygon plot.
pverticies of polygon
nnumber of verticies.
Returns
NSERROR_OK on success else error code.

Definition at line 2304 of file plot.c.

References atari_plot_vdi_handle, plot_style_s::fill_colour, plot_style_s::fill_type, s_vdi_sysinfo::maxpolycoords, NSERROR_OK, PLOT_OP_TYPE_SOLID, plot_style_s::stroke_colour, vdi_sysinfo, view, vsf_rgbcolor(), vsl_rgbcolor(), s_view::x, and s_view::y.

Here is the call graph for this function:

◆ plot_rectangle()

static nserror plot_rectangle ( const struct redraw_context ctx,
const plot_style_t pstyle,
const struct rect rect 
)
static

Plots a rectangle.

The rectangle can be filled an outline or both controlled by the plot style The line can be solid, dotted or dashed. Top left corner at (x0,y0) and rectangle has given width and height.

Parameters
ctxThe current redraw context.
pstyleStyle controlling the rectangle plot.
rectA rectangle defining the line to be drawn
Returns
NSERROR_OK on success else error code.

Definition at line 2180 of file plot.c.

References atari_plot_vdi_handle, s_view::clipping, plot_style_s::fill_colour, plot_style_s::fill_type, NSERROR_OK, NSLT2VDI, PLOT_OP_TYPE_NONE, plot_style_fixed_to_int, plot_style_s::stroke_colour, plot_style_s::stroke_type, plot_style_s::stroke_width, view, s_view::vis_h, s_view::vis_w, vsf_rgbcolor(), vsl_rgbcolor(), s_view::x, rect::x0, rect::x1, s_view::y, rect::y0, and rect::y1.

Here is the call graph for this function:

◆ plot_set_abs_clipping()

void plot_set_abs_clipping ( const GRECT *  area)

Subsequent calls to plot_clip will be clipped by the absolute clip.

Parameters
areathe maximum clipping rectangle (absolute screen coords)

Definition at line 1875 of file plot.c.

References s_view::abs_clipping, plot_get_dimensions(), view, rect::x0, rect::x1, rect::y0, and rect::y1.

Referenced by plot_set_dimensions(), and window_process_redraws().

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

◆ plot_set_dimensions()

bool plot_set_dimensions ( const struct redraw_context ctx,
int  x,
int  y,
int  w,
int  h 
)

Set plot origin and canvas size.

Parameters
ctxThe current redraw context.
xthe x origin
ythe y origin
wthe width of the plot area
hthe height of the plot area

Definition at line 1806 of file plot.c.

References plotter_table::clip, s_view::h, redraw_context::plot, plot_set_abs_clipping(), update_visible_rect(), view, s_view::w, s_view::x, and s_view::y.

Referenced by atari_treeview_redraw(), toolbar_redraw(), window_redraw_content(), and window_redraw_favicon().

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

◆ plot_set_scale()

float plot_set_scale ( float  scale)

set scale of plotter.

Parameters
scalethe new scale value
Returns
the old scale value

Definition at line 1854 of file plot.c.

References s_view::scale, and view.

Referenced by plot_init(), toolbar_redraw(), and window_redraw_content().

Here is the caller graph for this function:

◆ plot_set_text_plotter()

void plot_set_text_plotter ( FONT_PLOTTER  font_plotter)

Definition at line 1959 of file plot.c.

References fplotter.

◆ plot_text()

static nserror plot_text ( const struct redraw_context ctx,
const struct plot_font_style fstyle,
int  x,
int  y,
const char *  text,
size_t  length 
)
static

Text plotting.

Parameters
ctxThe current redraw context.
fstyleplot style for this text
xx coordinate
yy coordinate
textUTF-8 string to plot
lengthlength of string, in bytes
Returns
NSERROR_OK on success else error code.

Definition at line 2488 of file plot.c.

References fplotter, NSERROR_OK, s_view::scale, plot_font_style::size, s_font_plotter::text, text(), and view.

Here is the call graph for this function:

◆ plot_unlock()

bool plot_unlock ( void  )

Definition at line 1791 of file plot.c.

References atari_plot_flags, atari_plot_vdi_handle, and PLOT_FLAG_LOCKED.

Referenced by atari_treeview_redraw(), plot_copy_rect(), and window_process_redraws().

Here is the caller graph for this function:

◆ read_vdi_sysinfo()

static void read_vdi_sysinfo ( short  vdih,
struct s_vdi_sysinfo info 
)
static

Fill the screen info structure.

Parameters
vdihThe handle
[out]infoThe infor structure to fill.
Todo:
this long is being cast to a pointer

Definition at line 432 of file plot.c.

References s_vdi_sysinfo::clut, s_vdi_sysinfo::colors, EDDI_10, EDDI_11, EdDI_version(), s_vdi_sysinfo::EdDiVersion, s_vdi_sysinfo::hicolors, s_vdi_sysinfo::mask_a, s_vdi_sysinfo::mask_b, s_vdi_sysinfo::mask_g, s_vdi_sysinfo::mask_r, s_vdi_sysinfo::maxintin, s_vdi_sysinfo::maxpolycoords, s_vdi_sysinfo::pitch, s_vdi_sysinfo::pixelsize, s_vdi_sysinfo::rasterscale, s_vdi_sysinfo::scr_bpp, s_vdi_sysinfo::scr_h, s_vdi_sysinfo::scr_w, s_vdi_sysinfo::screen, s_vdi_sysinfo::screensize, tos_getcookie(), VDI_CLUT_HARDWARE, VDI_CLUT_NONE, VDI_CLUT_SOFTWARE, VDI_FORMAT_INTER, VDI_FORMAT_PACK, s_vdi_sysinfo::vdi_handle, s_vdi_sysinfo::vdiformat, vdih, and vq_scrninfo().

Referenced by dump_vdi_info(), and plot_init().

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

◆ rgb_to_vdi1000()

void rgb_to_vdi1000 ( unsigned char *  in,
RGB1000 *  out 
)
inline

Convert an RGB color to an VDI Color.

Definition at line 564 of file plot.c.

Referenced by plot_init(), vsf_rgbcolor(), and vsl_rgbcolor().

Here is the caller graph for this function:

◆ snapshot_create()

static struct bitmap * snapshot_create ( int  x,
int  y,
int  w,
int  h 
)
static

Create an snapshot of the screen in netsurf ABGR format.

This creates an snapshot in RGBA format (NetSurf's native format)

Capture the screen at x,y location

Parameters
xabsolute screen coords
yabsolute screen coords
wwidth
hheight

Definition at line 803 of file plot.c.

References atari_bitmap_create(), atari_bitmap_get_rowstride(), atari_bitmap_realloc(), BITMAP_GROW, bitmap::bpp, buf_scr_compat, bitmap::height, hermes_cnv_h, MFDB_STRIDE, bitmap::native, nsfmt, bitmap::pixdata, s_vdi_sysinfo::pixelsize, bitmap::rowstride, snapshot, snapshot_create_native_mfdb(), vdi_sysinfo, vfmt, and bitmap::width.

Referenced by bitmap_convert_tc().

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

◆ snapshot_create_native_mfdb()

static MFDB * snapshot_create_native_mfdb ( int  x,
int  y,
int  w,
int  h 
)
static

Create an snapshot of the screen image in device format.

Definition at line 742 of file plot.c.

References atari_plot_vdi_handle, buf_scr, init_mfdb(), MFDB_STRIDE, s_vdi_sysinfo::scr_bpp, size_buf_scr, and vdi_sysinfo.

Referenced by snapshot_create().

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

◆ snapshot_destroy()

static void snapshot_destroy ( void  )
static

destroy memory used by screenshot

Shut down the snapshot interface.

Definition at line 922 of file plot.c.

References atari_bitmap_destroy(), buf_scr, buf_scr_compat, and buf_std.

Referenced by plot_finalise().

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

◆ snapshot_suspend()

static void snapshot_suspend ( void  )
static

Garbage collection of the snapshot routine.

Notify the snapshot interface that the last snapshot is no longer in use.

this should be called after you are done with the data returned by snapshot_create don't access the screenshot after you called this function

Definition at line 877 of file plot.c.

References atari_bitmap_buffer_size(), atari_bitmap_realloc(), BITMAP_SHRINK, bitmap::bpp, buf_scr, buf_scr_compat, buf_std, CONV_KEEP_LIMIT, size_buf_scr, and size_buf_std.

Referenced by plot_blit_bitmap().

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

◆ update_visible_rect()

static void update_visible_rect ( void  )
inlinestatic

Definition at line 295 of file plot.c.

References common, s_view::h, s_vdi_sysinfo::scr_h, s_vdi_sysinfo::scr_w, vdi_sysinfo, view, s_view::vis_h, s_view::vis_w, s_view::vis_x, s_view::vis_y, s_view::w, s_view::x, and s_view::y.

Referenced by plot_init(), and plot_set_dimensions().

Here is the caller graph for this function:

◆ vdi1000_to_rgb()

void vdi1000_to_rgb ( unsigned short *  in,
unsigned char *  out 
)
inline

Definition at line 576 of file plot.c.

Referenced by plot_init().

Here is the caller graph for this function:

◆ vq_scrninfo()

void vq_scrninfo ( VdiHdl  handle,
short *  work_out 
)

Referenced by read_vdi_sysinfo().

Here is the caller graph for this function:

◆ vsf_rgbcolor()

static void vsf_rgbcolor ( short  vdih,
colour  cin 
)
inlinestatic

Set fill color by passing netsurf XBGR "colour" type.

Parameters
vdihThe vdi handle
cinThe netsurf colour value

Definition at line 255 of file plot.c.

References OFFSET_CUSTOM_COLOR, rgb_to_vdi1000(), s_vdi_sysinfo::scr_bpp, vdi_sysinfo, and vdih.

Referenced by plot_arc(), plot_disc(), plot_polygon(), and plot_rectangle().

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

◆ vsl_rgbcolor()

static void vsl_rgbcolor ( short  vdih,
colour  cin 
)
inlinestatic

Set line drawing color by passing netsurf XBGR "colour" type.

Parameters
vdihThe vdi handle
cinThe netsurf colour value

Definition at line 228 of file plot.c.

References OFFSET_CUSTOM_COLOR, rgb_to_vdi1000(), s_vdi_sysinfo::scr_bpp, vdi_sysinfo, and vdih.

Referenced by plot_arc(), plot_line(), plot_polygon(), and plot_rectangle().

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

Variable Documentation

◆ atari_font_flags

unsigned long atari_font_flags

Definition at line 210 of file plot.c.

Referenced by plot_init().

◆ atari_plot_bpp_virt

int atari_plot_bpp_virt
static

Definition at line 198 of file plot.c.

Referenced by bitmap_convert_tc(), and plot_init().

◆ atari_plot_flags

unsigned long atari_plot_flags

Definition at line 209 of file plot.c.

Referenced by bitmap_convert_tc(), plot_get_flags(), plot_init(), plot_lock(), and plot_unlock().

◆ atari_plot_vdi_handle

VdiHdl atari_plot_vdi_handle = -1

◆ atari_plotters

const struct plotter_table atari_plotters
Initial value:
= {
.rectangle = plot_rectangle,
.line = plot_line,
.polygon = plot_polygon,
.clip = plot_clip,
.text = plot_text,
.disc = plot_disc,
.arc = plot_arc,
.bitmap = plot_bitmap,
.path = plot_path,
.flush = NULL,
.group_start = NULL,
.group_end = NULL,
.option_knockout = true
}
static nserror plot_path(const struct redraw_context *ctx, const plot_style_t *pstyle, const float *p, unsigned int n, const float transform[6])
Plots a path.
Definition: plot.c:2350
static nserror plot_clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.
Definition: plot.c:1974
static nserror plot_text(const struct redraw_context *ctx, const struct plot_font_style *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
Definition: plot.c:2488
static nserror plot_bitmap(const struct redraw_context *ctx, struct bitmap *bitmap, int x, int y, int width, int height, colour bg, bitmap_flags_t flags)
Plot a bitmap.
Definition: plot.c:2386
static nserror plot_rectangle(const struct redraw_context *ctx, const plot_style_t *pstyle, const struct rect *rect)
Plots a rectangle.
Definition: plot.c:2180
static nserror plot_disc(const struct redraw_context *ctx, const plot_style_t *pstyle, int x, int y, int radius)
Plots a circle.
Definition: plot.c:2090
static nserror plot_line(const struct redraw_context *ctx, const plot_style_t *pstyle, const struct rect *line)
Plots a line.
Definition: plot.c:2121
static nserror plot_polygon(const struct redraw_context *ctx, const plot_style_t *pstyle, const int *p, unsigned int n)
Plot a polygon.
Definition: plot.c:2304
static nserror plot_arc(const struct redraw_context *ctx, const plot_style_t *pstyle, int x, int y, int radius, int angle1, int angle2)
Plots an arc.
Definition: plot.c:2043

atari plottr operation table

Definition at line 2507 of file plot.c.

Referenced by atari_treeview_redraw(), and gui_init().

◆ bitmap_convert

bitmap_convert_fnc bitmap_convert
static

Definition at line 213 of file plot.c.

Referenced by plot_blit_bitmap(), and plot_init().

◆ buf_packed

void* buf_packed
static

Definition at line 170 of file plot.c.

Referenced by bitmap_convert_tc(), convert_bitmap_done(), plot_finalise(), and plot_init().

◆ buf_planar

void* buf_planar

Definition at line 174 of file plot.c.

Referenced by plot_finalise(), and plot_init().

◆ buf_scr

MFDB buf_scr
static

Definition at line 179 of file plot.c.

Referenced by snapshot_create_native_mfdb(), snapshot_destroy(), and snapshot_suspend().

◆ buf_scr_compat

struct bitmap* buf_scr_compat

Definition at line 186 of file plot.c.

Referenced by snapshot_create(), snapshot_destroy(), and snapshot_suspend().

◆ buf_std

MFDB buf_std

Definition at line 183 of file plot.c.

Referenced by snapshot_destroy(), and snapshot_suspend().

◆ fplotter

FONT_PLOTTER fplotter = NULL

◆ hermes_cnv_h

HermesHandle hermes_cnv_h
static

Definition at line 202 of file plot.c.

Referenced by bitmap_convert_tc(), plot_finalise(), plot_init(), and snapshot_create().

◆ hermes_res_h

HermesHandle hermes_res_h
static

Definition at line 203 of file plot.c.

Referenced by plot_bitmap(), and plot_init().

◆ nsfmt

HermesFormat nsfmt
static

Definition at line 194 of file plot.c.

Referenced by bitmap_convert_tc(), plot_bitmap(), plot_init(), and snapshot_create().

◆ plot_error_codes

const char* plot_error_codes[]
static
Initial value:
= {
"None",
"ERR_BUFFERSIZE_EXCEEDS_SCREEN",
"ERR_NO_MEM",
"ERR_PLOTTER_NOT_AVAILABLE"
}

Definition at line 158 of file plot.c.

Referenced by plot_err_str().

◆ size_buf_packed

int size_buf_packed
static

Definition at line 171 of file plot.c.

Referenced by bitmap_convert_tc(), convert_bitmap_done(), and plot_init().

◆ size_buf_planar

int size_buf_planar

Definition at line 175 of file plot.c.

Referenced by plot_init().

◆ size_buf_scr

int size_buf_scr
static

Definition at line 180 of file plot.c.

Referenced by snapshot_create_native_mfdb(), and snapshot_suspend().

◆ size_buf_std

int size_buf_std

Definition at line 184 of file plot.c.

Referenced by snapshot_suspend().

◆ snapshot

struct bitmap snapshot
static

Definition at line 206 of file plot.c.

Referenced by llcache_object_snapshot(), and snapshot_create().

◆ vdi_sysinfo

struct s_vdi_sysinfo vdi_sysinfo

◆ vdih

short vdih
extern

◆ vfmt

HermesFormat vfmt
static

Definition at line 189 of file plot.c.

Referenced by bitmap_convert_tc(), plot_finalise(), plot_init(), and snapshot_create().

◆ view

struct s_view view
static