fixed few bug in BitmapLoad/DrawGeometry

This commit is contained in:
hyzboy 2024-08-06 00:49:50 +08:00
parent b64f4c90e4
commit 72fedd4f3c
2 changed files with 14 additions and 4 deletions

View File

@ -79,7 +79,7 @@ namespace hgl
io::OpenFileInputStream fis(filename);
if(!fis)
return(false);
return(nullptr);
return LoadBitmapFromTGA<T>(&fis);
}

View File

@ -54,9 +54,9 @@ namespace hgl
bool GetPixel(int x,int y,T &color)
{
if(!data)return(false);
if(!bitmap)return(false);
T *p=GetData(x,y);
T *p=bitmap->GetData(x,y);
if(!p)return(false);
@ -78,6 +78,11 @@ namespace hgl
return(true);
}
bool PutPixel(const Vector2i &v)
{
return PutPixel(v.x,v.y);
}
bool DrawHLine(int x,int y,int length)
{
if(!bitmap)return(false);
@ -117,7 +122,7 @@ namespace hgl
if(w<=0||h<=0)return(false);
T *p=bitmap->GetData(x,y);
T *p=bitmap->GetData(l,t);
for(int y=t;y<t+h;y++)
{
@ -339,6 +344,11 @@ namespace hgl
}
}
}
void DrawLine(const Vector2i &start,const Vector2i &end)
{
DrawLine(start.x,start.y,end.x,end.y);
}
void DrawSector(int x0, int y0, uint r, uint stangle, uint endangle)
{