diff options
Diffstat (limited to 'libass/ass_rasterizer.h')
-rw-r--r-- | libass/ass_rasterizer.h | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/libass/ass_rasterizer.h b/libass/ass_rasterizer.h index d20feb3..73cdba4 100644 --- a/libass/ass_rasterizer.h +++ b/libass/ass_rasterizer.h @@ -22,7 +22,7 @@ #include <stddef.h> #include <stdint.h> -#include "ass.h" +#include "ass_bitmap.h" #include "ass_font.h" @@ -42,48 +42,25 @@ struct segment { int32_t x_min, x_max, y_min, y_max; }; - -typedef void (*FillSolidTileFunc)(uint8_t *buf, ptrdiff_t stride, int set); -typedef void (*FillHalfplaneTileFunc)(uint8_t *buf, ptrdiff_t stride, - int32_t a, int32_t b, int64_t c, int32_t scale); -typedef void (*FillGenericTileFunc)(uint8_t *buf, ptrdiff_t stride, - const struct segment *line, size_t n_lines, - int winding); - -void ass_fill_solid_tile16_c(uint8_t *buf, ptrdiff_t stride, int set); -void ass_fill_solid_tile32_c(uint8_t *buf, ptrdiff_t stride, int set); -void ass_fill_halfplane_tile16_c(uint8_t *buf, ptrdiff_t stride, - int32_t a, int32_t b, int64_t c, int32_t scale); -void ass_fill_halfplane_tile32_c(uint8_t *buf, ptrdiff_t stride, - int32_t a, int32_t b, int64_t c, int32_t scale); -void ass_fill_generic_tile16_c(uint8_t *buf, ptrdiff_t stride, - const struct segment *line, size_t n_lines, - int winding); -void ass_fill_generic_tile32_c(uint8_t *buf, ptrdiff_t stride, - const struct segment *line, size_t n_lines, - int winding); - -typedef struct ass_rasterizer { +typedef struct { int outline_error; // acceptable error (in 1/64 pixel units) - int tile_order; // log2(tile_size) - FillSolidTileFunc fill_solid; - FillHalfplaneTileFunc fill_halfplane; - FillGenericTileFunc fill_generic; - - int32_t x_min, x_max, y_min, y_max; // usable after rasterizer_set_outline + // usable after rasterizer_set_outline + int32_t x_min, x_max, y_min, y_max; // internal buffers struct segment *linebuf[2]; size_t size[2], capacity[2]; -} ASS_Rasterizer; +} RasterizerData; + +void rasterizer_init(RasterizerData *rst, int outline_error); +void rasterizer_done(RasterizerData *rst); -void rasterizer_init(ASS_Rasterizer *rst); -void rasterizer_done(ASS_Rasterizer *rst); /** * \brief Convert FreeType outline to polyline and calculate exact bounds */ -int rasterizer_set_outline(ASS_Rasterizer *rst, const ASS_Outline *path); +int rasterizer_set_outline(RasterizerData *rst, const ASS_Outline *path); + /** * \brief Polyline rasterization function * \param x0, y0, width, height in: source window (full pixel units) @@ -92,7 +69,8 @@ int rasterizer_set_outline(ASS_Rasterizer *rst, const ASS_Outline *path); * \return zero on error * Deletes preprocessed polyline after work. */ -int rasterizer_fill(ASS_Rasterizer *rst, uint8_t *buf, int x0, int y0, +int rasterizer_fill(const BitmapEngine *engine, RasterizerData *rst, + uint8_t *buf, int x0, int y0, int width, int height, ptrdiff_t stride); |