#ifndef ka_scaler_h
#define ka_scaler_h

#include "inttypes.h"
#include "ka_hardware.h"
#include "colorspace/ka_screen.h"

typedef struct
{
  // windowed scaled plot, must match hdr.ka_scaler
  uint32_t     x_mag;          // x scale factor, (src<<16)/dst
  uint32_t     y_mag;          // y scale factor, (src<<16)/dst
  uint32_t     wdst_x0;        // x offset in pixels
  uint32_t     wdst_y0;        // y offset in pixels
  uint32_t     wdst_width;     // destination width in pixels
  uint32_t     wdst_height;    // destination height in pixels
  uint8_t*     wdst;           // destination top left address
  uint32_t     wdst_bpr;       // destination distance between rows in bytes
  uint8_t*     src;            // source top left address
  uint32_t     src_byte_width; // source width in bytes
  // extra used by system scaler, save/restorearea
  uint32_t     src_pix_width;  // source width in pixels
  uint32_t     src_height;     // source height
  uint32_t     src_bpr;        // source distance between rows in bytes
  // desktop/full screen destination
  uint8_t*     dst;            // destination top left address
  uint32_t     dst_offset;     // offset from screen top left
  uint32_t     dst_byte_width; // destination width in bytes
  uint32_t     dst_pix_width;  // destination width in pixels
  uint32_t     dst_height;     // destination height in pixels
  uint32_t     dst_bpr;        // destination distance between rows in bytes
  ka_col_depth col_depth;      // number of colours
  // work buffers
  uint32_t     wb_size;
  void*        wb_ptr;
  uint32_t     hardware;
} ka_scale_t;

typedef void (*ka_scaler_f)(ka_scale_t*);

#endif
