aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25/gfx/bitmap.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/sword25/gfx/bitmap.cpp')
-rw-r--r--engines/sword25/gfx/bitmap.cpp70
1 files changed, 24 insertions, 46 deletions
diff --git a/engines/sword25/gfx/bitmap.cpp b/engines/sword25/gfx/bitmap.cpp
index 5dd553ef8c..534e28d78e 100644
--- a/engines/sword25/gfx/bitmap.cpp
+++ b/engines/sword25/gfx/bitmap.cpp
@@ -23,7 +23,7 @@
*
*/
-/*
+/*
* This code is based on Broken Sword 2.5 engine
*
* Copyright (c) Malte Thiesen, Daniel Queteschiner and Michael Elsdoerfer
@@ -58,41 +58,35 @@ BS_Bitmap::BS_Bitmap(BS_RenderObjectPtr<BS_RenderObject> ParentPtr, TYPES Type,
m_ScaleFactorX(1.0f),
m_ScaleFactorY(1.0f),
m_FlipH(false),
- m_FlipV(false)
-{
+ m_FlipV(false) {
}
// -----------------------------------------------------------------------------
-BS_Bitmap::~BS_Bitmap()
-{
+BS_Bitmap::~BS_Bitmap() {
}
// -----------------------------------------------------------------------------
// Darstellungsart festlegen
// -----------------------------------------------------------------------------
-void BS_Bitmap::SetAlpha(int Alpha)
-{
- if (!IsAlphaAllowed())
- {
+void BS_Bitmap::SetAlpha(int Alpha) {
+ if (!IsAlphaAllowed()) {
BS_LOG_WARNINGLN("Tried to set alpha value on a bitmap that does not support alpha blending. Call was ignored.");
return;
}
- if (Alpha < 0 || Alpha > 255)
- {
+ if (Alpha < 0 || Alpha > 255) {
int OldAlpha = Alpha;
if (Alpha < 0) Alpha = 0;
if (Alpha > 255) Alpha = 255;
BS_LOG_WARNINGLN("Tried to set an invalid alpha value (%d) on a bitmap. Value was changed to %d.", OldAlpha, Alpha);
-
+
return;
}
unsigned int NewModulationColor = (m_ModulationColor & 0x00ffffff) | Alpha << 24;
- if (NewModulationColor != m_ModulationColor)
- {
+ if (NewModulationColor != m_ModulationColor) {
m_ModulationColor = NewModulationColor;
ForceRefresh();
}
@@ -100,17 +94,14 @@ void BS_Bitmap::SetAlpha(int Alpha)
// -----------------------------------------------------------------------------
-void BS_Bitmap::SetModulationColor(unsigned int ModulationColor)
-{
- if (!IsColorModulationAllowed())
- {
+void BS_Bitmap::SetModulationColor(unsigned int ModulationColor) {
+ if (!IsColorModulationAllowed()) {
BS_LOG_WARNINGLN("Tried to set modulation color of a bitmap that does not support color modulation. Call was ignored.");
return;
}
unsigned int NewModulationColor = (ModulationColor & 0x00ffffff) | (m_ModulationColor & 0xff000000);
- if (NewModulationColor != m_ModulationColor)
- {
+ if (NewModulationColor != m_ModulationColor) {
m_ModulationColor = NewModulationColor;
ForceRefresh();
}
@@ -118,30 +109,25 @@ void BS_Bitmap::SetModulationColor(unsigned int ModulationColor)
// -----------------------------------------------------------------------------
-void BS_Bitmap::SetScaleFactor(float ScaleFactor)
-{
+void BS_Bitmap::SetScaleFactor(float ScaleFactor) {
SetScaleFactorX(ScaleFactor);
SetScaleFactorY(ScaleFactor);
}
// -----------------------------------------------------------------------------
-void BS_Bitmap::SetScaleFactorX(float ScaleFactorX)
-{
- if (!IsScalingAllowed())
- {
+void BS_Bitmap::SetScaleFactorX(float ScaleFactorX) {
+ if (!IsScalingAllowed()) {
BS_LOG_WARNINGLN("Tried to set scale factor of a bitmap that does not support scaling. Call was ignored.");
return;
}
- if (ScaleFactorX < 0)
- {
+ if (ScaleFactorX < 0) {
BS_LOG_WARNINGLN("Tried to set scale factor of a bitmap to a negative value. Call was ignored.");
return;
}
- if (ScaleFactorX != m_ScaleFactorX)
- {
+ if (ScaleFactorX != m_ScaleFactorX) {
m_ScaleFactorX = ScaleFactorX;
m_Width = static_cast<int>(m_OriginalWidth * m_ScaleFactorX);
if (m_ScaleFactorX <= 0.0f) m_ScaleFactorX = 0.001f;
@@ -151,22 +137,18 @@ void BS_Bitmap::SetScaleFactorX(float ScaleFactorX)
// -----------------------------------------------------------------------------
-void BS_Bitmap::SetScaleFactorY(float ScaleFactorY)
-{
- if (!IsScalingAllowed())
- {
+void BS_Bitmap::SetScaleFactorY(float ScaleFactorY) {
+ if (!IsScalingAllowed()) {
BS_LOG_WARNINGLN("Tried to set scale factor of a bitmap that does not support scaling. Call was ignored.");
return;
}
- if (ScaleFactorY < 0)
- {
+ if (ScaleFactorY < 0) {
BS_LOG_WARNINGLN("Tried to set scale factor of a bitmap to a negative value. Call was ignored.");
return;
}
- if (ScaleFactorY != m_ScaleFactorY)
- {
+ if (ScaleFactorY != m_ScaleFactorY) {
m_ScaleFactorY = ScaleFactorY;
m_Height = static_cast<int>(m_OriginalHeight * ScaleFactorY);
if (m_ScaleFactorY <= 0.0f) m_ScaleFactorY = 0.001f;
@@ -176,16 +158,14 @@ void BS_Bitmap::SetScaleFactorY(float ScaleFactorY)
// -----------------------------------------------------------------------------
-void BS_Bitmap::SetFlipH(bool FlipH)
-{
+void BS_Bitmap::SetFlipH(bool FlipH) {
m_FlipH = FlipH;
ForceRefresh();
}
// -----------------------------------------------------------------------------
-void BS_Bitmap::SetFlipV(bool FlipV)
-{
+void BS_Bitmap::SetFlipV(bool FlipV) {
m_FlipV = FlipV;
ForceRefresh();
}
@@ -194,8 +174,7 @@ void BS_Bitmap::SetFlipV(bool FlipV)
// Persistenz
// -----------------------------------------------------------------------------
-bool BS_Bitmap::Persist(BS_OutputPersistenceBlock & Writer)
-{
+bool BS_Bitmap::Persist(BS_OutputPersistenceBlock &Writer) {
bool Result = true;
Result &= BS_RenderObject::Persist(Writer);
@@ -212,8 +191,7 @@ bool BS_Bitmap::Persist(BS_OutputPersistenceBlock & Writer)
// -----------------------------------------------------------------------------
-bool BS_Bitmap::Unpersist(BS_InputPersistenceBlock & Reader)
-{
+bool BS_Bitmap::Unpersist(BS_InputPersistenceBlock &Reader) {
bool Result = true;
Result &= BS_RenderObject::Unpersist(Reader);