[Scummvm-cvs-logs] SF.net SVN: scummvm:[53265] scummvm/trunk/engines/sword25

sev at users.sourceforge.net sev at users.sourceforge.net
Wed Oct 13 01:09:12 CEST 2010


Revision: 53265
          http://scummvm.svn.sourceforge.net/scummvm/?rev=53265&view=rev
Author:   sev
Date:     2010-10-12 23:09:12 +0000 (Tue, 12 Oct 2010)

Log Message:
-----------
SWORD25: Refactored engine to remove BS_Rect class

Modified Paths:
--------------
    scummvm/trunk/engines/sword25/gfx/bitmapresource.h
    scummvm/trunk/engines/sword25/gfx/fontresource.cpp
    scummvm/trunk/engines/sword25/gfx/fontresource.h
    scummvm/trunk/engines/sword25/gfx/graphicengine.h
    scummvm/trunk/engines/sword25/gfx/image/image.h
    scummvm/trunk/engines/sword25/gfx/image/vectorimage.cpp
    scummvm/trunk/engines/sword25/gfx/image/vectorimage.h
    scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp
    scummvm/trunk/engines/sword25/gfx/opengl/glimage.h
    scummvm/trunk/engines/sword25/gfx/opengl/glvectorimageblit.cpp
    scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp
    scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.h
    scummvm/trunk/engines/sword25/gfx/opengl/swimage.cpp
    scummvm/trunk/engines/sword25/gfx/opengl/swimage.h
    scummvm/trunk/engines/sword25/gfx/renderobject.cpp
    scummvm/trunk/engines/sword25/gfx/renderobject.h
    scummvm/trunk/engines/sword25/gfx/renderobjectmanager.cpp
    scummvm/trunk/engines/sword25/gfx/renderobjectmanager.h
    scummvm/trunk/engines/sword25/gfx/text.cpp
    scummvm/trunk/engines/sword25/gfx/text.h
    scummvm/trunk/engines/sword25/math/region.cpp
    scummvm/trunk/engines/sword25/math/region.h

Removed Paths:
-------------
    scummvm/trunk/engines/sword25/math/rect.h

Modified: scummvm/trunk/engines/sword25/gfx/bitmapresource.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/bitmapresource.h	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/bitmapresource.h	2010-10-12 23:09:12 UTC (rev 53265)
@@ -46,7 +46,7 @@
 // Forward Declarations
 // -----------------------------------------------------------------------------
 
-class BS_Rect;
+class Common::Rect;
 
 class BitmapResource : public Resource {
 public:
@@ -100,7 +100,7 @@
 	                Der Standardwert ist 0.
 	    @param Flipping gibt an, wie das Bild gespiegelt werden soll.<br>
 	                    Der Standardwert ist BS_Image::FLIP_NONE (keine Spiegelung)
-	    @param pSrcPartRect Pointer auf ein BS_Rect, welches den Ausschnitt des Quellbildes spezifiziert, der gerendert
+	    @param pSrcPartRect Pointer auf ein Common::Rect, welches den Ausschnitt des Quellbildes spezifiziert, der gerendert
 	                        werden soll oder NULL, falls das gesamte Bild gerendert werden soll.<br>
 	                        Dieser Ausschnitt bezieht sich auf das ungespiegelte und unskalierte Bild.<br>
 	                        Der Standardwert ist NULL.
@@ -130,7 +130,7 @@
 	*/
 	bool Blit(int PosX = 0, int PosY = 0,
 	          int Flipping = FLIP_NONE,
-	          BS_Rect *pSrcPartRect = NULL,
+	          Common::Rect *pSrcPartRect = NULL,
 	          unsigned int Color = BS_ARGB(255, 255, 255, 255),
 	          int Width = -1, int Height = -1) {
 		BS_ASSERT(m_pImage);
@@ -139,7 +139,7 @@
 
 	/**
 	    @brief F\xFCllt einen Rechteckigen Bereich des Bildes mit einer Farbe.
-	    @param pFillRect Pointer auf ein BS_Rect, welches den Ausschnitt des Bildes spezifiziert, der gef\xFCllt
+	    @param pFillRect Pointer auf ein Common::Rect, welches den Ausschnitt des Bildes spezifiziert, der gef\xFCllt
 	                      werden soll oder NULL, falls das gesamte Bild gef\xFCllt werden soll.<br>
 	                      Der Standardwert ist NULL.
 	    @param Color der 32 Bit Farbwert mit dem der Bildbereich gef\xFCllt werden soll.
@@ -150,7 +150,7 @@
 	            BS_RGB und BS_ARGB benutzt werden.
 	    @remark Falls das Rechteck nicht v\xF6llig innerhalb des Bildschirms ist, wird es automatisch zurechtgestutzt.
 	*/
-	bool Fill(const BS_Rect *pFillRect = 0, unsigned int Color = BS_RGB(0, 0, 0)) {
+	bool Fill(const Common::Rect *pFillRect = 0, unsigned int Color = BS_RGB(0, 0, 0)) {
 		BS_ASSERT(m_pImage);
 		return m_pImage->Fill(pFillRect, Color);
 	}

Modified: scummvm/trunk/engines/sword25/gfx/fontresource.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/fontresource.cpp	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/fontresource.cpp	2010-10-12 23:09:12 UTC (rev 53265)
@@ -115,7 +115,7 @@
 	// Alle Character-Tags parsen
 	while (pElement) {
 		int     CharCode;
-		BS_Rect CharRect;
+		Common::Rect CharRect;
 
 		// Aktuelles Character-Tag parsen
 		if (!_ParseCharacterTag(*pElement, CharCode, CharRect)) {
@@ -200,7 +200,7 @@
 
 // -----------------------------------------------------------------------------
 
-bool FontResource::_ParseCharacterTag(TiXmlElement &Tag, int &Code, BS_Rect &Rect) const {
+bool FontResource::_ParseCharacterTag(TiXmlElement &Tag, int &Code, Common::Rect &Rect) const {
 	// Code Attribut auslesen
 	const char *CodeString = Tag.Attribute("code");
 	if (!CodeString || !BS_String::ToInt(Common::String(CodeString), Code) || Code < 0 || Code >= 256) {

Modified: scummvm/trunk/engines/sword25/gfx/fontresource.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/fontresource.h	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/fontresource.h	2010-10-12 23:09:12 UTC (rev 53265)
@@ -41,7 +41,7 @@
 
 #include "sword25/kernel/common.h"
 #include "sword25/kernel/resource.h"
-#include "sword25/math/rect.h"
+#include "common/rect.h"
 
 class TiXmlDocument;
 class TiXmlElement;
@@ -100,7 +100,7 @@
 	    @param Character der ASCII-Code des Zeichens
 	    @return Das Bounding-Rect des \xFCbergebenen Zeichens auf der Charactermap.
 	*/
-	const BS_Rect &GetCharacterRect(int Character) const {
+	const Common::Rect &GetCharacterRect(int Character) const {
 		BS_ASSERT(Character >= 0 && Character < 256);
 		return _CharacterRects[Character];
 	}
@@ -118,7 +118,7 @@
 	Common::String  _BitmapFileName;
 	int         _LineHeight;
 	int         _GapWidth;
-	BS_Rect     _CharacterRects[256];
+	Common::Rect     _CharacterRects[256];
 
 	// -----------------------------------------------------------------------------
 	// Hilfsmethoden
@@ -126,7 +126,7 @@
 
 	bool _ParseXMLDocument(const Common::String &FileName, TiXmlDocument &Doc) const;
 	bool _ParseFontTag(TiXmlElement &Tag, Common::String &BitmapFileName, int &LineHeight, int &GapWidth) const;
-	bool _ParseCharacterTag(TiXmlElement &Tag, int &Code, BS_Rect &Rect) const;
+	bool _ParseCharacterTag(TiXmlElement &Tag, int &Code, Common::Rect &Rect) const;
 };
 
 } // End of namespace Sword25

Modified: scummvm/trunk/engines/sword25/gfx/graphicengine.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/graphicengine.h	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/graphicengine.h	2010-10-12 23:09:12 UTC (rev 53265)
@@ -45,15 +45,16 @@
 
 // Includes
 #include "common/array.h"
+#include "common/rect.h"
 #include "common/str.h"
 #include "graphics/surface.h"
 #include "sword25/kernel/common.h"
 #include "sword25/kernel/bs_stdint.h"
 #include "sword25/kernel/resservice.h"
 #include "sword25/kernel/persistable.h"
-#include "sword25/math/rect.h"
 #include "sword25/gfx/framecounter.h"
 #include "sword25/gfx/renderobjectptr.h"
+#include "sword25/math/vertex.h"
 
 namespace Sword25 {
 
@@ -250,7 +251,7 @@
 	/**
 	 * Returns the bounding box of the output buffer: (0, 0, Width, Height)
 	 */
-	BS_Rect    &GetDisplayRect() {
+	Common::Rect    &GetDisplayRect() {
 		return m_ScreenRect;
 	}
 
@@ -284,13 +285,13 @@
 	/**
 	 * Fills a rectangular area of the frame buffer with a colour.
 	 * Notes: It is possible to create transparent rectangles by passing a colour with an Alpha value of 255.
-	 * @param FillRectPtr   Pointer to a BS_Rect, which specifies the section of the frame buffer to be filled.
+	 * @param FillRectPtr   Pointer to a Common::Rect, which specifies the section of the frame buffer to be filled.
 	 * If the rectangle falls partly off-screen, then it is automatically trimmed.
 	 * If a NULL value is passed, then the entire image is to be filled.
 	 * @param Color         The 32-bit colour with which the area is to be filled. The default is BS_RGB(0, 0, 0) (black)
 	    @remark Falls das Rechteck nicht v\xF6llig innerhalb des Bildschirms ist, wird es automatisch zurechtgestutzt.
 	 */
-	virtual bool Fill(const BS_Rect *FillRectPtr = 0, unsigned int Color = BS_RGB(0, 0, 0)) = 0;
+	virtual bool Fill(const Common::Rect *FillRectPtr = 0, unsigned int Color = BS_RGB(0, 0, 0)) = 0;
 
 	// Debugging Methods
 
@@ -373,7 +374,7 @@
 	// -----------------
 	int     m_Width;
 	int     m_Height;
-	BS_Rect m_ScreenRect;
+	Common::Rect m_ScreenRect;
 	int     m_BitDepth;
 	bool    m_Windowed;
 

Modified: scummvm/trunk/engines/sword25/gfx/image/image.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/image.h	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/image/image.h	2010-10-12 23:09:12 UTC (rev 53265)
@@ -44,7 +44,7 @@
 
 // Includes
 #include "sword25/kernel/common.h"
-#include "sword25/math/rect.h"
+#include "common/rect.h"
 #include "sword25/gfx/graphicengine.h"
 
 namespace Sword25 {
@@ -102,7 +102,7 @@
 	                Der Standardwert ist 0.
 	    @param Flipping gibt an, wie das Bild gespiegelt werden soll.<br>
 	                    Der Standardwert ist BS_Image::FLIP_NONE (keine Spiegelung)
-	    @param pSrcPartRect Pointer auf ein BS_Rect, welches den Ausschnitt des Quellbildes spezifiziert, der gerendert
+	    @param pSrcPartRect Pointer auf ein Common::Rect, welches den Ausschnitt des Quellbildes spezifiziert, der gerendert
 	                        werden soll oder NULL, falls das gesamte Bild gerendert werden soll.<br>
 	                        Dieser Ausschnitt bezieht sich auf das ungespiegelte und unskalierte Bild.<br>
 	                        Der Standardwert ist NULL.
@@ -133,13 +133,13 @@
 	*/
 	virtual bool Blit(int PosX = 0, int PosY = 0,
 	                  int Flipping = FLIP_NONE,
-	                  BS_Rect *pPartRect = NULL,
+	                  Common::Rect *pPartRect = NULL,
 	                  unsigned int Color = BS_ARGB(255, 255, 255, 255),
 	                  int Width = -1, int Height = -1) = 0;
 
 	/**
 	    @brief F\xFCllt einen Rechteckigen Bereich des Bildes mit einer Farbe.
-	    @param pFillRect Pointer auf ein BS_Rect, welches den Ausschnitt des Bildes spezifiziert, der gef\xFCllt
+	    @param pFillRect Pointer auf ein Common::Rect, welches den Ausschnitt des Bildes spezifiziert, der gef\xFCllt
 	                      werden soll oder NULL, falls das gesamte Bild gef\xFCllt werden soll.<br>
 	                      Der Standardwert ist NULL.
 	    @param Color der 32 Bit Farbwert mit dem der Bildbereich gef\xFCllt werden soll.
@@ -149,7 +149,7 @@
 	            BS_RGB und BS_ARGB benutzt werden.
 	    @remark Falls das Rechteck nicht v\xF6llig innerhalb des Bildschirms ist, wird es automatisch zurechtgestutzt.
 	*/
-	virtual bool Fill(const BS_Rect *pFillRect = 0, unsigned int Color = BS_RGB(0, 0, 0)) = 0;
+	virtual bool Fill(const Common::Rect *pFillRect = 0, unsigned int Color = BS_RGB(0, 0, 0)) = 0;
 
 	/**
 	    @brief F\xFCllt den Inhalt des Bildes mit Pixeldaten.

Modified: scummvm/trunk/engines/sword25/gfx/image/vectorimage.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/vectorimage.cpp	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/image/vectorimage.cpp	2010-10-12 23:09:12 UTC (rev 53265)
@@ -168,10 +168,10 @@
 
 
 // -----------------------------------------------------------------------------
-// Konvertiert SWF-Rechteckdaten in einem Bitstrom in BS_Rect-Objekte
+// Konvertiert SWF-Rechteckdaten in einem Bitstrom in Common::Rect-Objekte
 // -----------------------------------------------------------------------------
 
-BS_Rect FlashRectToBSRect(VectorImage::SWFBitStream &bs) {
+Common::Rect FlashRectToBSRect(VectorImage::SWFBitStream &bs) {
 	bs.FlushByte();
 
 	// Feststellen mit wie vielen Bits die einzelnen Komponenten kodiert sind
@@ -183,7 +183,7 @@
 	s32 YMin = bs.GetSignedBits(BitsPerValue);
 	s32 YMax = bs.GetSignedBits(BitsPerValue);
 
-	return BS_Rect(XMin, YMin, XMax + 1, YMax + 1);
+	return Common::Rect(XMin, YMin, XMax + 1, YMax + 1);
 }
 
 
@@ -210,7 +210,7 @@
 	const VectorImageElement &vectorImageElement;
 };
 
-BS_Rect CalculateBoundingBox(const VectorImageElement &vectorImageElement) {
+Common::Rect CalculateBoundingBox(const VectorImageElement &vectorImageElement) {
 #if 0 // TODO
 	agg::path_storage Path = vectorImageElement.GetPaths();
 	CBBGetId IdSource(vectorImageElement);
@@ -221,7 +221,7 @@
 	double x1, x2, y1, y2;
 	x1 = x2 = y1 = y2 = 0;
 #endif
-	return BS_Rect(static_cast<int>(x1), static_cast<int>(y1), static_cast<int>(x2) + 1, static_cast<int>(y2) + 1);
+	return Common::Rect(static_cast<int>(x1), static_cast<int>(y1), static_cast<int>(x2) + 1, static_cast<int>(y2) + 1);
 }
 }
 
@@ -264,7 +264,7 @@
 	}
 
 	// SWF-Ma\xDFe auslesen
-	BS_Rect MovieRect = FlashRectToBSRect(bs);
+	Common::Rect MovieRect = FlashRectToBSRect(bs);
 
 	// Framerate und Frameanzahl auslesen
 	/* u32 FrameRate = */bs.GetU16();
@@ -513,7 +513,7 @@
 
 // -----------------------------------------------------------------------------
 
-bool VectorImage::Fill(const BS_Rect *pFillRect, unsigned int Color) {
+bool VectorImage::Fill(const Common::Rect *pFillRect, unsigned int Color) {
 	BS_LOG_ERRORLN("Fill() is not supported.");
 	return false;
 }

Modified: scummvm/trunk/engines/sword25/gfx/image/vectorimage.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/image/vectorimage.h	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/image/vectorimage.h	2010-10-12 23:09:12 UTC (rev 53265)
@@ -41,7 +41,7 @@
 
 #include "sword25/kernel/common.h"
 #include "sword25/gfx/image/image.h"
-#include "sword25/math/rect.h"
+#include "common/rect.h"
 
 #if 0
 #include "agg_path_storage.h"
@@ -132,7 +132,7 @@
 		return m_FillStyles[FillStyle];
 	}
 
-	const BS_Rect &GetBoundingBox() const {
+	const Common::Rect &GetBoundingBox() const {
 		return m_BoundingBox;
 	}
 
@@ -150,7 +150,7 @@
 	Common::Array<VectorPathInfo> m_PathInfos;
 	Common::Array<LineStyleType> m_LineStyles;
 	Common::Array<uint32>  m_FillStyles;
-	BS_Rect m_BoundingBox;
+	Common::Rect m_BoundingBox;
 };
 
 
@@ -171,7 +171,7 @@
 		BS_ASSERT(ElementNr < m_Elements.size());
 		return m_Elements[ElementNr];
 	}
-	const BS_Rect &GetBoundingBox() const {
+	const Common::Rect &GetBoundingBox() const {
 		return m_BoundingBox;
 	}
 
@@ -179,15 +179,15 @@
 	// Die abstrakten Methoden von BS_Image
 	//
 	virtual int GetWidth() const {
-		return m_BoundingBox.GetWidth();
+		return m_BoundingBox.width();
 	}
 	virtual int GetHeight() const {
-		return m_BoundingBox.GetHeight();
+		return m_BoundingBox.height();
 	}
 	virtual GraphicEngine::COLOR_FORMATS GetColorFormat() const {
 		return GraphicEngine::CF_ARGB32;
 	}
-	virtual bool Fill(const BS_Rect *pFillRect = 0, unsigned int Color = BS_RGB(0, 0, 0));
+	virtual bool Fill(const Common::Rect *pFillRect = 0, unsigned int Color = BS_RGB(0, 0, 0));
 	virtual unsigned int GetPixel(int X, int Y);
 	virtual bool IsBlitSource() const {
 		return true;
@@ -213,7 +213,7 @@
 	virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride);
 	virtual bool Blit(int PosX = 0, int PosY = 0,
 	                  int Flipping = FLIP_NONE,
-	                  BS_Rect *pPartRect = NULL,
+	                  Common::Rect *pPartRect = NULL,
 	                  unsigned int Color = BS_ARGB(255, 255, 255, 255),
 	                  int Width = -1, int Height = -1);
 
@@ -224,7 +224,7 @@
 	bool ParseStyles(unsigned int ShapeType, SWFBitStream &bs, unsigned int &NumFillBits, unsigned int &NumLineBits);
 
 	Common::Array<VectorImageElement>    m_Elements;
-	BS_Rect                             m_BoundingBox;
+	Common::Rect                             m_BoundingBox;
 };
 
 } // End of namespace Sword25

Modified: scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/opengl/glimage.cpp	2010-10-12 23:09:12 UTC (rev 53265)
@@ -112,7 +112,7 @@
 
 // -----------------------------------------------------------------------------
 
-bool GLImage::Fill(const BS_Rect *pFillRect, unsigned int Color) {
+bool GLImage::Fill(const Common::Rect *pFillRect, unsigned int Color) {
 	BS_LOG_ERRORLN("Fill() is not supported.");
 	return false;
 }
@@ -147,7 +147,7 @@
 
 // -----------------------------------------------------------------------------
 
-bool GLImage::Blit(int PosX, int PosY, int Flipping, BS_Rect *pPartRect, unsigned int Color, int Width, int Height) {
+bool GLImage::Blit(int PosX, int PosY, int Flipping, Common::Rect *pPartRect, unsigned int Color, int Width, int Height) {
 	int x1 = 0, y1 = 0;
 	int w = m_Width, h = m_Height;
 	if (pPartRect) {

Modified: scummvm/trunk/engines/sword25/gfx/opengl/glimage.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/glimage.h	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/opengl/glimage.h	2010-10-12 23:09:12 UTC (rev 53265)
@@ -82,10 +82,10 @@
 
 	virtual bool Blit(int PosX = 0, int PosY = 0,
 	                  int Flipping = Image::FLIP_NONE,
-	                  BS_Rect *pPartRect = NULL,
+	                  Common::Rect *pPartRect = NULL,
 	                  unsigned int Color = BS_ARGB(255, 255, 255, 255),
 	                  int Width = -1, int Height = -1);
-	virtual bool Fill(const BS_Rect *pFillRect, unsigned int Color);
+	virtual bool Fill(const Common::Rect *pFillRect, unsigned int Color);
 	virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset = 0, unsigned int Stride = 0);
 	virtual unsigned int GetPixel(int X, int Y);
 

Modified: scummvm/trunk/engines/sword25/gfx/opengl/glvectorimageblit.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/glvectorimageblit.cpp	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/opengl/glvectorimageblit.cpp	2010-10-12 23:09:12 UTC (rev 53265)
@@ -53,7 +53,7 @@
 
 bool VectorImage::Blit(int PosX, int PosY,
                           int Flipping,
-                          BS_Rect *pPartRect,
+                          Common::Rect *pPartRect,
                           unsigned int Color,
                           int Width, int Height) {
 #if 0

Modified: scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.cpp	2010-10-12 23:09:12 UTC (rev 53265)
@@ -212,8 +212,8 @@
 
 // -----------------------------------------------------------------------------
 
-bool OpenGLGfx::Fill(const BS_Rect *FillRectPtr, unsigned int Color) {
-	BS_Rect Rect;
+bool OpenGLGfx::Fill(const Common::Rect *FillRectPtr, unsigned int Color) {
+	Common::Rect Rect;
 
 	if (!FillRectPtr) {
 		Rect.left = 0;

Modified: scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.h	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/opengl/openglgfx.h	2010-10-12 23:09:12 UTC (rev 53265)
@@ -77,7 +77,7 @@
 	virtual void        SetVsync(bool Vsync);
 	virtual bool        GetVsync() const;
 
-	virtual bool        Fill(const BS_Rect *FillRectPtr = 0, unsigned int Color = BS_RGB(0, 0, 0));
+	virtual bool        Fill(const Common::Rect *FillRectPtr = 0, unsigned int Color = BS_RGB(0, 0, 0));
 	virtual bool        GetScreenshot(unsigned int &Width, unsigned int &Height, byte **Data);
 
 	// Resource-Managing Methoden

Modified: scummvm/trunk/engines/sword25/gfx/opengl/swimage.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/swimage.cpp	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/opengl/swimage.cpp	2010-10-12 23:09:12 UTC (rev 53265)
@@ -102,7 +102,7 @@
 
 bool SWImage::Blit(int PosX, int PosY,
                       int Flipping,
-                      BS_Rect *pPartRect,
+                      Common::Rect *pPartRect,
                       unsigned int Color,
                       int Width, int Height) {
 	BS_LOG_ERRORLN("Blit() is not supported.");
@@ -111,7 +111,7 @@
 
 // -----------------------------------------------------------------------------
 
-bool SWImage::Fill(const BS_Rect *pFillRect, unsigned int Color) {
+bool SWImage::Fill(const Common::Rect *pFillRect, unsigned int Color) {
 	BS_LOG_ERRORLN("Fill() is not supported.");
 	return false;
 }

Modified: scummvm/trunk/engines/sword25/gfx/opengl/swimage.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/opengl/swimage.h	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/opengl/swimage.h	2010-10-12 23:09:12 UTC (rev 53265)
@@ -67,10 +67,10 @@
 
 	virtual bool Blit(int PosX = 0, int PosY = 0,
 	                  int Flipping = Image::FLIP_NONE,
-	                  BS_Rect *pPartRect = NULL,
+	                  Common::Rect *pPartRect = NULL,
 	                  unsigned int Color = BS_ARGB(255, 255, 255, 255),
 	                  int Width = -1, int Height = -1);
-	virtual bool Fill(const BS_Rect *FillRectPtr, unsigned int Color);
+	virtual bool Fill(const Common::Rect *FillRectPtr, unsigned int Color);
 	virtual bool SetContent(const byte *Pixeldata, uint size, unsigned int Offset, unsigned int Stride);
 	virtual unsigned int GetPixel(int X, int Y);
 

Modified: scummvm/trunk/engines/sword25/gfx/renderobject.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/renderobject.cpp	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/renderobject.cpp	2010-10-12 23:09:12 UTC (rev 53265)
@@ -182,15 +182,17 @@
 	m_BBox = CalcBoundingBox();
 }
 
-BS_Rect RenderObject::CalcBoundingBox() const {
+Common::Rect RenderObject::CalcBoundingBox() const {
 	// Die Bounding-Box mit der Objektgr\xF6\xDFe initialisieren.
-	BS_Rect BBox(0, 0, m_Width, m_Height);
+	Common::Rect BBox(0, 0, m_Width, m_Height);
 
 	// Die absolute Position der Bounding-Box berechnen.
-	BBox.Move(m_AbsoluteX, m_AbsoluteY);
+	BBox.translate(m_AbsoluteX, m_AbsoluteY);
 
 	// Die Bounding-Box am Elternobjekt clippen.
-	if (m_ParentPtr.IsValid()) BBox.Intersect(m_ParentPtr->GetBBox(), BBox);
+	if (m_ParentPtr.IsValid()) {
+		BBox.clip(m_ParentPtr->GetBBox());
+	}
 
 	return BBox;
 }
@@ -269,8 +271,10 @@
 // Get-Methoden
 // ------------
 
-bool RenderObject::GetObjectIntersection(RenderObjectPtr<RenderObject> pObject, BS_Rect &Result) {
-	return m_BBox.Intersect(pObject->GetBBox(), Result);
+bool RenderObject::GetObjectIntersection(RenderObjectPtr<RenderObject> pObject, Common::Rect &Result) {
+	Result = pObject->GetBBox();
+	Result.clip(m_BBox);
+	return Result.isValidRect();
 }
 
 // Set-Methoden

Modified: scummvm/trunk/engines/sword25/gfx/renderobject.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/renderobject.h	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/renderobject.h	2010-10-12 23:09:12 UTC (rev 53265)
@@ -48,7 +48,7 @@
 // Includes
 #include "sword25/kernel/common.h"
 #include "sword25/kernel/persistable.h"
-#include "sword25/math/rect.h"
+#include "common/rect.h"
 #include "sword25/gfx/renderobjectptr.h"
 
 #include "common/list.h"
@@ -336,7 +336,7 @@
 	    @brief Gibt die Bounding-Box des Objektes zur\xFCck.
 	    @remark Diese Angabe erfolgt ausnahmsweise in Bildschirmkoordianten und nicht relativ zum Elternobjekt.
 	 */
-	const BS_Rect  &GetBBox() const {
+	const Common::Rect  &GetBBox() const {
 		return m_BBox;
 	}
 	/**
@@ -379,10 +379,10 @@
 	bool        m_ChildChanged; ///< Ist true, wenn sich ein Kinderobjekt ver\xE4ndert hat
 	TYPES       m_Type;         ///< Der Objekttyp
 	bool        m_InitSuccess;  ///< Ist true, wenn Objekt erfolgreich intialisiert werden konnte
-	BS_Rect     m_BBox;         ///< Die Bounding-Box des Objektes in Bildschirmkoordinaten
+	Common::Rect     m_BBox;         ///< Die Bounding-Box des Objektes in Bildschirmkoordinaten
 
 	// Kopien der Variablen, die f\xFCr die Errechnung des Dirty-Rects und zur Bestimmung der Objektver\xE4nderung notwendig sind
-	BS_Rect     m_OldBBox;
+	Common::Rect     m_OldBBox;
 	int         m_OldX;
 	int         m_OldY;
 	int         m_OldZ;
@@ -463,12 +463,12 @@
 	    @brief Berechnet die Bounding-Box des Objektes.
 	    @return Gibt die Bounding-Box des Objektes in Bildschirmkoordinaten zur\xFCck.
 	*/
-	BS_Rect CalcBoundingBox() const;
+	Common::Rect CalcBoundingBox() const;
 	/**
 	    @brief Berechnet das Dirty-Rectangle des Objektes.
 	    @return Gibt das Dirty-Rectangle des Objektes in Bildschirmkoordinaten zur\xFCck.
 	*/
-	BS_Rect CalcDirtyRect() const;
+	Common::Rect CalcDirtyRect() const;
 	/**
 	    @brief Berechnet die absolute Position des Objektes.
 	*/
@@ -509,7 +509,7 @@
 	    @param Result das Ergebnisrechteck
 	    @return Gibt false zur\xFCck, falls sich die Objekte gar nicht schneiden.
 	 */
-	bool    GetObjectIntersection(RenderObjectPtr<RenderObject> pObject, BS_Rect &Result);
+	bool    GetObjectIntersection(RenderObjectPtr<RenderObject> pObject, Common::Rect &Result);
 	/**
 	    @brief Vergleichsoperator der auf Objektpointern basiert statt auf Objekten.
 	    @remark Diese Methode wird f\xFCrs Sortieren der Kinderliste nach der Rendereihenfolge benutzt.

Modified: scummvm/trunk/engines/sword25/gfx/renderobjectmanager.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/renderobjectmanager.cpp	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/renderobjectmanager.cpp	2010-10-12 23:09:12 UTC (rev 53265)
@@ -43,7 +43,7 @@
 #include "sword25/kernel/outputpersistenceblock.h"
 #include "sword25/gfx/graphicengine.h"
 #include "sword25/gfx/animationtemplateregistry.h"
-#include "sword25/math/rect.h"
+#include "common/rect.h"
 #include "sword25/gfx/renderobject.h"
 #include "sword25/gfx/timedrenderobject.h"
 #include "sword25/gfx/rootrenderobject.h"

Modified: scummvm/trunk/engines/sword25/gfx/renderobjectmanager.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/renderobjectmanager.h	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/renderobjectmanager.h	2010-10-12 23:09:12 UTC (rev 53265)
@@ -46,6 +46,7 @@
 #define SWORD25_RENDEROBJECTMANAGER_H
 
 // Includes
+#include "common/rect.h"
 #include "sword25/kernel/common.h"
 #include "sword25/gfx/renderobjectptr.h"
 #include "sword25/kernel/persistable.h"
@@ -54,7 +55,6 @@
 
 // Klassendefinition
 class Kernel;
-class BS_Rect;
 class RenderObject;
 class TimedRenderObject;
 

Modified: scummvm/trunk/engines/sword25/gfx/text.cpp
===================================================================
--- scummvm/trunk/engines/sword25/gfx/text.cpp	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/text.cpp	2010-10-12 23:09:12 UTC (rev 53265)
@@ -176,23 +176,23 @@
 	Common::Array<LINE>::iterator Iter = m_Lines.begin();
 	for (; Iter != m_Lines.end(); ++Iter) {
 		// Feststellen, ob \xFCberhaupt Buchstaben der aktuellen Zeile vom Update betroffen sind.
-		BS_Rect CheckRect = (*Iter).BBox;
-		CheckRect.Move(m_AbsoluteX, m_AbsoluteY);
+		Common::Rect CheckRect = (*Iter).BBox;
+		CheckRect.translate(m_AbsoluteX, m_AbsoluteY);
 
 		// Jeden Buchstaben einzeln Rendern.
 		int CurX = m_AbsoluteX + (*Iter).BBox.left;
 		int CurY = m_AbsoluteY + (*Iter).BBox.top;
 		for (unsigned int i = 0; i < (*Iter).Text.size(); ++i) {
-			BS_Rect CurRect = FontPtr->GetCharacterRect((unsigned char)(*Iter).Text[i]);
+			Common::Rect CurRect = FontPtr->GetCharacterRect((unsigned char)(*Iter).Text[i]);
 
-			BS_Rect RenderRect(CurX, CurY, CurX + CurRect.GetWidth(), CurY + CurRect.GetHeight());
+			Common::Rect RenderRect(CurX, CurY, CurX + CurRect.width(), CurY + CurRect.height());
 			int RenderX = CurX + (RenderRect.left - RenderRect.left);
 			int RenderY = CurY + (RenderRect.top - RenderRect.top);
-			RenderRect.Move(CurRect.left - CurX, CurRect.top - CurY);
+			RenderRect.translate(CurRect.left - CurX, CurRect.top - CurY);
 			Result = CharMapPtr->Blit(RenderX, RenderY, Image::FLIP_NONE, &RenderRect, m_ModulationColor);
 			if (!Result) break;
 
-			CurX += CurRect.GetWidth() + FontPtr->GetGapWidth();
+			CurX += CurRect.width() + FontPtr->GetGapWidth();
 		}
 	}
 
@@ -260,8 +260,8 @@
 			for (j = i; j < m_Text.size(); ++j) {
 				if ((unsigned char)m_Text[j] == ' ') LastSpace = j;
 
-				const BS_Rect &CurCharRect = FontPtr->GetCharacterRect((unsigned char)m_Text[j]);
-				TempLineWidth += CurCharRect.GetWidth();
+				const Common::Rect &CurCharRect = FontPtr->GetCharacterRect((unsigned char)m_Text[j]);
+				TempLineWidth += CurCharRect.width();
 				TempLineWidth += FontPtr->GetGapWidth();
 
 				if ((TempLineWidth >= m_AutoWrapThreshold) && (LastSpace > 0))
@@ -275,10 +275,10 @@
 			for (j = i; j < LastSpace; ++j) {
 				m_Lines[CurLine].Text += m_Text[j];
 
-				const BS_Rect &CurCharRect = FontPtr->GetCharacterRect((unsigned char)m_Text[j]);
-				CurLineWidth += CurCharRect.GetWidth();
+				const Common::Rect &CurCharRect = FontPtr->GetCharacterRect((unsigned char)m_Text[j]);
+				CurLineWidth += CurCharRect.width();
 				CurLineWidth += FontPtr->GetGapWidth();
-				if ((unsigned int) CurCharRect.GetHeight() > CurLineHeight) CurLineHeight = CurCharRect.GetHeight();
+				if ((unsigned int) CurCharRect.height() > CurLineHeight) CurLineHeight = CurCharRect.height();
 			}
 
 			m_Lines[CurLine].BBox.right = CurLineWidth;
@@ -299,17 +299,17 @@
 		m_Height = 0;
 		Common::Array<LINE>::iterator Iter = m_Lines.begin();
 		for (; Iter != m_Lines.end(); ++Iter) {
-			BS_Rect &BBox = (*Iter).BBox;
+			Common::Rect &BBox = (*Iter).BBox;
 			BBox.left = (m_Width - BBox.right) / 2;
 			BBox.right = BBox.left + BBox.right;
 			BBox.top = (Iter - m_Lines.begin()) * FontPtr->GetLineHeight();
 			BBox.bottom = BBox.top + BBox.bottom;
-			m_Height += BBox.GetHeight();
+			m_Height += BBox.height();
 		}
 	} else {
 		// Keine automatische Formatierung, also wird der gesamte Text in nur eine Zeile kopiert.
 		m_Lines[0].Text = m_Text;
-		m_Lines[0].BBox = BS_Rect(0, 0, m_Width, m_Height);
+		m_Lines[0].BBox = Common::Rect(0, 0, m_Width, m_Height);
 	}
 
 	FontPtr->Release();
@@ -322,10 +322,10 @@
 	m_Height = 0;
 
 	for (unsigned int i = 0; i < m_Text.size(); ++i) {
-		const BS_Rect &CurRect = FontResource.GetCharacterRect((unsigned char)m_Text[i]);
-		m_Width += CurRect.GetWidth();
+		const Common::Rect &CurRect = FontResource.GetCharacterRect((unsigned char)m_Text[i]);
+		m_Width += CurRect.width();
 		if (i != m_Text.size() - 1) m_Width += FontResource.GetGapWidth();
-		if (m_Height < CurRect.GetHeight()) m_Height = CurRect.GetHeight();
+		if (m_Height < CurRect.height()) m_Height = CurRect.height();
 	}
 }
 

Modified: scummvm/trunk/engines/sword25/gfx/text.h
===================================================================
--- scummvm/trunk/engines/sword25/gfx/text.h	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/gfx/text.h	2010-10-12 23:09:12 UTC (rev 53265)
@@ -40,7 +40,7 @@
 // -----------------------------------------------------------------------------
 
 #include "sword25/kernel/common.h"
-#include "sword25/math/rect.h"
+#include "common/rect.h"
 #include "sword25/gfx/renderobject.h"
 
 namespace Sword25 {
@@ -164,7 +164,7 @@
 	unsigned int    m_AutoWrapThreshold;
 
 	struct LINE {
-		BS_Rect     BBox;
+		Common::Rect     BBox;
 		Common::String  Text;
 	};
 

Deleted: scummvm/trunk/engines/sword25/math/rect.h
===================================================================
--- scummvm/trunk/engines/sword25/math/rect.h	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/math/rect.h	2010-10-12 23:09:12 UTC (rev 53265)
@@ -1,116 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * $URL$
- * $Id$
- *
- */
-
-/*
- * This code is based on Broken Sword 2.5 engine
- *
- * Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
- *
- * Licensed under GNU GPL v2
- *
- */
-
-#ifndef SWORD25_RECT_H
-#define SWORD25_RECT_H
-
-// Includes
-#include "common/rect.h"
-#include "sword25/kernel/common.h"
-#include "sword25/math/vertex.h"
-
-namespace Sword25 {
-
-// Class definitions
-
-/**
- * Rect class. Currently this encapsultes the ScummVM Rect class. Eventually all usage of this
- * class should be replaced with Common::Rect directly.
-*/
-class BS_Rect: public Common::Rect {
-public:
-	BS_Rect() : Common::Rect() {}
-	BS_Rect(int16 w, int16 h) : Common::Rect(w, h) {}
-	BS_Rect(int16 x1, int16 y1, int16 x2, int16 y2) : Common::Rect(x1, y1, x2, y2) {}
-
-	void Move(int DeltaX, int DeltaY) {
-		translate(DeltaX, DeltaY);
-	}
-
-	bool DoesIntersect(const BS_Rect &Rect_) const {
-		return intersects(Rect_);
-	}
-
-	bool Intersect(const BS_Rect &Rect_, BS_Rect &Result) const {
-		Result = Rect_;
-		Result.clip(*this);
-
-		return Result.isEmpty();
-	}
-
-	void Join(const BS_Rect &Rect_, BS_Rect &Result) const {
-		Result = Rect_;
-		Result.extend(*this);
-	}
-
-	int GetWidth() const {
-		return width();
-	}
-
-	int GetHeight() const {
-		return height();
-	}
-
-	int GetArea() const {
-		return width() * height();
-	}
-
-	bool operator==(const BS_Rect &rhs) const {
-		return equals(rhs);
-	}
-
-	bool operator!= (const BS_Rect &rhs) const {
-		return !equals(rhs);
-	}
-
-	bool IsValid() const {
-		return isValidRect();
-	}
-
-	bool IsPointInRect(const Vertex &Vertex) const {
-		return contains(Vertex.X, Vertex.Y);
-	}
-
-	bool IsPointInRect(int X, int Y) const {
-		return contains(X, Y);
-	}
-
-	bool ContainsRect(const BS_Rect &OtherRect) const {
-		return contains(OtherRect);
-	}
-};
-
-} // End of namespace Sword25
-
-#endif

Modified: scummvm/trunk/engines/sword25/math/region.cpp
===================================================================
--- scummvm/trunk/engines/sword25/math/region.cpp	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/math/region.cpp	2010-10-12 23:09:12 UTC (rev 53265)
@@ -156,7 +156,7 @@
 			else if (m_Polygons[0].Vertecies[i].Y > MaxY) MaxY = m_Polygons[0].Vertecies[i].Y;
 		}
 
-		m_BoundingBox = BS_Rect(MinX, MinY, MaxX + 1, MaxY + 1);
+		m_BoundingBox = Common::Rect(MinX, MinY, MaxX + 1, MaxY + 1);
 	}
 }
 
@@ -196,7 +196,7 @@
 
 bool Region::IsPointInRegion(int X, int Y) const {
 	// Test whether the point is in the bounding box
-	if (m_BoundingBox.IsPointInRect(X, Y)) {
+	if (m_BoundingBox.contains(X, Y)) {
 		// Test whether the point is in the contour
 		if (m_Polygons[0].IsPointInPolygon(X, Y, true)) {
 			// Test whether the point is in a hole

Modified: scummvm/trunk/engines/sword25/math/region.h
===================================================================
--- scummvm/trunk/engines/sword25/math/region.h	2010-10-12 23:08:12 UTC (rev 53264)
+++ scummvm/trunk/engines/sword25/math/region.h	2010-10-12 23:09:12 UTC (rev 53265)
@@ -39,7 +39,7 @@
 #include "sword25/kernel/persistable.h"
 #include "sword25/math/vertex.h"
 #include "sword25/math/polygon.h"
-#include "sword25/math/rect.h"
+#include "common/rect.h"
 
 namespace Sword25 {
 
@@ -214,7 +214,7 @@
 	// the array is the contour, all others are the holes
 	Common::Array<Polygon> m_Polygons;
 	/// The bounding box for the region
-	BS_Rect m_BoundingBox;
+	Common::Rect m_BoundingBox;
 
 	/**
 	 * Updates the bounding box of the region.


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list