add visual_resize_internal to visual_interface API #1718

This commit is contained in:
nick black 2021-06-05 23:33:24 -04:00 committed by Nick Black
parent a7f41dcefa
commit 0184ccc0b3
3 changed files with 15 additions and 0 deletions

View File

@ -1,6 +1,10 @@
This document attempts to list user-visible changes and any major internal
rearrangements of Notcurses.
* 2.3.3 (not yet released)
* `ncvisual_blit()` without a multimedia engine will now properly scale
the output according to the provided `ncvisual_options`.
* 2.3.2 (2021-06-03)
* Fixed a bug affecting certain scalings of `ncvisual` objects created from
memory (e.g. `ncvisual_from_rgba()`).

View File

@ -1649,6 +1649,8 @@ resize_bitmap(const uint32_t* bmap, int srows, int scols, size_t sstride,
return ret;
}
// implemented by a multimedia backend (ffmpeg or oiio), and installed
// prior to calling notcurses_core_init() (by notcurses_init()).
typedef struct ncvisual_implementation {
int (*visual_init)(int loglevel);
void (*visual_printbanner)(const struct notcurses* nc);
@ -1665,6 +1667,14 @@ typedef struct ncvisual_implementation {
int (*visual_stream)(notcurses* nc, struct ncvisual* ncv, float timescale,
ncstreamcb streamer, const struct ncvisual_options* vopts, void* curry);
char* (*visual_subtitle)(const struct ncvisual* ncv);
// do a resize, without updating the ncvisual structure. if the target
// parameters are already matched, the existing data will be returned.
// otherwise, a scaled copy will be returned. they can be differentiated
// by comparing the result against ncv->data.
uint32_t* (*visual_resize_internal)(const struct ncvisual* ncv, int rows,
int* stride, int cols,
const struct blitterargs* bargs);
// do a persistent resize, changing the ncv itself
int (*visual_resize)(struct ncvisual* ncv, int rows, int cols);
void (*visual_destroy)(struct ncvisual* ncv);
bool canopen_images;

View File

@ -631,6 +631,7 @@ static const ncvisual_implementation ffmpeg_impl = {
.visual_decode_loop = ffmpeg_decode_loop,
.visual_stream = ffmpeg_stream,
.visual_subtitle = ffmpeg_subtitle,
.visual_resize_internal = ffmpeg_resize_internal,
.visual_resize = ffmpeg_resize,
.visual_destroy = ffmpeg_destroy,
.canopen_images = true,