aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2010-08-21 08:20:32 +0000
committerEugene Sandulenko2010-10-12 23:09:12 +0000
commit1d16dfd281b30627ce0ade7c6c2de0cb7e4cc985 (patch)
treeaebed8218d896782eedf28f4d9f53d6e656812dc
parent018698467143fb2d91c4688db032a883bac8db5c (diff)
downloadscummvm-rg350-1d16dfd281b30627ce0ade7c6c2de0cb7e4cc985.tar.gz
scummvm-rg350-1d16dfd281b30627ce0ade7c6c2de0cb7e4cc985.tar.bz2
scummvm-rg350-1d16dfd281b30627ce0ade7c6c2de0cb7e4cc985.zip
SWORD25: Refactored engine to remove BS_Rect class
svn-id: r53265
-rw-r--r--engines/sword25/gfx/bitmapresource.h10
-rw-r--r--engines/sword25/gfx/fontresource.cpp4
-rw-r--r--engines/sword25/gfx/fontresource.h8
-rw-r--r--engines/sword25/gfx/graphicengine.h11
-rw-r--r--engines/sword25/gfx/image/image.h10
-rw-r--r--engines/sword25/gfx/image/vectorimage.cpp14
-rw-r--r--engines/sword25/gfx/image/vectorimage.h18
-rw-r--r--engines/sword25/gfx/opengl/glimage.cpp4
-rw-r--r--engines/sword25/gfx/opengl/glimage.h4
-rw-r--r--engines/sword25/gfx/opengl/glvectorimageblit.cpp2
-rw-r--r--engines/sword25/gfx/opengl/openglgfx.cpp4
-rw-r--r--engines/sword25/gfx/opengl/openglgfx.h2
-rw-r--r--engines/sword25/gfx/opengl/swimage.cpp4
-rw-r--r--engines/sword25/gfx/opengl/swimage.h4
-rw-r--r--engines/sword25/gfx/renderobject.cpp16
-rw-r--r--engines/sword25/gfx/renderobject.h14
-rw-r--r--engines/sword25/gfx/renderobjectmanager.cpp2
-rw-r--r--engines/sword25/gfx/renderobjectmanager.h2
-rw-r--r--engines/sword25/gfx/text.cpp34
-rw-r--r--engines/sword25/gfx/text.h4
-rw-r--r--engines/sword25/math/rect.h116
-rw-r--r--engines/sword25/math/region.cpp4
-rw-r--r--engines/sword25/math/region.h4
23 files changed, 92 insertions, 203 deletions
diff --git a/engines/sword25/gfx/bitmapresource.h b/engines/sword25/gfx/bitmapresource.h
index 11d854ea08..b46ebee479 100644
--- a/engines/sword25/gfx/bitmapresource.h
+++ b/engines/sword25/gfx/bitmapresource.h
@@ -46,7 +46,7 @@ namespace Sword25 {
// Forward Declarations
// -----------------------------------------------------------------------------
-class BS_Rect;
+class Common::Rect;
class BitmapResource : public Resource {
public:
@@ -100,7 +100,7 @@ public:
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 @@ public:
*/
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 @@ public:
/**
@brief Füllt einen Rechteckigen Bereich des Bildes mit einer Farbe.
- @param pFillRect Pointer auf ein BS_Rect, welches den Ausschnitt des Bildes spezifiziert, der gefüllt
+ @param pFillRect Pointer auf ein Common::Rect, welches den Ausschnitt des Bildes spezifiziert, der gefüllt
werden soll oder NULL, falls das gesamte Bild gefüllt werden soll.<br>
Der Standardwert ist NULL.
@param Color der 32 Bit Farbwert mit dem der Bildbereich gefüllt werden soll.
@@ -150,7 +150,7 @@ public:
BS_RGB und BS_ARGB benutzt werden.
@remark Falls das Rechteck nicht völlig 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);
}
diff --git a/engines/sword25/gfx/fontresource.cpp b/engines/sword25/gfx/fontresource.cpp
index cdd6f886d3..0e5257a872 100644
--- a/engines/sword25/gfx/fontresource.cpp
+++ b/engines/sword25/gfx/fontresource.cpp
@@ -115,7 +115,7 @@ FontResource::FontResource(Kernel *pKernel, const Common::String &FileName) :
// 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::_ParseFontTag(TiXmlElement &Tag, Common::String &BitmapFileNa
// -----------------------------------------------------------------------------
-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) {
diff --git a/engines/sword25/gfx/fontresource.h b/engines/sword25/gfx/fontresource.h
index 3888927f9c..786405fe11 100644
--- a/engines/sword25/gfx/fontresource.h
+++ b/engines/sword25/gfx/fontresource.h
@@ -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 @@ public:
@param Character der ASCII-Code des Zeichens
@return Das Bounding-Rect des übergebenen 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 @@ private:
Common::String _BitmapFileName;
int _LineHeight;
int _GapWidth;
- BS_Rect _CharacterRects[256];
+ Common::Rect _CharacterRects[256];
// -----------------------------------------------------------------------------
// Hilfsmethoden
@@ -126,7 +126,7 @@ private:
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
diff --git a/engines/sword25/gfx/graphicengine.h b/engines/sword25/gfx/graphicengine.h
index 8968cc898e..fa2b1b191b 100644
--- a/engines/sword25/gfx/graphicengine.h
+++ b/engines/sword25/gfx/graphicengine.h
@@ -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 @@ public:
/**
* 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 @@ public:
/**
* 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öllig 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 @@ protected:
// -----------------
int m_Width;
int m_Height;
- BS_Rect m_ScreenRect;
+ Common::Rect m_ScreenRect;
int m_BitDepth;
bool m_Windowed;
diff --git a/engines/sword25/gfx/image/image.h b/engines/sword25/gfx/image/image.h
index dbf5a7f31d..5ea4a6caa4 100644
--- a/engines/sword25/gfx/image/image.h
+++ b/engines/sword25/gfx/image/image.h
@@ -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 @@ public:
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 @@ public:
*/
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üllt einen Rechteckigen Bereich des Bildes mit einer Farbe.
- @param pFillRect Pointer auf ein BS_Rect, welches den Ausschnitt des Bildes spezifiziert, der gefüllt
+ @param pFillRect Pointer auf ein Common::Rect, welches den Ausschnitt des Bildes spezifiziert, der gefüllt
werden soll oder NULL, falls das gesamte Bild gefüllt werden soll.<br>
Der Standardwert ist NULL.
@param Color der 32 Bit Farbwert mit dem der Bildbereich gefüllt werden soll.
@@ -149,7 +149,7 @@ public:
BS_RGB und BS_ARGB benutzt werden.
@remark Falls das Rechteck nicht völlig 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üllt den Inhalt des Bildes mit Pixeldaten.
diff --git a/engines/sword25/gfx/image/vectorimage.cpp b/engines/sword25/gfx/image/vectorimage.cpp
index 4d01e825ea..b1102d38b8 100644
--- a/engines/sword25/gfx/image/vectorimage.cpp
+++ b/engines/sword25/gfx/image/vectorimage.cpp
@@ -168,10 +168,10 @@ const u32 MAX_ACCEPTED_FLASH_VERSION = 3; // Die höchste Flash-Dateiversion, d
// -----------------------------------------------------------------------------
-// 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 @@ BS_Rect FlashRectToBSRect(VectorImage::SWFBitStream &bs) {
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 @@ struct CBBGetId {
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 @@ BS_Rect CalculateBoundingBox(const VectorImageElement &vectorImageElement) {
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 @@ VectorImage::VectorImage(const unsigned char *pFileData, unsigned int FileSize,
}
// SWF-Maße 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::ParseStyles(unsigned int ShapeType, SWFBitStream &bs, unsigned
// -----------------------------------------------------------------------------
-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;
}
diff --git a/engines/sword25/gfx/image/vectorimage.h b/engines/sword25/gfx/image/vectorimage.h
index b61db91581..c17f98a3d5 100644
--- a/engines/sword25/gfx/image/vectorimage.h
+++ b/engines/sword25/gfx/image/vectorimage.h
@@ -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 @@ public:
return m_FillStyles[FillStyle];
}
- const BS_Rect &GetBoundingBox() const {
+ const Common::Rect &GetBoundingBox() const {
return m_BoundingBox;
}
@@ -150,7 +150,7 @@ private:
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 @@ public:
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 @@ public:
// 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 @@ public:
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 @@ private:
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
diff --git a/engines/sword25/gfx/opengl/glimage.cpp b/engines/sword25/gfx/opengl/glimage.cpp
index a690cc19ee..919721df18 100644
--- a/engines/sword25/gfx/opengl/glimage.cpp
+++ b/engines/sword25/gfx/opengl/glimage.cpp
@@ -112,7 +112,7 @@ GLImage::~GLImage() {
// -----------------------------------------------------------------------------
-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 @@ unsigned int GLImage::GetPixel(int X, int Y) {
// -----------------------------------------------------------------------------
-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) {
diff --git a/engines/sword25/gfx/opengl/glimage.h b/engines/sword25/gfx/opengl/glimage.h
index 13276798e0..661c4cf1e7 100644
--- a/engines/sword25/gfx/opengl/glimage.h
+++ b/engines/sword25/gfx/opengl/glimage.h
@@ -82,10 +82,10 @@ public:
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);
diff --git a/engines/sword25/gfx/opengl/glvectorimageblit.cpp b/engines/sword25/gfx/opengl/glvectorimageblit.cpp
index 7dc6dd661d..8a91a910a2 100644
--- a/engines/sword25/gfx/opengl/glvectorimageblit.cpp
+++ b/engines/sword25/gfx/opengl/glvectorimageblit.cpp
@@ -53,7 +53,7 @@ const float LINE_SCALE_FACTOR = 1.0f;
bool VectorImage::Blit(int PosX, int PosY,
int Flipping,
- BS_Rect *pPartRect,
+ Common::Rect *pPartRect,
unsigned int Color,
int Width, int Height) {
#if 0
diff --git a/engines/sword25/gfx/opengl/openglgfx.cpp b/engines/sword25/gfx/opengl/openglgfx.cpp
index e73654ce95..bc2e228030 100644
--- a/engines/sword25/gfx/opengl/openglgfx.cpp
+++ b/engines/sword25/gfx/opengl/openglgfx.cpp
@@ -212,8 +212,8 @@ bool OpenGLGfx::GetVsync() const {
// -----------------------------------------------------------------------------
-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;
diff --git a/engines/sword25/gfx/opengl/openglgfx.h b/engines/sword25/gfx/opengl/openglgfx.h
index 6615c540df..12c91f7d14 100644
--- a/engines/sword25/gfx/opengl/openglgfx.h
+++ b/engines/sword25/gfx/opengl/openglgfx.h
@@ -77,7 +77,7 @@ public:
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
diff --git a/engines/sword25/gfx/opengl/swimage.cpp b/engines/sword25/gfx/opengl/swimage.cpp
index 5fa579365b..4dd8d9fca3 100644
--- a/engines/sword25/gfx/opengl/swimage.cpp
+++ b/engines/sword25/gfx/opengl/swimage.cpp
@@ -102,7 +102,7 @@ SWImage::~SWImage() {
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::Blit(int PosX, int PosY,
// -----------------------------------------------------------------------------
-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;
}
diff --git a/engines/sword25/gfx/opengl/swimage.h b/engines/sword25/gfx/opengl/swimage.h
index d563125d26..0d0d1c75c3 100644
--- a/engines/sword25/gfx/opengl/swimage.h
+++ b/engines/sword25/gfx/opengl/swimage.h
@@ -67,10 +67,10 @@ public:
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);
diff --git a/engines/sword25/gfx/renderobject.cpp b/engines/sword25/gfx/renderobject.cpp
index 3b9d3970d3..f0a7caea9e 100644
--- a/engines/sword25/gfx/renderobject.cpp
+++ b/engines/sword25/gfx/renderobject.cpp
@@ -182,15 +182,17 @@ void RenderObject::UpdateBoxes() {
m_BBox = CalcBoundingBox();
}
-BS_Rect RenderObject::CalcBoundingBox() const {
+Common::Rect RenderObject::CalcBoundingBox() const {
// Die Bounding-Box mit der Objektgröße 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 @@ void RenderObject::UpdateAbsolutePos() {
// 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
diff --git a/engines/sword25/gfx/renderobject.h b/engines/sword25/gfx/renderobject.h
index 3a824d9012..222525c60a 100644
--- a/engines/sword25/gfx/renderobject.h
+++ b/engines/sword25/gfx/renderobject.h
@@ -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 @@ public:
@brief Gibt die Bounding-Box des Objektes zurück.
@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 @@ protected:
bool m_ChildChanged; ///< Ist true, wenn sich ein Kinderobjekt verändert 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ür die Errechnung des Dirty-Rects und zur Bestimmung der Objektveränderung notwendig sind
- BS_Rect m_OldBBox;
+ Common::Rect m_OldBBox;
int m_OldX;
int m_OldY;
int m_OldZ;
@@ -463,12 +463,12 @@ private:
@brief Berechnet die Bounding-Box des Objektes.
@return Gibt die Bounding-Box des Objektes in Bildschirmkoordinaten zurück.
*/
- 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ück.
*/
- BS_Rect CalcDirtyRect() const;
+ Common::Rect CalcDirtyRect() const;
/**
@brief Berechnet die absolute Position des Objektes.
*/
@@ -509,7 +509,7 @@ private:
@param Result das Ergebnisrechteck
@return Gibt false zurück, 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ürs Sortieren der Kinderliste nach der Rendereihenfolge benutzt.
diff --git a/engines/sword25/gfx/renderobjectmanager.cpp b/engines/sword25/gfx/renderobjectmanager.cpp
index 72afd856c3..3fcf37275a 100644
--- a/engines/sword25/gfx/renderobjectmanager.cpp
+++ b/engines/sword25/gfx/renderobjectmanager.cpp
@@ -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"
diff --git a/engines/sword25/gfx/renderobjectmanager.h b/engines/sword25/gfx/renderobjectmanager.h
index dd959b6826..7d9015d117 100644
--- a/engines/sword25/gfx/renderobjectmanager.h
+++ b/engines/sword25/gfx/renderobjectmanager.h
@@ -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 @@ namespace Sword25 {
// Klassendefinition
class Kernel;
-class BS_Rect;
class RenderObject;
class TimedRenderObject;
diff --git a/engines/sword25/gfx/text.cpp b/engines/sword25/gfx/text.cpp
index 6d568f1b43..bb24cba25b 100644
--- a/engines/sword25/gfx/text.cpp
+++ b/engines/sword25/gfx/text.cpp
@@ -176,23 +176,23 @@ bool Text::DoRender() {
Common::Array<LINE>::iterator Iter = m_Lines.begin();
for (; Iter != m_Lines.end(); ++Iter) {
// Feststellen, ob überhaupt 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 @@ void Text::UpdateFormat() {
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 @@ void Text::UpdateFormat() {
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 @@ void Text::UpdateFormat() {
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 @@ void Text::UpdateMetrics(FontResource &FontResource) {
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();
}
}
diff --git a/engines/sword25/gfx/text.h b/engines/sword25/gfx/text.h
index bf74f5caf2..9e062afba8 100644
--- a/engines/sword25/gfx/text.h
+++ b/engines/sword25/gfx/text.h
@@ -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 @@ private:
unsigned int m_AutoWrapThreshold;
struct LINE {
- BS_Rect BBox;
+ Common::Rect BBox;
Common::String Text;
};
diff --git a/engines/sword25/math/rect.h b/engines/sword25/math/rect.h
deleted file mode 100644
index c08169e86e..0000000000
--- a/engines/sword25/math/rect.h
+++ /dev/null
@@ -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
diff --git a/engines/sword25/math/region.cpp b/engines/sword25/math/region.cpp
index 64115634de..3eb5b6dbe7 100644
--- a/engines/sword25/math/region.cpp
+++ b/engines/sword25/math/region.cpp
@@ -156,7 +156,7 @@ void Region::UpdateBoundingBox() {
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 @@ void Region::SetPosY(int Y) {
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
diff --git a/engines/sword25/math/region.h b/engines/sword25/math/region.h
index 2e89403efc..0bb9bb84b9 100644
--- a/engines/sword25/math/region.h
+++ b/engines/sword25/math/region.h
@@ -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 @@ protected:
// 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.