[Scummvm-git-logs] scummvm master -> 7fc69ebdea10101d8d59eed400eff9da7c0b3b4c
dreammaster
dreammaster at scummvm.org
Tue Jul 11 01:24:18 CEST 2017
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
7fc69ebdea TITANIC: Inline CTransparencySurface methods at wjp's suggestion
Commit: 7fc69ebdea10101d8d59eed400eff9da7c0b3b4c
https://github.com/scummvm/scummvm/commit/7fc69ebdea10101d8d59eed400eff9da7c0b3b4c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-07-10T19:24:10-04:00
Commit Message:
TITANIC: Inline CTransparencySurface methods at wjp's suggestion
Changed paths:
engines/titanic/support/transparency_surface.cpp
engines/titanic/support/transparency_surface.h
diff --git a/engines/titanic/support/transparency_surface.cpp b/engines/titanic/support/transparency_surface.cpp
index 505cd1f..a2efe12 100644
--- a/engines/titanic/support/transparency_surface.cpp
+++ b/engines/titanic/support/transparency_surface.cpp
@@ -57,39 +57,4 @@ CTransparencySurface::CTransparencySurface(const Graphics::Surface *surface,
}
}
-int CTransparencySurface::moveX() {
- if (++_pos.x >= _surface->w) {
- _pos.x = 0;
- ++_pos.y;
- }
-
- return 1;
-}
-
-uint CTransparencySurface::getPixel() const {
- byte pixel = *(const byte *)_surface->getBasePtr(_pos.x, _pos.y);
- return pixel;
-}
-
-uint CTransparencySurface::getAlpha() const {
- byte pixel = getPixel();
- return _opaqueColor ? 0xFF - pixel : pixel;
-}
-
-bool CTransparencySurface::isPixelOpaque() const {
- byte pixel = getPixel();
- if (_opaqueColor)
- return pixel >= 0xf0;
- else
- return pixel < 0x10;
-}
-
-bool CTransparencySurface::isPixelTransparent() const {
- byte pixel = getPixel();
- if (_transparentColor)
- return pixel >= 0xf0;
- else
- return pixel < 0x10;
-}
-
} // End of namespace Titanic
diff --git a/engines/titanic/support/transparency_surface.h b/engines/titanic/support/transparency_surface.h
index 0970de4..6b726d6 100644
--- a/engines/titanic/support/transparency_surface.h
+++ b/engines/titanic/support/transparency_surface.h
@@ -46,7 +46,10 @@ private:
/**
* Returns a a pixel from the transparency surface
*/
- uint getPixel() const;
+ inline uint getPixel() const {
+ byte pixel = *(const byte *)_surface->getBasePtr(_pos.x, _pos.y);
+ return pixel;
+ }
public:
/**
* Constructor
@@ -56,32 +59,48 @@ public:
/**
* Sets the row to get transparencies from
*/
- void setRow(int yp) { _pos.y = yp; }
+ inline void setRow(int yp) { _pos.y = yp; }
/**
* Sets the column to get transparencies from
*/
- void setCol(int xp) { _pos.x = xp; }
+ inline void setCol(int xp) { _pos.x = xp; }
/**
* Moves reading position horizontally by a single pixel
*/
- int moveX();
+ inline int moveX() {
+ if (++_pos.x >= _surface->w) {
+ _pos.x = 0;
+ ++_pos.y;
+ }
+
+ return 1;
+ }
/**
* Returns the alpha value for the pixel (0-31)
*/
- uint getAlpha() const;
+ inline uint getAlpha() const {
+ byte pixel = getPixel();
+ return _opaqueColor ? 0xFF - pixel : pixel;
+ }
/**
* Returns true if the pixel is opaque
*/
- bool isPixelOpaque() const;
+ inline bool isPixelOpaque() const {
+ byte pixel = getPixel();
+ return _opaqueColor ? pixel >= 0xf0 : pixel < 0x10;
+ }
/**
* Returns true if the pixel is completely transparent
*/
- bool isPixelTransparent() const;
+ inline bool isPixelTransparent() const {
+ byte pixel = getPixel();
+ return _transparentColor ? pixel >= 0xf0 : pixel < 0x10;
+ }
};
} // End of namespace Titanic
More information about the Scummvm-git-logs
mailing list