mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-04 06:00:30 +00:00
ncpixel_set_g/ncpixel_set_b: correct #1080
This commit is contained in:
parent
0f5f4cd1c3
commit
e12cfe947b
@ -2457,7 +2457,7 @@ ncpixel_set_g(uint32_t* pixel, int g){
|
||||
if(g > 255 || g < 0){
|
||||
return -1;
|
||||
}
|
||||
*pixel = (*pixel & 0xff00fffful) | (g << 16u);
|
||||
*pixel = (*pixel & 0xffff00fful) | (g << 8u);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2467,7 +2467,7 @@ ncpixel_set_b(uint32_t* pixel, int b){
|
||||
if(b > 255 || b < 0){
|
||||
return -1;
|
||||
}
|
||||
*pixel = (*pixel & 0xffff00fful) | (b << 8u);
|
||||
*pixel = (*pixel & 0xff00fffful) | (b << 16u);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -279,13 +279,13 @@ TEST_CASE("Visual") {
|
||||
for(int i = 0 ; i < DIMY * DIMX ; ++i){
|
||||
CHECK(0 == ncpixel_set_a(&rgba[i], 0xff));
|
||||
if(i % 2){
|
||||
CHECK(0 == ncpixel_set_g(&rgba[i], 0xff));
|
||||
CHECK(0 == ncpixel_set_b(&rgba[i], 0xff));
|
||||
CHECK(0 == ncpixel_set_r(&rgba[i], 0));
|
||||
}else{
|
||||
CHECK(0 == ncpixel_set_r(&rgba[i], 0xff));
|
||||
CHECK(0 == ncpixel_set_g(&rgba[i], 0));
|
||||
CHECK(0 == ncpixel_set_b(&rgba[i], 0));
|
||||
}
|
||||
CHECK(0 == ncpixel_set_b(&rgba[i], 0));
|
||||
CHECK(0 == ncpixel_set_g(&rgba[i], 0));
|
||||
}
|
||||
auto ncv = ncvisual_from_rgba(rgba, DIMY, DIMX * sizeof(uint32_t), DIMX);
|
||||
REQUIRE(nullptr != ncv);
|
||||
@ -319,11 +319,11 @@ TEST_CASE("Visual") {
|
||||
for(int i = 0 ; i < DIMY * DIMX ; ++i){
|
||||
CHECK(0 == ncpixel_set_a(&rgba[i], 0xff));
|
||||
if(i % 2){
|
||||
CHECK(0 == ncpixel_set_g(&rgba[i], 0xff));
|
||||
CHECK(0 == ncpixel_set_b(&rgba[i], 0));
|
||||
}else{
|
||||
CHECK(0 == ncpixel_set_b(&rgba[i], 0xff));
|
||||
CHECK(0 == ncpixel_set_g(&rgba[i], 0));
|
||||
}else{
|
||||
CHECK(0 == ncpixel_set_g(&rgba[i], 0xff));
|
||||
CHECK(0 == ncpixel_set_b(&rgba[i], 0));
|
||||
}
|
||||
CHECK(0 == ncpixel_set_r(&rgba[i], 0));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user