Fix issue 57: Missing refresh in the cross points for the 4-point splines.
Also fixed the display of the bottom-right corner of the spline itself. Grad rectangle: The vector line is now drawn as XOR: dragging it no longer erases the screen. SFont.c: Only removed TAB characters in source. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@418 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
c55c27bd85
commit
df33261b59
64
SFont.c
64
SFont.c
@ -74,7 +74,7 @@ SFont_Font* SFont_InitFont(SDL_Surface* Surface)
|
|||||||
Uint32 pink;
|
Uint32 pink;
|
||||||
|
|
||||||
if (Surface == NULL)
|
if (Surface == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Font = (SFont_Font *) malloc(sizeof(SFont_Font));
|
Font = (SFont_Font *) malloc(sizeof(SFont_Font));
|
||||||
Font->Surface = Surface;
|
Font->Surface = Surface;
|
||||||
@ -83,13 +83,13 @@ SFont_Font* SFont_InitFont(SDL_Surface* Surface)
|
|||||||
|
|
||||||
pink = SDL_MapRGB(Surface->format, 255, 0, 255);
|
pink = SDL_MapRGB(Surface->format, 255, 0, 255);
|
||||||
while (x < Surface->w) {
|
while (x < Surface->w) {
|
||||||
if (GetPixel(Surface, x, 0) == pink) {
|
if (GetPixel(Surface, x, 0) == pink) {
|
||||||
Font->CharPos[i++]=x;
|
Font->CharPos[i++]=x;
|
||||||
while((x < Surface->w) && (GetPixel(Surface, x, 0)== pink))
|
while((x < Surface->w) && (GetPixel(Surface, x, 0)== pink))
|
||||||
x++;
|
x++;
|
||||||
Font->CharPos[i++]=x;
|
Font->CharPos[i++]=x;
|
||||||
}
|
}
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
Font->MaxPos = x-1;
|
Font->MaxPos = x-1;
|
||||||
|
|
||||||
@ -107,14 +107,14 @@ void SFont_FreeFont(SFont_Font* FontInfo)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font,
|
void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font,
|
||||||
int x, int y, const char *text)
|
int x, int y, const char *text)
|
||||||
{
|
{
|
||||||
const char* c;
|
const char* c;
|
||||||
int charoffset;
|
int charoffset;
|
||||||
SDL_Rect srcrect, dstrect;
|
SDL_Rect srcrect, dstrect;
|
||||||
|
|
||||||
if(text == NULL)
|
if(text == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// these values won't change in the loop
|
// these values won't change in the loop
|
||||||
srcrect.y = 1;
|
srcrect.y = 1;
|
||||||
@ -122,23 +122,23 @@ void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font,
|
|||||||
srcrect.h = dstrect.h = Font->Surface->h - 1;
|
srcrect.h = dstrect.h = Font->Surface->h - 1;
|
||||||
|
|
||||||
for(c = text; *c != '\0' && x <= Surface->w ; c++) {
|
for(c = text; *c != '\0' && x <= Surface->w ; c++) {
|
||||||
charoffset = ((int) (*c - 33)) * 2 + 1;
|
charoffset = ((int) (*c - 33)) * 2 + 1;
|
||||||
// skip spaces and nonprintable characters
|
// skip spaces and nonprintable characters
|
||||||
if (*c == ' ' || charoffset < 0 || charoffset > Font->MaxPos) {
|
if (*c == ' ' || charoffset < 0 || charoffset > Font->MaxPos) {
|
||||||
x += Font->CharPos[2]-Font->CharPos[1];
|
x += Font->CharPos[2]-Font->CharPos[1];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
srcrect.w = dstrect.w =
|
srcrect.w = dstrect.w =
|
||||||
(Font->CharPos[charoffset+2] + Font->CharPos[charoffset+1])/2 -
|
(Font->CharPos[charoffset+2] + Font->CharPos[charoffset+1])/2 -
|
||||||
(Font->CharPos[charoffset] + Font->CharPos[charoffset-1])/2;
|
(Font->CharPos[charoffset] + Font->CharPos[charoffset-1])/2;
|
||||||
srcrect.x = (Font->CharPos[charoffset]+Font->CharPos[charoffset-1])/2;
|
srcrect.x = (Font->CharPos[charoffset]+Font->CharPos[charoffset-1])/2;
|
||||||
dstrect.x = x - (float)(Font->CharPos[charoffset]
|
dstrect.x = x - (float)(Font->CharPos[charoffset]
|
||||||
- Font->CharPos[charoffset-1])/2;
|
- Font->CharPos[charoffset-1])/2;
|
||||||
|
|
||||||
SDL_BlitSurface(Font->Surface, &srcrect, Surface, &dstrect);
|
SDL_BlitSurface(Font->Surface, &srcrect, Surface, &dstrect);
|
||||||
|
|
||||||
x += Font->CharPos[charoffset+1] - Font->CharPos[charoffset];
|
x += Font->CharPos[charoffset+1] - Font->CharPos[charoffset];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -149,17 +149,17 @@ int SFont_TextWidth(const SFont_Font *Font, const char *text)
|
|||||||
int width = 0;
|
int width = 0;
|
||||||
|
|
||||||
if(text == NULL)
|
if(text == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for(c = text; *c != '\0'; c++) {
|
for(c = text; *c != '\0'; c++) {
|
||||||
charoffset = ((int) *c - 33) * 2 + 1;
|
charoffset = ((int) *c - 33) * 2 + 1;
|
||||||
// skip spaces and nonprintable characters
|
// skip spaces and nonprintable characters
|
||||||
if (*c == ' ' || charoffset < 0 || charoffset > Font->MaxPos) {
|
if (*c == ' ' || charoffset < 0 || charoffset > Font->MaxPos) {
|
||||||
width += Font->CharPos[2]-Font->CharPos[1];
|
width += Font->CharPos[2]-Font->CharPos[1];
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
width += Font->CharPos[charoffset+1] - Font->CharPos[charoffset];
|
width += Font->CharPos[charoffset+1] - Font->CharPos[charoffset];
|
||||||
}
|
}
|
||||||
|
|
||||||
return width;
|
return width;
|
||||||
@ -171,9 +171,9 @@ int SFont_TextHeight(const SFont_Font* Font)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font *Font,
|
void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font *Font,
|
||||||
int y, const char *text)
|
int y, const char *text)
|
||||||
{
|
{
|
||||||
SFont_Write(Surface, Font, Surface->w/2 - SFont_TextWidth(Font, text)/2,
|
SFont_Write(Surface, Font, Surface->w/2 - SFont_TextWidth(Font, text)/2,
|
||||||
y, text);
|
y, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
2
graph.c
2
graph.c
@ -1427,7 +1427,7 @@ void Tracer_courbe_General(short X1, short Y1,
|
|||||||
Y = Min(Min(Y1,Y2),Min(Y3,Y4));
|
Y = Min(Min(Y1,Y2),Min(Y3,Y4));
|
||||||
Old_X = Max(Max(X1,X2),Max(X3,X4)) - X;
|
Old_X = Max(Max(X1,X2),Max(X3,X4)) - X;
|
||||||
Old_Y = Max(Max(Y1,Y2),Max(Y3,Y4)) - Y;
|
Old_Y = Max(Max(Y1,Y2),Max(Y3,Y4)) - Y;
|
||||||
Mettre_Ecran_A_Jour(X,Y,Old_X,Old_Y);
|
Mettre_Ecran_A_Jour(X,Y,Old_X+1,Old_Y+1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- Tracer une courbe de Bézier définitivement --
|
// -- Tracer une courbe de Bézier définitivement --
|
||||||
|
|||||||
35
operatio.c
35
operatio.c
@ -1534,17 +1534,21 @@ void Courbe_Tracer_croix(short Pos_X, short Pos_Y)
|
|||||||
else
|
else
|
||||||
Fin_Y=3+(Limite_visible_Bas-Pos_Y);
|
Fin_Y=3+(Limite_visible_Bas-Pos_Y);
|
||||||
|
|
||||||
for (i=Debut_X; i<=Fin_X; i++)
|
if (Debut_X<=Fin_X && Debut_Y<=Fin_Y)
|
||||||
{
|
{
|
||||||
Temp=Pos_X+i-3;
|
for (i=Debut_X; i<=Fin_X; i++)
|
||||||
Pixel_Preview(Temp,Pos_Y,~Lit_pixel(Temp -Principal_Decalage_X,
|
{
|
||||||
Pos_Y-Principal_Decalage_Y));
|
Temp=Pos_X+i-3;
|
||||||
}
|
Pixel_Preview(Temp,Pos_Y,~Lit_pixel(Temp -Principal_Decalage_X,
|
||||||
for (i=Debut_Y; i<=Fin_Y; i++)
|
Pos_Y-Principal_Decalage_Y));
|
||||||
{
|
}
|
||||||
Temp=Pos_Y+i-3;
|
for (i=Debut_Y; i<=Fin_Y; i++)
|
||||||
Pixel_Preview(Pos_X,Temp,~Lit_pixel(Pos_X-Principal_Decalage_X,
|
{
|
||||||
Temp -Principal_Decalage_Y));
|
Temp=Pos_Y+i-3;
|
||||||
|
Pixel_Preview(Pos_X,Temp,~Lit_pixel(Pos_X-Principal_Decalage_X,
|
||||||
|
Temp -Principal_Decalage_Y));
|
||||||
|
}
|
||||||
|
Mettre_Ecran_A_Jour(Pos_X+Debut_X-3,Pos_Y+Debut_Y-3,Fin_X-Debut_X+1,Fin_Y-Debut_Y+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4391,15 +4395,8 @@ void Rectangle_Degrade_12_9(void)
|
|||||||
|
|
||||||
Aff_coords_rel_ou_abs(Debut_X,Debut_Y);
|
Aff_coords_rel_ou_abs(Debut_X,Debut_Y);
|
||||||
|
|
||||||
Effacer_ligne_Preview(Debut_X,Debut_Y,Fin_X,Fin_Y);
|
Tracer_ligne_Preview_xor(Debut_X,Debut_Y,Fin_X,Fin_Y,0);
|
||||||
if (Mouse_K==A_GAUCHE)
|
Tracer_ligne_Preview_xor(Debut_X,Debut_Y,Pinceau_X,Pinceau_Y,0);
|
||||||
{
|
|
||||||
Tracer_ligne_Preview (Debut_X,Debut_Y,Pinceau_X,Pinceau_Y,Fore_color);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Tracer_ligne_Preview (Debut_X,Debut_Y,Pinceau_X,Pinceau_Y,Back_color);
|
|
||||||
}
|
|
||||||
|
|
||||||
Operation_PUSH(Debut_X);
|
Operation_PUSH(Debut_X);
|
||||||
Operation_PUSH(Debut_Y);
|
Operation_PUSH(Debut_Y);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user