~ruther/CTU-FEE-B0B35APO-Semestral-project

ff37eed7139cfe41ca34aca09f45fd4f9d64c4c7 — František Boháček 3 years ago e2a9760
fix: add missing include guards
M image-viewer/include/image_loader.h => image-viewer/include/image_loader.h +5 -0
@@ 1,3 1,6 @@
#ifndef __IMAGE_LOADER_H__
#define __IMAGE_LOADER_H__

#include "image.h"

image_error_t image_loader_load(image_t *image);


@@ 7,3 10,5 @@ image_error_t image_loader_load_jpeg(image_t *image);
image_error_t image_loader_load_png(image_t *image);

image_error_t image_deduce_type(image_t *image);

#endif // __IMAGE_LOADER_H__

M image-viewer/include/input.h => image-viewer/include/input.h +5 -0
@@ 1,3 1,6 @@
#ifndef __INPUT_H__
#define __INPUT_H__

#include <stdint.h>
#include <stdbool.h>
#include <time.h>


@@ 55,3 58,5 @@ bool commands_register(commands_t *commands, input_type_t type,
bool commands_unregister(commands_t *commands, command_t *command);

short commands_check_input(commands_t *commands);

#endif // __INPUT_H__

M image-viewer/include/logger.h => image-viewer/include/logger.h +3 -3
@@ 1,5 1,5 @@
#ifndef _LOGGER_H
#define _LOGGER_H
#ifndef __LOGGER_H__
#define __LOGGER_H__

#include <stdio.h>



@@ 41,4 41,4 @@ void logger_warn(logger_t *logger, const char *file, const char *function,
void logger_error(logger_t *logger, const char *file, const char *function,
                  int line, const char *const message, ...);

#endif //_LOGGER_H
#endif //__LOGGER_H__

M image-viewer/src/cursor.c => image-viewer/src/cursor.c +5 -16
@@ 1,4 1,5 @@
#include "cursor.h"
#include "direction.h"
#include "display_utils.h"
#include "image.h"



@@ 20,23 21,9 @@ void cursor_center(cursor_t *cursor, image_region_t *region) {
  cursor->y = region->y + region->height / 2;
}

void cursor_move(cursor_t *cursor, image_region_t *region, direction_t direction, uint8_t amount) {
bool cursor_move(cursor_t *cursor, image_region_t *region, direction_t direction, int16_t amount) {
  uint16_t x = cursor->x, y = cursor->y;

  switch (direction) {
  case LEFT:
    x -= amount;
    break;
  case RIGHT:
    x += amount;
    break;
  case UP:
    y -= amount;
    break;
  case DOWN:
    y += amount;
    break;
  }
  direction_move_xy(direction, &x, &y, amount);

  if (x < region->x) {
    x = region->x;


@@ 50,8 37,10 @@ void cursor_move(cursor_t *cursor, image_region_t *region, direction_t direction
    y = region->y + region->height - 1;
  }

  bool moved = cursor->x != x || cursor->y != y;
  cursor->x = x;
  cursor->y = y;
  return moved;
}

void cursor_show(cursor_t *cursor, display_t *display) {

Do not follow this link