fixed dithering + surface conversion
This commit is contained in:
parent
510ba33aff
commit
2759b98161
@ -13,7 +13,7 @@
|
|||||||
File: ZE_ZImage.cpp <br>
|
File: ZE_ZImage.cpp <br>
|
||||||
Description: Implementation source file for core ZEngine Image or Texture Object. <br>
|
Description: Implementation source file for core ZEngine Image or Texture Object. <br>
|
||||||
Author(s): James Turk, Gamer Tazar <br>
|
Author(s): James Turk, Gamer Tazar <br>
|
||||||
$Id: ZE_ZImage.cpp,v 1.19 2003/01/24 06:30:42 cozman Exp $<br>
|
$Id: ZE_ZImage.cpp,v 1.20 2003/01/24 10:27:42 cozman Exp $<br>
|
||||||
|
|
||||||
\file ZE_ZImage.cpp
|
\file ZE_ZImage.cpp
|
||||||
\brief Source file for ZImage.
|
\brief Source file for ZImage.
|
||||||
@ -103,6 +103,19 @@ void ZImage::Attach(SDL_Surface *surface)
|
|||||||
|
|
||||||
Release(); //avoid most user inflicted memory leaks
|
Release(); //avoid most user inflicted memory leaks
|
||||||
|
|
||||||
|
//surface conversion//
|
||||||
|
SDL_Surface *temp = surface;
|
||||||
|
surface = SDL_DisplayFormatAlpha(temp);
|
||||||
|
if(surface)
|
||||||
|
{
|
||||||
|
FreeImage(temp);
|
||||||
|
}
|
||||||
|
else //can't convert
|
||||||
|
{
|
||||||
|
rEngine->ReportError(ZERR_SDL_INTERNAL,FormatStr("SDL_DisplayFormatAlpha failed in ZImage::Attach: %s",SDL_GetError()));
|
||||||
|
surface = temp;
|
||||||
|
}
|
||||||
|
|
||||||
if(surface)
|
if(surface)
|
||||||
{
|
{
|
||||||
rWidth = surface->w;
|
rWidth = surface->w;
|
||||||
@ -145,25 +158,13 @@ void ZImage::SetColorKey(Uint8 red, Uint8 green, Uint8 blue)
|
|||||||
rEngine->ReportError(ZERR_SDL_INTERNAL,FormatStr("SDL_SetColorKey failed in ZImage::SetColorKey: %s",SDL_GetError()));
|
rEngine->ReportError(ZERR_SDL_INTERNAL,FormatStr("SDL_SetColorKey failed in ZImage::SetColorKey: %s",SDL_GetError()));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//surface conversion//
|
|
||||||
temp = rImage;
|
temp = rImage;
|
||||||
rImage = SDL_DisplayFormat(temp);
|
rImage = NULL;
|
||||||
if(rImage)
|
Attach(temp); //do the reattach
|
||||||
{
|
|
||||||
FreeImage(temp);
|
|
||||||
temp = rImage;
|
|
||||||
rImage = NULL;
|
|
||||||
Attach(temp); //Rebind new image.
|
|
||||||
}
|
|
||||||
else //can't convert
|
|
||||||
{
|
|
||||||
rEngine->ReportError(ZERR_SDL_INTERNAL,FormatStr("SDL_DisplayFormatAlpha failed in ZImage::SetColorKey: %s",SDL_GetError()));
|
|
||||||
rImage = temp;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
rEngine->ReportError(ZERR_NOIMAGE,"SetColorKey.");
|
rEngine->ReportError(ZERR_NOIMAGE,"SetColorKey");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ZImage::Flip(bool horizontal, bool vertical)
|
void ZImage::Flip(bool horizontal, bool vertical)
|
||||||
@ -206,7 +207,6 @@ void ZImage::Bind() const
|
|||||||
void ZImage::Draw(float x, float y) const
|
void ZImage::Draw(float x, float y) const
|
||||||
{
|
{
|
||||||
Bind();
|
Bind();
|
||||||
|
|
||||||
glBegin(GL_TRIANGLE_STRIP);
|
glBegin(GL_TRIANGLE_STRIP);
|
||||||
glTexCoord2f(rTexMinX,rTexMinY); glVertex2f(x,y);
|
glTexCoord2f(rTexMinX,rTexMinY); glVertex2f(x,y);
|
||||||
glTexCoord2f(rTexMaxX,rTexMinY); glVertex2f(x+rWidth,y);
|
glTexCoord2f(rTexMaxX,rTexMinY); glVertex2f(x+rWidth,y);
|
||||||
|
Loading…
Reference in New Issue
Block a user