From cf385975573b576c1ca86e5369801ef505280b29 Mon Sep 17 00:00:00 2001 From: James Turk Date: Mon, 1 Sep 2003 06:01:06 +0000 Subject: [PATCH] ZE_SDL fix --- src/ZE_ZImage.cpp | 16 +++++++++++----- test/ZImageTest.cpp | 4 +++- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/ZE_ZImage.cpp b/src/ZE_ZImage.cpp index 42a5816..c186766 100644 --- a/src/ZE_ZImage.cpp +++ b/src/ZE_ZImage.cpp @@ -13,7 +13,7 @@ \brief Source file for ZImage. Implementation of ZImage, the Image class for ZEngine. -
$Id: ZE_ZImage.cpp,v 1.43 2003/09/01 03:30:39 cozman Exp $
+
$Id: ZE_ZImage.cpp,v 1.44 2003/09/01 06:01:34 cozman Exp $
\author James Turk **/ @@ -407,10 +407,16 @@ void ZImage::Draw(int x, int y) const void ZImage::DrawClipped(int x, int y, ZRect clipRect) const { - SDL_Rect rect; - rect.x = static_cast(x); - rect.y = static_cast(y); - SDL_BlitSurface(rImage, &clipRect.SDLrect(), rEngine->Display(), &rect); + ZRect img(static_cast(x),static_cast(y),static_cast(rImage->w),static_cast(rImage->h)); + SDL_Rect inRect,imgRect; + + + imgRect = inRect = clipRect.Intersection(img).SDLrect(); + inRect.x -= x; + inRect.y -= y; + + SDL_BlitSurface(rImage, &inRect, rEngine->Display(), &imgRect); + //SDL_FillRect(rEngine->Display(), &inRect, SDL_MapRGB(rEngine->Display()->format,0,255,0)); } bool ZImage::IsLoaded() const diff --git a/test/ZImageTest.cpp b/test/ZImageTest.cpp index 992b097..bf03774 100644 --- a/test/ZImageTest.cpp +++ b/test/ZImageTest.cpp @@ -9,7 +9,7 @@ This example file is in the public domain, it may be used with no restrictions. and the home of this Library is http://www.zengine.sourceforge.net *******************************************************************************/ -/*$Id: ZImageTest.cpp,v 1.21 2003/09/01 03:30:39 cozman Exp $*/ +/*$Id: ZImageTest.cpp,v 1.22 2003/09/01 06:01:06 cozman Exp $*/ #include #include @@ -59,7 +59,9 @@ void Test() temp = NULL; //and temp will now be controlled and freed by image1 image1.SetColorKey(255,0,255); image2.SetColorKey(255,0,255); +#if (GFX_BACKEND == ZE_OGL) image4.Resize(400,300); +#endif font.DrawShadedText("ZImage Test.",textImage); do