mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 14:31:10 +01:00
raster-draw: hardwire output format to A8
This commit is contained in:
1 parent
5ea04afcda
commit
70f45cbdcd
4 files changed
+19
-53
No files matched your search
@@ -1011,8 +1011,6 @@ hb_raster_draw_reference
|
||||
hb_raster_draw_destroy
|
||||
hb_raster_draw_set_user_data
|
||||
hb_raster_draw_get_user_data
|
||||
hb_raster_draw_set_format
|
||||
hb_raster_draw_get_format
|
||||
hb_raster_draw_set_transform
|
||||
hb_raster_draw_get_transform
|
||||
hb_raster_draw_set_extents
|
||||
|
||||
+10
-43
@@ -65,7 +65,6 @@ struct hb_raster_draw_t
|
||||
hb_object_header_t header;
|
||||
|
||||
/* Configuration */
|
||||
hb_raster_format_t format = HB_RASTER_FORMAT_A8;
|
||||
hb_transform_t<> transform = {1, 0, 0, 1, 0, 0};
|
||||
hb_raster_extents_t fixed_extents = {};
|
||||
bool has_fixed_extents = false;
|
||||
@@ -187,40 +186,6 @@ hb_raster_draw_get_user_data (hb_raster_draw_t *draw,
|
||||
return hb_object_get_user_data (draw, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* hb_raster_draw_set_format:
|
||||
* @draw: a rasterizer
|
||||
* @format: the pixel format to use
|
||||
*
|
||||
* Sets the output pixel format for subsequent renders.
|
||||
* The default is @HB_RASTER_FORMAT_A8.
|
||||
*
|
||||
* XSince: REPLACEME
|
||||
**/
|
||||
void
|
||||
hb_raster_draw_set_format (hb_raster_draw_t *draw,
|
||||
hb_raster_format_t format)
|
||||
{
|
||||
draw->format = format;
|
||||
}
|
||||
|
||||
/**
|
||||
* hb_raster_draw_get_format:
|
||||
* @draw: a rasterizer
|
||||
*
|
||||
* Fetches the output pixel format of the rasterizer.
|
||||
*
|
||||
* Return value:
|
||||
* The #hb_raster_format_t of the rasterizer
|
||||
*
|
||||
* XSince: REPLACEME
|
||||
**/
|
||||
hb_raster_format_t
|
||||
hb_raster_draw_get_format (hb_raster_draw_t *draw)
|
||||
{
|
||||
return draw->format;
|
||||
}
|
||||
|
||||
/**
|
||||
* hb_raster_draw_set_transform:
|
||||
* @draw: a rasterizer
|
||||
@@ -375,7 +340,6 @@ hb_raster_draw_set_glyph_extents (hb_raster_draw_t *draw,
|
||||
void
|
||||
hb_raster_draw_reset (hb_raster_draw_t *draw)
|
||||
{
|
||||
draw->format = HB_RASTER_FORMAT_A8;
|
||||
draw->transform = {1, 0, 0, 1, 0, 0};
|
||||
draw->fixed_extents = {};
|
||||
draw->has_fixed_extents = false;
|
||||
@@ -1141,6 +1105,14 @@ sweep_row_to_alpha (uint8_t *__restrict row_buf,
|
||||
* #hb_raster_image_t. After rendering, the accumulated edges are
|
||||
* cleared so the rasterizer can be reused.
|
||||
*
|
||||
* Typical usage:
|
||||
* ```
|
||||
* hb_raster_draw_t *draw = hb_raster_draw_create_or_fail ();
|
||||
* hb_raster_draw_set_glyph_extents (draw, &glyph_extents);
|
||||
* hb_font_draw_glyph (font, gid, hb_raster_draw_get_funcs (), draw);
|
||||
* hb_raster_image_t *img = hb_raster_draw_render (draw);
|
||||
* ```
|
||||
*
|
||||
* Return value: (transfer full):
|
||||
* A rendered #hb_raster_image_t. Returns `NULL` on allocation/configuration
|
||||
* failure. If no geometry was accumulated, returns an empty image.
|
||||
@@ -1194,12 +1166,7 @@ hb_raster_draw_render (hb_raster_draw_t *draw)
|
||||
|
||||
/* ── 2. Compute stride ─────────────────────────────────────────── */
|
||||
if (ext.stride == 0)
|
||||
{
|
||||
if (draw->format == HB_RASTER_FORMAT_BGRA32)
|
||||
ext.stride = ext.width * 4;
|
||||
else
|
||||
ext.stride = (ext.width + 3u) & ~3u;
|
||||
}
|
||||
ext.stride = (ext.width + 3u) & ~3u;
|
||||
|
||||
/* ── 3. Allocate or reuse image ─────────────────────────────────── */
|
||||
hb_raster_image_t *image;
|
||||
@@ -1214,7 +1181,7 @@ hb_raster_draw_render (hb_raster_draw_t *draw)
|
||||
if (unlikely (!image)) goto fail;
|
||||
}
|
||||
|
||||
if (unlikely (!image->configure (draw->format, ext)))
|
||||
if (unlikely (!image->configure (HB_RASTER_FORMAT_A8, ext)))
|
||||
{
|
||||
hb_raster_image_destroy (image);
|
||||
image = nullptr;
|
||||
|
||||
@@ -281,7 +281,6 @@ hb_raster_paint_push_clip_glyph (hb_paint_funcs_t *pfuncs HB_UNUSED,
|
||||
hb_raster_draw_t *rdr = c->clip_rdr;
|
||||
const hb_transform_t<> &t = c->current_transform ();
|
||||
hb_raster_draw_set_transform (rdr, t.xx, t.yx, t.xy, t.yy, t.x0, t.y0);
|
||||
hb_raster_draw_set_format (rdr, HB_RASTER_FORMAT_A8);
|
||||
/* Let draw-render choose tight glyph extents; we map by mask origin below. */
|
||||
|
||||
hb_font_draw_glyph (font, glyph, hb_raster_draw_get_funcs (), rdr);
|
||||
@@ -1888,6 +1887,15 @@ hb_raster_paint_get_funcs (void)
|
||||
* completed. The paint context's surface stack is consumed and
|
||||
* the result returned as a new #hb_raster_image_t.
|
||||
*
|
||||
* Typical usage:
|
||||
* ```
|
||||
* hb_raster_paint_t *paint = hb_raster_paint_create_or_fail ();
|
||||
* hb_raster_paint_set_foreground (paint, foreground);
|
||||
* hb_raster_paint_set_glyph_extents (paint, &glyph_extents);
|
||||
* hb_font_paint_glyph (font, gid, hb_raster_paint_get_funcs (), paint, 0, foreground);
|
||||
* hb_raster_image_t *img = hb_raster_paint_render (paint);
|
||||
* ```
|
||||
*
|
||||
* Call hb_font_paint_glyph() before calling this function.
|
||||
* hb_raster_paint_set_extents() or hb_raster_paint_set_glyph_extents()
|
||||
* must be called before painting; otherwise this function returns `NULL`.
|
||||
|
||||
@@ -151,13 +151,6 @@ HB_EXTERN void *
|
||||
hb_raster_draw_get_user_data (hb_raster_draw_t *draw,
|
||||
hb_user_data_key_t *key);
|
||||
|
||||
HB_EXTERN void
|
||||
hb_raster_draw_set_format (hb_raster_draw_t *draw,
|
||||
hb_raster_format_t format);
|
||||
|
||||
HB_EXTERN hb_raster_format_t
|
||||
hb_raster_draw_get_format (hb_raster_draw_t *draw);
|
||||
|
||||
HB_EXTERN void
|
||||
hb_raster_draw_set_transform (hb_raster_draw_t *draw,
|
||||
float xx, float yx,
|
||||
|
||||
Reference in new issue
Block a user