mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-18 03:25:55 +00:00
ncvisual_from_plane: argument inversion error #678
This commit is contained in:
parent
5a1b1146d3
commit
d73c12be6f
@ -1957,9 +1957,11 @@ uint32_t* ncplane_rgba(const ncplane* nc, int begy, int begx, int leny, int lenx
|
||||
if(lenx < 0 || leny < 0){ // no need to draw zero-size object, exit
|
||||
return NULL;
|
||||
}
|
||||
//fprintf(stderr, "sum: %d/%d avail: %d/%d\n", begy + leny, begx + lenx, nc->leny, nc->lenx);
|
||||
if(begx + lenx > nc->lenx || begy + leny > nc->leny){
|
||||
return NULL;
|
||||
}
|
||||
//fprintf(stderr, "ALLOCATING %zu\n", 4u * lenx * leny * 2);
|
||||
uint32_t* ret = malloc(sizeof(*ret) * lenx * leny * 2);
|
||||
if(ret){
|
||||
for(int y = begy, targy = 0 ; y < begy + leny ; ++y, targy += 2){
|
||||
|
@ -475,7 +475,8 @@ auto ncvisual_render(notcurses* nc, ncvisual* ncv,
|
||||
|
||||
auto ncvisual_from_plane(const ncplane* n, int begy, int begx,
|
||||
int leny, int lenx) -> ncvisual* {
|
||||
uint32_t* rgba = ncplane_rgba(n, begx, begy, leny, lenx);
|
||||
uint32_t* rgba = ncplane_rgba(n, begy, begx, leny, lenx);
|
||||
//fprintf(stderr, "snarg: %d/%d @ %d/%d (%p)\n", leny, lenx, begy, begx, rgba);
|
||||
if(rgba == nullptr){
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
#include "main.h"
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
void RotateCW(struct notcurses* nc, struct ncplane* n) {
|
||||
CHECK(0 == notcurses_render(nc));
|
||||
@ -124,7 +123,7 @@ TEST_CASE("Rotate") {
|
||||
REQUIRE(rgbaret);
|
||||
for(int i = 0 ; i < height * width / 2 ; ++i){
|
||||
if(rgbaret[i] & CELL_BG_MASK){
|
||||
CHECK(rgbaret[i] == htonl(rgba[i]));
|
||||
CHECK(rgbaret[i] == rgba[i]);
|
||||
}
|
||||
}
|
||||
free(rgbaret);
|
||||
@ -175,7 +174,7 @@ TEST_CASE("Rotate") {
|
||||
REQUIRE(rgbaret);
|
||||
for(int i = 0 ; i < height * width / 2 ; ++i){
|
||||
if(rgbaret[i] & CELL_BG_MASK){
|
||||
CHECK(rgbaret[i] == htonl(rgba[i]));
|
||||
CHECK(rgbaret[i] == rgba[i]);
|
||||
}
|
||||
}
|
||||
free(rgbaret);
|
||||
|
Loading…
Reference in New Issue
Block a user