summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Woelders <kim@woelders.dk>2021-04-11 20:12:13 +0200
committerKim Woelders <kim@woelders.dk>2021-04-16 17:15:06 +0200
commit652d30e8fe9137fa82ddd392d8d1c7746dd43e2f (patch)
tree94b283657c550964ce7aa3c4eab9fe99696186a7
parent4fa2ad8566b3203f857224d4106d4aa0acd2d9ff (diff)
Fix clang-analyzer warnings - bin (trivial)
-rw-r--r--src/bin/imlib2_show.c1
-rw-r--r--src/bin/imlib2_view.c73
2 files changed, 33 insertions, 41 deletions
diff --git a/src/bin/imlib2_show.c b/src/bin/imlib2_show.c
index 0a9003e..4c242a5 100644
--- a/src/bin/imlib2_show.c
+++ b/src/bin/imlib2_show.c
@@ -925,7 +925,6 @@ main(int argc, char **argv)
925 XSync(disp, False); 925 XSync(disp, False);
926 im = imlib_create_image(w, h); 926 im = imlib_create_image(w, h);
927 imlib_set_cache_size(4 * 1024 * 1024); 927 imlib_set_cache_size(4 * 1024 * 1024);
928 i = 0;
929 up = imlib_update_append_rect(up, 0, 0, w, h); 928 up = imlib_update_append_rect(up, 0, 0, w, h);
930 x = -9999; 929 x = -9999;
931 y = -9999; 930 y = -9999;
diff --git a/src/bin/imlib2_view.c b/src/bin/imlib2_view.c
index d8d2299..685efde 100644
--- a/src/bin/imlib2_view.c
+++ b/src/bin/imlib2_view.c
@@ -287,8 +287,6 @@ main(int argc, char **argv)
287 break; 287 break;
288 case ButtonRelease: 288 case ButtonRelease:
289 b = ev.xbutton.button; 289 b = ev.xbutton.button;
290 x = ev.xbutton.x;
291 y = ev.xbutton.y;
292 if (b == 3) 290 if (b == 3)
293 zoom_mode = 0; 291 zoom_mode = 0;
294 if (b == 1) 292 if (b == 1)
@@ -300,7 +298,6 @@ main(int argc, char **argv)
300 while (XCheckTypedWindowEvent(disp, win, MotionNotify, &ev)) 298 while (XCheckTypedWindowEvent(disp, win, MotionNotify, &ev))
301 ; 299 ;
302 x = ev.xmotion.x; 300 x = ev.xmotion.x;
303 y = ev.xmotion.y;
304 if (zoom_mode) 301 if (zoom_mode)
305 { 302 {
306 int sx, sy, sw, sh, dx, dy, dw, dh; 303 int sx, sy, sw, sh, dx, dy, dw, dh;
@@ -410,46 +407,42 @@ main(int argc, char **argv)
410 if ((errno == ENOMEM) || (errno == EINVAL) || (errno == EBADF)) 407 if ((errno == ENOMEM) || (errno == EINVAL) || (errno == EBADF))
411 exit(1); 408 exit(1);
412 } 409 }
413 else 410 else if (count == 0)
414 { 411 {
415 if ((count == 0) && (timeout)) 412 int sx, sy, sw, sh, dx, dy, dw, dh;
416 {
417 int sx, sy, sw, sh, dx, dy, dw, dh;
418
419 if (zoom > 1.0)
420 {
421 dx = 0;
422 dy = 0;
423 dw = window_width;
424 dh = window_height;
425 413
426 sx = zx - (zx / zoom); 414 if (zoom > 1.0)
427 sy = zy - (zy / zoom); 415 {
428 sw = image_width / zoom; 416 dx = 0;
429 sh = image_height / zoom; 417 dy = 0;
430 } 418 dw = window_width;
431 else 419 dh = window_height;
432 { 420
433 dx = zx - (zx * zoom); 421 sx = zx - (zx / zoom);
434 dy = zy - (zy * zoom); 422 sy = zy - (zy / zoom);
435 dw = window_width * zoom; 423 sw = image_width / zoom;
436 dh = window_height * zoom; 424 sh = image_height / zoom;
437 425 }
438 sx = 0; 426 else
439 sy = 0; 427 {
440 sw = image_width; 428 dx = zx - (zx * zoom);
441 sh = image_height; 429 dy = zy - (zy * zoom);
442 } 430 dw = window_width * zoom;
443 imlib_context_set_anti_alias(1); 431 dh = window_height * zoom;
444 imlib_context_set_dither(1); 432
445 imlib_context_set_blend(0); 433 sx = 0;
446 imlib_context_set_image(bg_im); 434 sy = 0;
447 imlib_render_image_part_on_drawable_at_size 435 sw = image_width;
448 (sx, sy, sw, sh, dx, dy, dw, dh); 436 sh = image_height;
449 XClearWindow(disp, win);
450 XFlush(disp);
451 timeout = 0;
452 } 437 }
438 imlib_context_set_anti_alias(1);
439 imlib_context_set_dither(1);
440 imlib_context_set_blend(0);
441 imlib_context_set_image(bg_im);
442 imlib_render_image_part_on_drawable_at_size
443 (sx, sy, sw, sh, dx, dy, dw, dh);
444 XClearWindow(disp, win);
445 XFlush(disp);
453 } 446 }
454 } 447 }
455 448