[Scummvm-git-logs] scummvm master -> c4b5ec235a124e5be07543cf5390bbbdfa35c4be

Strangerke noreply at scummvm.org
Sat May 11 08:25:25 UTC 2024


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:
c4b5ec235a BAGEL: Some renaming in bitmap, remove unused methods


Commit: c4b5ec235a124e5be07543cf5390bbbdfa35c4be
    https://github.com/scummvm/scummvm/commit/c4b5ec235a124e5be07543cf5390bbbdfa35c4be
Author: Strangerke (arnaud.boutonne at gmail.com)
Date: 2024-05-11T09:25:18+01:00

Commit Message:
BAGEL: Some renaming in bitmap, remove unused methods

Changed paths:
    engines/bagel/boflib/gfx/bitmap.cpp
    engines/bagel/boflib/gfx/bitmap.h


diff --git a/engines/bagel/boflib/gfx/bitmap.cpp b/engines/bagel/boflib/gfx/bitmap.cpp
index ec6618a9d4b..97a120cf3eb 100644
--- a/engines/bagel/boflib/gfx/bitmap.cpp
+++ b/engines/bagel/boflib/gfx/bitmap.cpp
@@ -81,17 +81,17 @@ CBofBitmap::CBofBitmap(int dx, int dy, CBofPalette *pPalette, bool bOwnPalette,
 	}
 
 	// Fill the info structure
-	_cBitmapInfo.cInfoHeader.biSize = sizeof(BOFBITMAPINFOHEADER);
-	_cBitmapInfo.cInfoHeader.biWidth = dx;
-	_cBitmapInfo.cInfoHeader.biHeight = dy;
-	_cBitmapInfo.cInfoHeader.biPlanes = 1;
-	_cBitmapInfo.cInfoHeader.biBitCount = 8;
-	_cBitmapInfo.cInfoHeader.biCompression = 0;
-	_cBitmapInfo.cInfoHeader.biSizeImage = 0;
-	_cBitmapInfo.cInfoHeader.biXPelsPerMeter = 0;
-	_cBitmapInfo.cInfoHeader.biYPelsPerMeter = 0;
-	_cBitmapInfo.cInfoHeader.biClrUsed = 0;
-	_cBitmapInfo.cInfoHeader.biClrImportant = 0;
+	_cBitmapInfo._infoHeader._infoSize = sizeof(BOFBITMAPINFOHEADER);
+	_cBitmapInfo._infoHeader._width = dx;
+	_cBitmapInfo._infoHeader._height = dy;
+	_cBitmapInfo._infoHeader._planes = 1;
+	_cBitmapInfo._infoHeader._bitCount = 8;
+	_cBitmapInfo._infoHeader._compression = 0;
+	_cBitmapInfo._infoHeader._sizeImage = 0;
+	_cBitmapInfo._infoHeader._xPelsPerMeter = 0;
+	_cBitmapInfo._infoHeader._yPelsPerMeter = 0;
+	_cBitmapInfo._infoHeader._clrUsed = 0;
+	_cBitmapInfo._infoHeader._clrImportant = 0;
 
 	_pPalette = pPalette;
 	load();
@@ -104,7 +104,8 @@ CBofBitmap::CBofBitmap(const char *pszFileName, CBofPalette *pPalette, bool bOwn
 	_bInitialized = true;
 
 	if (pPalette == nullptr) {
-		if ((pPalette = new CBofPalette(pszFileName)) != nullptr) {
+		pPalette = new CBofPalette(pszFileName);
+		if (pPalette != nullptr) {
 			_bOwnPalette = true;
 		}
 	}
@@ -736,29 +737,6 @@ void CBofBitmap::circle(int xCenter, int yCenter, uint16 nRadius, byte iColor) {
 	}
 }
 
-void CBofBitmap::circle(CBofPoint *pCenter, uint16 nRadius, byte iColor) {
-	assert(isValidObject(this));
-
-	assert(pCenter != nullptr);
-
-	circle(pCenter->x, pCenter->y, nRadius, iColor);
-}
-
-void CBofBitmap::fillCircle(int x, int y, uint16 nRadius, byte iColor) {
-	assert(isValidObject(this));
-
-	circle(x, y, nRadius, iColor);
-
-	// Still need to fill it
-}
-
-void CBofBitmap::fillCircle(CBofPoint *pCenter, uint16 nRadius, byte iColor) {
-	assert(isValidObject(this));
-	assert(pCenter != nullptr);
-
-	fillCircle(pCenter->x, pCenter->y, nRadius, iColor);
-}
-
 void CBofBitmap::drawRect(CBofRect *pRect, byte iColor) {
 	assert(isValidObject(this));
 	assert(pRect != nullptr);
@@ -838,33 +816,6 @@ void CBofBitmap::line(CBofPoint *pSrc, CBofPoint *pDest, byte iColor) {
 	line(pSrc->x, pSrc->y, pDest->x, pDest->y, iColor);
 }
 
-CBofBitmap *CBofBitmap::extractBitmap(CBofRect *pRect) {
-	assert(isValidObject(this));
-	assert(pRect != nullptr);
-
-	CBofBitmap *pNewBmp = nullptr;
-
-	if (_errCode == ERR_NONE) {
-		CBofPalette *pPalette = getPalette();
-		if (pPalette != nullptr) {
-			if (_bOwnPalette) {
-				pPalette = pPalette->copyPalette();
-			}
-
-			if ((pNewBmp = new CBofBitmap(pRect->width(), pRect->height(), pPalette, _bOwnPalette)) != nullptr) {
-				paint(pNewBmp, 0, 0, pRect);
-			} else {
-				logFatal("Unable to allocate a new CBofBitmap");
-			}
-
-		} else {
-			logFatal("This bitmap does not have a valid palette");
-		}
-	}
-
-	return pNewBmp;
-}
-
 ErrorCode CBofBitmap::scrollRight(int nPixels, CBofRect * /*pRect*/) {
 	assert(isValidObject(this));
 
@@ -1216,39 +1167,6 @@ ErrorCode paintBitmap(CBofWindow *pWindow, const char *pszFileName, CBofRect *pD
 	return errCode;
 }
 
-ErrorCode paintBitmap(CBofBitmap *pBitmap, const char *pszFileName, CBofRect *pDstRect, CBofRect *pSrcRect, CBofPalette *pPalette, int nMaskColor) {
-	assert(pBitmap != nullptr);
-	assert(pszFileName != nullptr);
-
-	// Assume no error
-	ErrorCode errCode = ERR_NONE;
-	CBofBitmap *pBmp = new CBofBitmap(pszFileName, pPalette);
-	if (pBmp != nullptr) {
-
-		CBofRect cRect = pBmp->getRect();
-
-		if (pSrcRect == nullptr)
-			pSrcRect = &cRect;
-
-		if (pDstRect == nullptr)
-			pDstRect = &cRect;
-
-		errCode = pBmp->paint(pBitmap, pDstRect, pSrcRect, nMaskColor);
-
-		delete pBmp;
-
-	} else {
-		errCode = ERR_MEMORY;
-	}
-
-	return errCode;
-}
-
-void CBofBitmap::flipVerticalFast() {
-	_bTopDown = !_bTopDown;
-	_cBitmapInfo.cInfoHeader.biHeight = -_cBitmapInfo.cInfoHeader.biHeight;
-}
-
 Graphics::ManagedSurface CBofBitmap::getSurface() {
 	Graphics::ManagedSurface s;
 	s.w = _nDX;
diff --git a/engines/bagel/boflib/gfx/bitmap.h b/engines/bagel/boflib/gfx/bitmap.h
index 350591dc6e5..7c68f65d721 100644
--- a/engines/bagel/boflib/gfx/bitmap.h
+++ b/engines/bagel/boflib/gfx/bitmap.h
@@ -55,17 +55,17 @@ class CBofWindow;
 #include "common/pack-start.h" // START STRUCT PACKING
 
 struct bofBITMAPINFOHEADER {
-	uint32 biSize;
-	int32 biWidth;
-	int32 biHeight;
-	uint16 biPlanes;
-	uint16 biBitCount;
-	uint32 biCompression;
-	uint32 biSizeImage;
-	int32 biXPelsPerMeter;
-	int32 biYPelsPerMeter;
-	uint32 biClrUsed;
-	uint32 biClrImportant;
+	uint32 _infoSize;
+	int32 _width;
+	int32 _height;
+	uint16 _planes;
+	uint16 _bitCount;
+	uint32 _compression;
+	uint32 _sizeImage;
+	int32 _xPelsPerMeter;
+	int32 _yPelsPerMeter;
+	uint32 _clrUsed;
+	uint32 _clrImportant;
 } PACKED_STRUCT;
 typedef bofBITMAPINFOHEADER BOFBITMAPINFOHEADER;
 
@@ -76,18 +76,18 @@ struct bofBITMAPINFO {
 typedef bofBITMAPINFO BOFBITMAPINFO;
 
 struct bofBITMAPFILEHEADER {
-	uint16 bfType;
-	uint32 bfSize;
-	uint16 bfReserved1;
-	uint16 bfReserved2;
-	uint32 bfOffBits;
+	uint16 _fileType;
+	uint32 _fileSize;
+	uint16 _reserved1;
+	uint16 _reserved2;
+	uint32 _offBits;
 } PACKED_STRUCT;
 typedef bofBITMAPFILEHEADER BOFBITMAPFILEHEADER;
 
 struct bofBITMAP_EX {
-	BOFBITMAPFILEHEADER cFileHeader;
-	BOFBITMAPINFOHEADER cInfoHeader;
-	BOFRGBQUAD cRgbValues[256];
+	BOFBITMAPFILEHEADER _fileHeader;
+	BOFBITMAPINFOHEADER _infoHeader;
+	BOFRGBQUAD _rgbValues[256];
 } PACKED_STRUCT;
 typedef bofBITMAP_EX BITMAP_EX;
 
@@ -357,13 +357,6 @@ public:
 	 */
 	ErrorCode captureScreen(CBofWindow *pWnd, CBofRect *pSrcRect, CBofRect *pDstRect = nullptr);
 
-	/**
-	 * Creates a new bitmap based on a section of current bitmap
-	 * @param pRect     Section of bitmap to extract
-	 * @return          New bitmap
-	 */
-	CBofBitmap *extractBitmap(CBofRect *pRect);
-
 	/**
 	 * Performs a "Fade" onto the specified window
 	 * @param pWnd          Pointer to window to fade into
@@ -404,14 +397,6 @@ public:
 	 */
 	void circle(int x, int y, uint16 nRadius, byte iColor);
 
-	/**
-	 * Writes a circle into this bitmap
-	 * @param pCenter   Center position
-	 * @param nRadius   Radius of circle
-	 * @param iColor    Pixel value
-	 */
-	void circle(CBofPoint *pCenter, uint16 nRadius, byte iColor);
-
 	/**
 	 * Writes a line into this bitmap
 	 * @param nSrcX     Endpoint 1 x
@@ -430,23 +415,6 @@ public:
 	 */
 	void line(CBofPoint *pSrc, CBofPoint *pDest, byte iColor);
 
-	/**
-	 * Writes a filled circle into this bitmap
-	 * @param x         X center position
-	 * @param y         Y center position
-	 * @param nRadius   Radius of circle
-	 * @param iColor    Pixel value
-	 */
-	void fillCircle(int x, int y, uint16 nRadius, byte iColor);
-
-	/**
-	 * Writes a filled circle into this bitmap
-	 * @param pCenter   Center position
-	 * @param nRadius   Radius of circle
-	 * @param iColor    Pixel value
-	 */
-	void fillCircle(CBofPoint *pCenter, uint16 nRadius, byte iColor);
-
 	/**
 	 * Writes a Rectangle into this bitmap
 	 * @param cRect     Pointer to rectangle Coordinates
@@ -461,8 +429,6 @@ public:
 	 */
 	void fillRect(CBofRect *cRect, byte iColor);
 
-	void flipVerticalFast();
-
 	/**
 	 * Scrolls current bitmap horizontally
 	 * @param nPixels       Number of pixels to scroll by
@@ -525,19 +491,6 @@ extern CBofBitmap *loadBitmap(const char *pszFileName, CBofPalette *pPalette = n
 extern ErrorCode paintBitmap(CBofWindow *pWindow, const char *pszFileName, CBofRect *pDstRect = nullptr,
                               CBofRect *pSrcRect = nullptr, CBofPalette *pPalette = nullptr, int nMaskColor = NOT_TRANSPARENT);
 
-/**
- * Paints specified bitmap to specified bitmap
- * @param pBmp              Bitmap to paint to
- * @param pszFileName       Bitmap filename
- * @param pDstRect          Destination area to paint to
- * @param pSrcRect          Source area to paint from
- * @param pPalette          Optional palette to re-map with
- * @param nMaskColor        Optional transparent color
- * @return                  Error return code
- */
-extern ErrorCode paintBitmap(CBofBitmap *pBmp, const char *pszFileName, CBofRect *pDstRect = nullptr,
-                              CBofRect *pSrcRect = nullptr, CBofPalette *pPalette = nullptr, int nMaskColor = NOT_TRANSPARENT);
-
 } // namespace Bagel
 
 #endif




More information about the Scummvm-git-logs mailing list