The manual
ginnOS
The reference: libc, the libraries and the kernel
Loading...
Searching...
No Matches
bragi_cache.c File Reference

bragi: the glyph cache of a face, and blending glyph masks. More...

#include "bragi_internal.h"
#include <stdlib.h>
#include <string.h>

Functions

const bragi_glyph_t * bragi_glyph (bragi_face_t *face, int glyph, int subpixel)
 a glyph image from the cache, made if it is not there.
void bragi_blend_mask (gfx_buffer_t *buf, int32_t x, int32_t y, const uint8_t *mask, int32_t width, int32_t height, int32_t stride, gfx_color_t color)
 blend a coverage mask in a colour over buf (in sRGB, as browsers do).
void bragi_test_set_budget (bragi_face_t *face, uint32_t budget)
 for the host tests: set a face's cache budget.

Detailed Description

bragi: the glyph cache of a face, and blending glyph masks.

each face keeps the glyph images it made, by glyph and subpixel position, in a hash table. a list in use order lets the cache drop the glyph used least recently when the masks use more than the budget.

Function Documentation

◆ bragi_glyph()

const bragi_glyph_t * bragi_glyph ( bragi_face_t * face,
int glyph,
int subpixel )

a glyph image from the cache, made if it is not there.

Parameters
subpixel0 to BRAGI_SUBPIXELS - 1.
Returns
the glyph, or NULL when out of memory.

◆ bragi_blend_mask()

void bragi_blend_mask ( gfx_buffer_t * buf,
int32_t x,
int32_t y,
const uint8_t * mask,
int32_t width,
int32_t height,
int32_t stride,
gfx_color_t color )

blend a coverage mask in a colour over buf (in sRGB, as browsers do).

Parameters
colorpremultiplied; its alpha scales the coverage.

◆ bragi_test_set_budget()

void bragi_test_set_budget ( bragi_face_t * face,
uint32_t budget )

for the host tests: set a face's cache budget.