Skip to content

Commit

Permalink
tiles_generic: add BurnTransferRealloc
Browse files Browse the repository at this point in the history
sometimes you just want to realloc a ptr
  • Loading branch information
barbudreadmon committed Dec 9, 2023
1 parent 93808b3 commit c2e36ff
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/burn/tiles_generic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ void BurnTransferFlip(INT32 bFlipX, INT32 bFlipY)
}
}

void BurnTransferRealloc()
{
pTransDraw = (UINT16 *)BurnRealloc(pTransDraw, nTransWidth * (nTransHeight + nTransOverflow) * sizeof(UINT16));
pPrioDraw = (UINT8 *)BurnRealloc(pPrioDraw, nTransWidth * (nTransHeight + nTransOverflow));
}

/*================================================================================================
Graphics Decoding
================================================================================================*/
Expand Down
1 change: 1 addition & 0 deletions src/burn/tiles_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -260,3 +260,4 @@ void BurnTransferExit();
INT32 BurnTransferInit();
void BurnTransferSetDimensions(INT32 nWidth, INT32 nHeight); // Use extreme caution!
void BurnTransferFlip(INT32 bFlipX, INT32 bFlipY);
void BurnTransferRealloc();
12 changes: 8 additions & 4 deletions src/burn/vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,17 @@ void vector_set_scale(INT32 x, INT32 y)

void vector_rescale(INT32 x, INT32 y)
{
if(BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL)
if(BurnDrvGetFlags() & BDF_ORIENTATION_VERTICAL) {
GenericTilesSetClipRaw(0, y, 0, x);
BurnTransferSetDimensions(y, x);
BurnDrvSetVisibleSize(y, x);
else
} else {
GenericTilesSetClipRaw(0, x, 0, y);
BurnTransferSetDimensions(x, y);
BurnDrvSetVisibleSize(x, y);
}
Reinitialise();
GenericTilesExit();
GenericTilesInit(); // create pTransDraw w/ new size
BurnTransferRealloc();
BurnFree(pBitmap);
pBitmap = (UINT32*)BurnMalloc(nScreenWidth * nScreenHeight * sizeof(INT32));

Expand Down

0 comments on commit c2e36ff

Please sign in to comment.