Fixed bad display and possible crash, when the zoomed area showed more than 512 pixels (requires resolution >1600)

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@824 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-06-01 18:47:08 +00:00
parent 0826798943
commit 33bb5622c0
13 changed files with 16 additions and 45 deletions

View File

@ -726,13 +726,6 @@ GFX2_GLOBAL byte Mask_table[256];
// -- Magnifier data
/// Pointer to ::Magnify_table[n] : table of multipliers used by the Magnifier.
// FIXME: This only caches a multiplication. Maybe we should scrap it
GFX2_GLOBAL word * Zoom_factor_table;
/// Precomputed tables of multipliers used by the Magnifier.
// FIXME: This only caches a multiplication. Maybe we should scrap it
GFX2_GLOBAL word Magnify_table[NB_ZOOM_FACTORS][512];
#ifdef GLOBAL_VARIABLES
word ZOOM_FACTOR[NB_ZOOM_FACTORS]={2,3,4,5,6,8,10,12,14,16,18,20};
#else

18
init.c
View File

@ -2168,24 +2168,6 @@ Erreur_sauvegarde_config:
return ERROR_SAVING_CFG;
}
void Init_multiplication_tables(void)
{
word factor_index;
word zoom_factor;
word mult_index;
for (factor_index=0;factor_index<NB_ZOOM_FACTORS;factor_index++)
{
zoom_factor=ZOOM_FACTOR[factor_index];
for (mult_index=0;mult_index<512;mult_index++)
{
Magnify_table[factor_index][mult_index]=zoom_factor*mult_index;
}
}
}
// (Ré)assigne toutes les valeurs de configuration par défaut
void Set_config_defaults(void)
{

1
init.h
View File

@ -27,7 +27,6 @@ void Init_buttons(void);
void Init_operations(void);
int Load_CFG(int reload_all);
int Save_CFG(void);
void Init_multiplication_tables(void);
void Set_all_video_modes(void);
void Set_config_defaults(void);
void Init_sighandler(void);

2
main.c
View File

@ -464,8 +464,6 @@ int Init_program(int argc,char * argv[])
// On initialise les infos de la loupe:
Main_magnifier_mode=0;
Main_magnifier_factor=DEFAULT_ZOOM_FACTOR;
Init_multiplication_tables();
Zoom_factor_table=Magnify_table[2];
Main_separator_proportion=INITIAL_SEPARATOR_PROPORTION;
Spare_separator_proportion=INITIAL_SEPARATOR_PROPORTION;
// On initialise les infos du mode smear:

View File

@ -106,7 +106,7 @@ void Pixel_preview_magnifier_double (word x,word y,byte color)
{
// On est dedans
int height;
int y_zoom = Zoom_factor_table[y-Main_magnifier_offset_Y];
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
if (Menu_Y - y_zoom < Main_magnifier_factor)
// On ne doit dessiner qu'un morceau du pixel
@ -116,7 +116,7 @@ void Pixel_preview_magnifier_double (word x,word y,byte color)
height = Main_magnifier_factor;
Block_double(
Zoom_factor_table[x-Main_magnifier_offset_X]+Main_X_zoom,
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
y_zoom, Main_magnifier_factor, height, color
);
}

View File

@ -121,7 +121,7 @@ void Pixel_preview_magnifier_quad (word x,word y,byte color)
{
// On est dedans
int height;
int y_zoom = Zoom_factor_table[y-Main_magnifier_offset_Y];
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
if (Menu_Y - y_zoom < Main_magnifier_factor)
// On ne doit dessiner qu'un morceau du pixel
@ -131,7 +131,7 @@ void Pixel_preview_magnifier_quad (word x,word y,byte color)
height = Main_magnifier_factor;
Block_quad(
Zoom_factor_table[x-Main_magnifier_offset_X]+Main_X_zoom,
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
y_zoom, Main_magnifier_factor, height, color
);
}

View File

@ -91,7 +91,7 @@ void Pixel_preview_magnifier_simple (word x,word y,byte color)
{
// On est dedans
int height;
int y_zoom = Zoom_factor_table[y-Main_magnifier_offset_Y];
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
if (Menu_Y - y_zoom < Main_magnifier_factor)
// On ne doit dessiner qu'un morceau du pixel
@ -101,7 +101,7 @@ void Pixel_preview_magnifier_simple (word x,word y,byte color)
height = Main_magnifier_factor;
Block_simple(
Zoom_factor_table[x-Main_magnifier_offset_X]+Main_X_zoom,
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
y_zoom, Main_magnifier_factor, height, color
);
}

View File

@ -98,7 +98,7 @@ void Pixel_preview_magnifier_tall (word x,word y,byte color)
{
// On est dedans
int height;
int y_zoom = Zoom_factor_table[y-Main_magnifier_offset_Y];
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
if (Menu_Y - y_zoom < Main_magnifier_factor)
// On ne doit dessiner qu'un morceau du pixel
@ -108,7 +108,7 @@ void Pixel_preview_magnifier_tall (word x,word y,byte color)
height = Main_magnifier_factor;
Block_tall(
Zoom_factor_table[x-Main_magnifier_offset_X]+Main_X_zoom,
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
y_zoom, Main_magnifier_factor, height, color
);
}

View File

@ -113,7 +113,7 @@ void Pixel_preview_magnifier_tall2 (word x,word y,byte color)
{
// On est dedans
int height;
int y_zoom = Zoom_factor_table[y-Main_magnifier_offset_Y];
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
if (Menu_Y - y_zoom < Main_magnifier_factor)
// On ne doit dessiner qu'un morceau du pixel
@ -123,7 +123,7 @@ void Pixel_preview_magnifier_tall2 (word x,word y,byte color)
height = Main_magnifier_factor;
Block_tall2(
Zoom_factor_table[x-Main_magnifier_offset_X]+Main_X_zoom,
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
y_zoom, Main_magnifier_factor, height, color
);
}

View File

@ -112,7 +112,7 @@ void Pixel_preview_magnifier_triple (word x,word y,byte color)
{
// On est dedans
int height;
int y_zoom = Zoom_factor_table[y-Main_magnifier_offset_Y];
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
if (Menu_Y - y_zoom < Main_magnifier_factor)
// On ne doit dessiner qu'un morceau du pixel
@ -122,7 +122,7 @@ void Pixel_preview_magnifier_triple (word x,word y,byte color)
height = Main_magnifier_factor;
Block_triple(
Zoom_factor_table[x-Main_magnifier_offset_X]+Main_X_zoom,
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
y_zoom, Main_magnifier_factor, height, color
);
}

View File

@ -101,7 +101,7 @@ void Pixel_preview_magnifier_wide (word x,word y,byte color)
{
// On est dedans
int height;
int y_zoom = Zoom_factor_table[y-Main_magnifier_offset_Y];
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
if (Menu_Y - y_zoom < Main_magnifier_factor)
// On ne doit dessiner qu'un morceau du pixel
@ -111,7 +111,7 @@ void Pixel_preview_magnifier_wide (word x,word y,byte color)
height = Main_magnifier_factor;
Block_wide(
Zoom_factor_table[x-Main_magnifier_offset_X]+Main_X_zoom,
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
y_zoom, Main_magnifier_factor, height, color
);
}

View File

@ -109,7 +109,7 @@ void Pixel_preview_magnifier_wide2 (word x,word y,byte color)
{
// On est dedans
int height;
int y_zoom = Zoom_factor_table[y-Main_magnifier_offset_Y];
int y_zoom = Main_magnifier_factor * (y-Main_magnifier_offset_Y);
if (Menu_Y - y_zoom < Main_magnifier_factor)
// On ne doit dessiner qu'un morceau du pixel
@ -119,7 +119,7 @@ void Pixel_preview_magnifier_wide2 (word x,word y,byte color)
height = Main_magnifier_factor;
Block_wide2(
Zoom_factor_table[x-Main_magnifier_offset_X]+Main_X_zoom,
Main_magnifier_factor * (x-Main_magnifier_offset_X) + Main_X_zoom,
y_zoom, Main_magnifier_factor, height, color
);
}

View File

@ -1399,7 +1399,6 @@ void Change_magnifier_factor(byte factor_index)
center_y=Main_magnifier_offset_Y+(Main_magnifier_height>>1);
Main_magnifier_factor=ZOOM_FACTOR[factor_index];
Zoom_factor_table=Magnify_table[factor_index];
Compute_magnifier_data();
if (Main_magnifier_mode)