mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 09:09:03 -04:00
[ncvisual] refuse to blit bitmaps to standard plane
This commit is contained in:
parent
1599e026cd
commit
a6548fbcc8
2
NEWS.md
2
NEWS.md
@ -4,6 +4,8 @@ rearrangements of Notcurses.
|
||||
* 2.2.4 (not yet released)
|
||||
* Implemented **EXPERIMENTAL** `NCBLIT_PIXEL` for terminals reporting the
|
||||
Kitty pixel graphics protocol.
|
||||
* Added `notcurses_debug_caps()` to dump terminal properties, both those
|
||||
reported and those inferred, to a `FILE*`.
|
||||
|
||||
* 2.2.3 (2021-03-08)
|
||||
* Implemented **EXPERIMENTAL** `NCBLIT_PIXEL` for terminals reporting Sixel
|
||||
|
@ -218,9 +218,11 @@ check for support with **notcurses_check_pixel_support**. If this function has
|
||||
not successfully returned, attempts to use **NCBLIT_PIXEL** will fall back to
|
||||
**NCBLIT_3x2** (or fail, if **NCVISUAL_OPTION_NODEGRADE** is used).
|
||||
|
||||
Pixel blitting creates a new, immutable, purpose-specific plane. Attempting
|
||||
to pass a non-**NULL** ***n*** in **ncvisual_options** will result in an error
|
||||
if **NCBLIT_PIXEL** is used.
|
||||
Bitmaps cannot be blitted to the standard plane; an attempt to do so will be
|
||||
rejected as an error. Only one bitmap can be blitted onto a plane at a time
|
||||
(but multiple planes with bitmaps may be visible); blitting a second to the
|
||||
same plane will delete the original. Destroying the plane with which a bitmap
|
||||
is associated will delete the bitmap.
|
||||
|
||||
# RETURN VALUES
|
||||
|
||||
|
@ -483,7 +483,12 @@ ncplane* ncvisual_render_cells(notcurses* nc, ncvisual* ncv, const struct blitse
|
||||
|
||||
ncplane* ncvisual_render_pixels(notcurses* nc, ncvisual* ncv, const struct blitset* bset,
|
||||
int placey, int placex, int begy, int begx,
|
||||
ncplane* n, ncscale_e scaling, ncplane* stdn){
|
||||
ncplane* n, ncscale_e scaling){
|
||||
ncplane* stdn = notcurses_stdplane(nc);
|
||||
if(stdn == n){
|
||||
logerror(nc, "Won't render bitmaps to the standard plane\n");
|
||||
return NULL;
|
||||
}
|
||||
int disprows = 0, dispcols = 0;
|
||||
if(scaling == NCSCALE_NONE || scaling == NCSCALE_NONE_HIRES){
|
||||
dispcols = ncv->cols;
|
||||
@ -584,11 +589,9 @@ ncplane* ncvisual_render(notcurses* nc, ncvisual* ncv, const struct ncvisual_opt
|
||||
ncscale_e scaling = vopts ? vopts->scaling : NCSCALE_NONE;
|
||||
if(bset->geom != NCBLIT_PIXEL){
|
||||
n = ncvisual_render_cells(nc, ncv, bset, placey, placex, begy, begx, leny, lenx,
|
||||
n, scaling,
|
||||
vopts && (vopts->flags & NCVISUAL_OPTION_BLEND));
|
||||
n, scaling, vopts && (vopts->flags & NCVISUAL_OPTION_BLEND));
|
||||
}else{
|
||||
n = ncvisual_render_pixels(nc, ncv, bset, placey, placex, begy, begx,
|
||||
n, scaling, notcurses_stdplane(nc));
|
||||
n = ncvisual_render_pixels(nc, ncv, bset, placey, placex, begy, begx, n, scaling);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user