Skip to content

Commit 79a8106

Browse files
committed
UI: Fix RGB handling with IMAGE
1 parent b54aac3 commit 79a8106

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/ui/image.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,13 +461,13 @@ void cmd_image_save(var_s *self, var_s *) {
461461
// y0 rgba rgba rgba ypos=0
462462
// y1 rgba rgba rgba ypos=12
463463
//
464-
for (int y = 0; y < h; y++) {
465-
int yoffs = (4 * y * w);
466-
for (int x = 0; x < w; x++) {
464+
for (unsigned y = 0; y < h; y++) {
465+
unsigned yoffs = (4 * y * w);
466+
for (unsigned x = 0; x < w; x++) {
467467
uint8_t a, r, g, b;
468468
GET_IMAGE_ARGB(image->_image, yoffs + (x * 4), a, r, g, b);
469469
pixel_t px = GET_ARGB_PX(a, r, g, b);
470-
int pos = y * w + x;
470+
unsigned pos = y * w + x;
471471
var_t *elem = v_elem(array, pos);
472472
v_setint(elem, -px);
473473
}

src/ui/utils.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
#define UTILS_H
1111

1212
#ifndef MAX
13-
#define MAX(a,b) ((a<b) ? (b) : (a))
13+
#define MAX(a,b) (((int)a<(int)b) ? (b) : (a))
1414
#endif
1515
#ifndef MIN
16-
#define MIN(a,b) ((a>b) ? (b) : (a))
16+
#define MIN(a,b) (((int)a>(int)b) ? (b) : (a))
1717
#endif
1818

1919
#define DEFAULT_FOREGROUND 0xa1a1a1

0 commit comments

Comments
 (0)