Skip to content

Commit 946c639

Browse files
committed
UI: make image save and load compatible.
1 parent cd14f44 commit 946c639

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

src/lib/lodepng

src/platform/android/app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ android {
99
applicationId 'net.sourceforge.smallbasic'
1010
minSdkVersion 16
1111
targetSdkVersion 30
12-
versionCode 47
12+
versionCode 49
1313
versionName "12.22"
1414
resConfigs "en"
1515
}

src/ui/image.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,8 +253,8 @@ ImageBuffer *load_image(var_t *var) {
253253
result = get_image((unsigned)bid);
254254
}
255255
} else if (var->type == V_ARRAY && v_maxdim(var) == 2) {
256-
int w = ABS(v_lbound(var, 0) - v_ubound(var, 0)) + 1;
257-
int h = ABS(v_lbound(var, 1) - v_ubound(var, 1)) + 1;
256+
int h = ABS(v_ubound(var, 0) - v_lbound(var, 0)) + 1;
257+
int w = ABS(v_ubound(var, 1) - v_lbound(var, 1)) + 1;
258258
int size = w * h * 4;
259259
auto image = (unsigned char *)malloc(size);
260260
for (int y = 0; y < h; y++) {
@@ -477,7 +477,7 @@ void cmd_image_save(var_s *self, var_s *) {
477477
saved = true;
478478
}
479479
} else if (array != nullptr) {
480-
v_tomatrix(array, w, h);
480+
v_tomatrix(array, h, w);
481481
// x0 x1 x2 (w=3,h=2)
482482
// y0 rgba rgba rgba ypos=0
483483
// y1 rgba rgba rgba ypos=12

0 commit comments

Comments
 (0)