RGBA/BRGA unit tests: don't do any scaling #1714

pull/1730/head
Nick Black 3 years ago
parent 97bfd726e4
commit b686661873

@ -596,10 +596,9 @@ ncvisual* ncvisual_from_rgba(const void* rgba, int rows, int rowstride, int cols
return NULL;
}
for(int y = 0 ; y < rows ; ++y){
memcpy(data + (ncv->rowstride * y) / 4, rgba + rowstride * y, rowstride);
memcpy(data + (ncv->rowstride * y) / 4, (const char*)rgba + rowstride * y, rowstride);
//fprintf(stderr, "ROWS: %d STRIDE: %d (%d) COLS: %d %08x\n", ncv->pixy, ncv->rowstride, ncv->rowstride / 4, cols, data[ncv->rowstride * y / 4]);
}
//fprintf(stderr, "COPY US %d (%d)\n", rowstride * ncv->pixy, ncv->pixy);
//fprintf(stderr, "ROWS: %d STRIDE: %d (%d) COLS: %d\n", rows, rowstride, rowstride / 4, cols);
ncvisual_set_data(ncv, data, true);
ncvisual_details_seed(ncv);
}
@ -629,7 +628,7 @@ ncvisual* ncvisual_from_bgra(const void* bgra, int rows, int rowstride, int cols
ncpixel_set_r(dst, ncpixel_b(src));
ncpixel_set_g(dst, ncpixel_g(src));
ncpixel_set_b(dst, ncpixel_r(src));
fprintf(stderr, "BGRA PIXEL: %02x%02x%02x%02x RGBA result: %02x%02x%02x%02x\n", ((const char*)&src)[0], ((const char*)&src)[1], ((const char*)&src)[2], ((const char*)&src)[3], ((const char*)dst)[0], ((const char*)dst)[1], ((const char*)dst)[2], ((const char*)dst)[3]);
//fprintf(stderr, "BGRA PIXEL: %02x%02x%02x%02x RGBA result: %02x%02x%02x%02x\n", ((const char*)&src)[0], ((const char*)&src)[1], ((const char*)&src)[2], ((const char*)&src)[3], ((const char*)dst)[0], ((const char*)dst)[1], ((const char*)dst)[2], ((const char*)dst)[3]);
}
}
ncvisual_set_data(ncv, data, true);

@ -171,17 +171,16 @@ TEST_CASE("Visual") {
int dimy, dimx;
ncplane_dim_yx(ncp_, &dimy, &dimx);
// alpha, then b, g, r
std::vector<uint32_t> rgba(dimx * dimy * 2, htole(0xff88bbcc));
std::vector<uint32_t> rgba(dimx * dimy * 2, htole(0xff88bbccull));
auto ncv = ncvisual_from_rgba(rgba.data(), dimy * 2, dimx * 4, dimx);
REQUIRE(ncv);
struct ncvisual_options opts{};
opts.blitter = NCBLIT_1x1;
opts.scaling = NCSCALE_STRETCH;
opts.n = ncp_;
CHECK(ncp_ == ncvisual_render(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
for(int y = 0 ; y < ncplane_dim_y(ncp_) ; ++y){
for(int x = 0 ; x < ncplane_dim_x(ncp_) ; ++x){
for(int y = 0 ; y < dimy ; ++y){
for(int x = 0 ; x < dimx ; ++x){
uint16_t stylemask;
uint64_t channels;
auto c = ncplane_at_yx(ncp_, y, x, &stylemask, &channels);
@ -205,12 +204,11 @@ TEST_CASE("Visual") {
REQUIRE(ncv);
struct ncvisual_options opts{};
opts.blitter = NCBLIT_1x1;
opts.scaling = NCSCALE_STRETCH;
opts.n = ncp_;
CHECK(nullptr != ncvisual_render(nc_, ncv, &opts));
CHECK(0 == notcurses_render(nc_));
for(int y = 0 ; y < ncplane_dim_y(ncp_) ; ++y){
for(int x = 0 ; x < ncplane_dim_x(ncp_) ; ++x){
for(int y = 0 ; y < dimy ; ++y){
for(int x = 0 ; x < dimx ; ++x){
uint16_t stylemask;
uint64_t channels;
auto c = ncplane_at_yx(ncp_, y, x, &stylemask, &channels);

Loading…
Cancel
Save