Fractals: Use constants for screen panning
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24258 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
51cb7eb5f2
commit
55240a2e85
3 changed files with 10 additions and 4 deletions
|
@ -23,9 +23,6 @@
|
|||
|
||||
#include "fractal_sets.h"
|
||||
|
||||
#define LCD_SHIFT_X (LCD_WIDTH / 8)
|
||||
#define LCD_SHIFT_Y (LCD_HEIGHT / 8)
|
||||
|
||||
void rects_queue_init(void);
|
||||
void rects_calc_all(int (*calc)(struct fractal_rect *, int (*)(void *), void *),
|
||||
int (*button_yield_cb)(void *), void *ctx);
|
||||
|
|
|
@ -24,6 +24,14 @@
|
|||
#include "lib/grey.h"
|
||||
#include "lib/xlcd.h"
|
||||
|
||||
#define DELTA 8 /* Panning moves 1/DELTA of screen */
|
||||
|
||||
#define LCD_SHIFT_X (LCD_WIDTH / DELTA)
|
||||
#define LCD_SHIFT_Y (LCD_HEIGHT / DELTA)
|
||||
|
||||
#define X_DELTA(x) (((x) * LCD_WIDTH) / DELTA)
|
||||
#define Y_DELTA(y) (((y) * LCD_HEIGHT) / DELTA)
|
||||
|
||||
struct fractal_rect
|
||||
{
|
||||
int px_min;
|
||||
|
|
|
@ -139,8 +139,9 @@ static int ilog2_fp(long value) /* calculate integer log2(value_fp_6.26) */
|
|||
static void recalc_parameters(void)
|
||||
{
|
||||
ctx.x_step = (ctx.x_max - ctx.x_min) / LCD_WIDTH;
|
||||
ctx.x_delta = (ctx.x_step * LCD_WIDTH) / 8;
|
||||
ctx.x_delta = X_DELTA(ctx.x_step);
|
||||
ctx.y_step = (ctx.y_max - ctx.y_min) / LCD_HEIGHT;
|
||||
ctx.y_delta = Y_DELTA(ctx.y_step);
|
||||
ctx.y_delta = (ctx.y_step * LCD_HEIGHT) / 8;
|
||||
ctx.step_log2 = ilog2_fp(MIN(ctx.x_step, ctx.y_step));
|
||||
ctx.max_iter = MAX(15, -15 * ctx.step_log2 - 45);
|
||||
|
|
Loading…
Reference in a new issue