mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-20 00:41:12 +00:00
SCI/newgui: kDisplay restoreUnder completed
svn-id: r45202
This commit is contained in:
parent
d807d259b9
commit
0af29fa746
@ -223,10 +223,10 @@ void SciGui::display(const char *text, int argc, reg_t *argv) {
|
||||
doSaveUnder = true;
|
||||
break;
|
||||
case SCI_DISPLAY_RESTOREUNDER:
|
||||
// TODO: get rect from SciMemoryHandle (argv[0])
|
||||
//rect.translate(-_gfx->GetPort()->left, -_gfx->GetPort()->top);
|
||||
_gfx->BitsGetRect(argv[0], &rect);
|
||||
rect.translate(-_gfx->GetPort()->left, -_gfx->GetPort()->top);
|
||||
_gfx->BitsRestore(argv[0]);
|
||||
// TODO: ReAnimate(pArgs)
|
||||
_animate->reAnimate(rect);
|
||||
// finishing loop
|
||||
argc = 0;
|
||||
break;
|
||||
|
@ -588,15 +588,14 @@ void SciGuiGfx::TextBox(const char *text, int16 bshow, const Common::Rect &rect,
|
||||
PenColor(orgPenColor);
|
||||
}
|
||||
|
||||
// Update (part of) screen
|
||||
void SciGuiGfx::BitsShow(const Common::Rect &r) {
|
||||
Common::Rect rect(r.left, r.top, r.right, r.bottom);
|
||||
rect.clip(_curPort->rect);
|
||||
if (rect.isEmpty()) // nothing to show
|
||||
void SciGuiGfx::BitsShow(const Common::Rect &rect) {
|
||||
Common::Rect workerRect(rect.left, rect.top, rect.right, rect.bottom);
|
||||
workerRect.clip(_curPort->rect);
|
||||
if (workerRect.isEmpty()) // nothing to show
|
||||
return;
|
||||
|
||||
OffsetRect(rect);
|
||||
_screen->copyRectToScreen(rect);
|
||||
OffsetRect(workerRect);
|
||||
_screen->copyRectToScreen(workerRect);
|
||||
}
|
||||
|
||||
GuiMemoryHandle SciGuiGfx::BitsSave(const Common::Rect &rect, byte screenMask) {
|
||||
@ -604,22 +603,34 @@ GuiMemoryHandle SciGuiGfx::BitsSave(const Common::Rect &rect, byte screenMask) {
|
||||
byte *memoryPtr;
|
||||
int size;
|
||||
|
||||
Common::Rect r(rect.left, rect.top, rect.right, rect.bottom);
|
||||
r.clip(_curPort->rect);
|
||||
if (r.isEmpty()) // nothing to save
|
||||
Common::Rect workerRect(rect.left, rect.top, rect.right, rect.bottom);
|
||||
workerRect.clip(_curPort->rect);
|
||||
if (workerRect.isEmpty()) // nothing to save
|
||||
return NULL_REG;
|
||||
|
||||
OffsetRect(r); //local port coords to screen coords
|
||||
OffsetRect(workerRect);
|
||||
|
||||
// now actually ask _screen how much space it will need for saving
|
||||
size = _screen->getBitsDataSize(r, screenMask);
|
||||
size = _screen->bitsGetDataSize(workerRect, screenMask);
|
||||
|
||||
memoryId = kalloc(_s->_segMan, "SaveBits()", size);
|
||||
memoryPtr = kmem(_s->_segMan, memoryId);
|
||||
_screen->saveBits(r, screenMask, memoryPtr);
|
||||
_screen->bitsSave(workerRect, screenMask, memoryPtr);
|
||||
return memoryId;
|
||||
}
|
||||
|
||||
void SciGuiGfx::BitsGetRect(GuiMemoryHandle memoryHandle, Common::Rect *destRect) {
|
||||
byte *memoryPtr = NULL;
|
||||
|
||||
if (!memoryHandle.isNull()) {
|
||||
memoryPtr = kmem(_s->_segMan, memoryHandle);;
|
||||
|
||||
if (memoryPtr) {
|
||||
_screen->bitsGetRect(memoryPtr, destRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void SciGuiGfx::BitsRestore(GuiMemoryHandle memoryHandle) {
|
||||
byte *memoryPtr = NULL;
|
||||
|
||||
@ -627,7 +638,7 @@ void SciGuiGfx::BitsRestore(GuiMemoryHandle memoryHandle) {
|
||||
memoryPtr = kmem(_s->_segMan, memoryHandle);;
|
||||
|
||||
if (memoryPtr) {
|
||||
_screen->restoreBits(memoryPtr);
|
||||
_screen->bitsRestore(memoryPtr);
|
||||
kfree(_s->_segMan, memoryHandle);
|
||||
}
|
||||
}
|
||||
|
@ -90,6 +90,7 @@ public:
|
||||
void TextBox(const char *str, int16 bshow, const Common::Rect &rect, int16 align, GuiResourceId fontId);
|
||||
void BitsShow(const Common::Rect &r);
|
||||
GuiMemoryHandle BitsSave(const Common::Rect &rect, byte screenFlags);
|
||||
void BitsGetRect(GuiMemoryHandle memoryHandle, Common::Rect *destRect);
|
||||
void BitsRestore(GuiMemoryHandle memoryHandle);
|
||||
void BitsFree(GuiMemoryHandle memoryHandle);
|
||||
|
||||
|
@ -194,7 +194,7 @@ byte SciGuiScreen::isFillMatch(int16 x, int16 y, byte screenMask, byte t_color,
|
||||
return match;
|
||||
}
|
||||
|
||||
int SciGuiScreen::getBitsDataSize(Common::Rect rect, byte mask) {
|
||||
int SciGuiScreen::bitsGetDataSize(Common::Rect rect, byte mask) {
|
||||
int byteCount = sizeof(rect) + sizeof(mask);
|
||||
int pixels = rect.width() * rect.height();
|
||||
if (mask & SCI_SCREEN_MASK_VISUAL) {
|
||||
@ -211,23 +211,23 @@ int SciGuiScreen::getBitsDataSize(Common::Rect rect, byte mask) {
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
void SciGuiScreen::saveBits(Common::Rect rect, byte mask, byte *memoryPtr) {
|
||||
void SciGuiScreen::bitsSave(Common::Rect rect, byte mask, byte *memoryPtr) {
|
||||
memcpy(memoryPtr, (void *)&rect, sizeof(rect)); memoryPtr += sizeof(rect);
|
||||
memcpy(memoryPtr, (void *)&mask, sizeof(mask)); memoryPtr += sizeof(mask);
|
||||
|
||||
if (mask & SCI_SCREEN_MASK_VISUAL) {
|
||||
saveBitsScreen(rect, _visualScreen, memoryPtr);
|
||||
saveBitsScreen(rect, _displayScreen, memoryPtr);
|
||||
bitsSaveScreen(rect, _visualScreen, memoryPtr);
|
||||
bitsSaveScreen(rect, _displayScreen, memoryPtr);
|
||||
}
|
||||
if (mask & SCI_SCREEN_MASK_PRIORITY) {
|
||||
saveBitsScreen(rect, _priorityScreen, memoryPtr);
|
||||
bitsSaveScreen(rect, _priorityScreen, memoryPtr);
|
||||
}
|
||||
if (mask & SCI_SCREEN_MASK_CONTROL) {
|
||||
saveBitsScreen(rect, _controlScreen, memoryPtr);
|
||||
bitsSaveScreen(rect, _controlScreen, memoryPtr);
|
||||
}
|
||||
}
|
||||
|
||||
void SciGuiScreen::saveBitsScreen(Common::Rect rect, byte *screen, byte *&memoryPtr) {
|
||||
void SciGuiScreen::bitsSaveScreen(Common::Rect rect, byte *screen, byte *&memoryPtr) {
|
||||
int width = rect.width();
|
||||
int y;
|
||||
|
||||
@ -239,7 +239,11 @@ void SciGuiScreen::saveBitsScreen(Common::Rect rect, byte *screen, byte *&memory
|
||||
}
|
||||
}
|
||||
|
||||
void SciGuiScreen::restoreBits(byte *memoryPtr) {
|
||||
void SciGuiScreen::bitsGetRect(byte *memoryPtr, Common::Rect *destRect) {
|
||||
memcpy((void *)destRect, memoryPtr, sizeof(Common::Rect));
|
||||
}
|
||||
|
||||
void SciGuiScreen::bitsRestore(byte *memoryPtr) {
|
||||
Common::Rect rect;
|
||||
byte mask;
|
||||
|
||||
@ -247,18 +251,18 @@ void SciGuiScreen::restoreBits(byte *memoryPtr) {
|
||||
memcpy((void *)&mask, memoryPtr, sizeof(mask)); memoryPtr += sizeof(mask);
|
||||
|
||||
if (mask & SCI_SCREEN_MASK_VISUAL) {
|
||||
restoreBitsScreen(rect, memoryPtr, _visualScreen);
|
||||
restoreBitsScreen(rect, memoryPtr, _displayScreen);
|
||||
bitsRestoreScreen(rect, memoryPtr, _visualScreen);
|
||||
bitsRestoreScreen(rect, memoryPtr, _displayScreen);
|
||||
}
|
||||
if (mask & SCI_SCREEN_MASK_PRIORITY) {
|
||||
restoreBitsScreen(rect, memoryPtr, _priorityScreen);
|
||||
bitsRestoreScreen(rect, memoryPtr, _priorityScreen);
|
||||
}
|
||||
if (mask & SCI_SCREEN_MASK_CONTROL) {
|
||||
restoreBitsScreen(rect, memoryPtr, _controlScreen);
|
||||
bitsRestoreScreen(rect, memoryPtr, _controlScreen);
|
||||
}
|
||||
}
|
||||
|
||||
void SciGuiScreen::restoreBitsScreen(Common::Rect rect, byte *&memoryPtr, byte *screen) {
|
||||
void SciGuiScreen::bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen) {
|
||||
int width = rect.width();
|
||||
int y;
|
||||
|
||||
|
@ -61,9 +61,10 @@ public:
|
||||
byte getControl(int x, int y);
|
||||
byte isFillMatch(int16 x, int16 y, byte drawMask, byte t_color, byte t_pri, byte t_con);
|
||||
|
||||
int getBitsDataSize(Common::Rect rect, byte mask);
|
||||
void saveBits(Common::Rect rect, byte mask, byte *memoryPtr);
|
||||
void restoreBits(byte *memoryPtr);
|
||||
int bitsGetDataSize(Common::Rect rect, byte mask);
|
||||
void bitsSave(Common::Rect rect, byte mask, byte *memoryPtr);
|
||||
void bitsGetRect(byte *memoryPtr, Common::Rect *destRect);
|
||||
void bitsRestore(byte *memoryPtr);
|
||||
|
||||
void setPalette(GuiPalette*pal);
|
||||
|
||||
@ -85,8 +86,8 @@ public:
|
||||
int _picNotValid; // possible values 0, 1 and 2
|
||||
|
||||
private:
|
||||
void restoreBitsScreen(Common::Rect rect, byte *&memoryPtr, byte *screen);
|
||||
void saveBitsScreen(Common::Rect rect, byte *screen, byte *&memoryPtr);
|
||||
void bitsRestoreScreen(Common::Rect rect, byte *&memoryPtr, byte *screen);
|
||||
void bitsSaveScreen(Common::Rect rect, byte *screen, byte *&memoryPtr);
|
||||
|
||||
bool _unditherState;
|
||||
int16 _unditherMemorial[SCI_SCREEN_UNDITHERMEMORIAL_SIZE];
|
||||
|
Loading…
Reference in New Issue
Block a user