Move code for discarding drawable to separate procedure

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
Yuri Benditovich 2017-04-16 22:43:01 +03:00 committed by Frediano Ziglio
parent 6041c81484
commit 42a911e2e9
2 changed files with 15 additions and 7 deletions

View File

@ -4500,6 +4500,19 @@ BOOLEAN QxlDevice::AttachNewBitmap(QXLDrawable *drawable, UINT8 *src, UINT8 *src
return TRUE;
}
void QxlDevice::DiscardDrawable(QXLDrawable *drawable)
{
PAGED_CODE();
PLIST_ENTRY pDelayedList = DelayedList(drawable);
// if some delayed chunks were allocated, free them
while (!IsListEmpty(pDelayedList)) {
DelayedChunk *pdc = (DelayedChunk *)RemoveHeadList(pDelayedList);
delete[] reinterpret_cast<BYTE*>(pdc);
}
ReleaseOutput(drawable->release_info.id);
DbgPrint(TRACE_LEVEL_WARNING, ("%s\n", __FUNCTION__));
}
QXLDrawable *QxlDevice::PrepareBltBits (
BLT_INFO* pDst,
CONST BLT_INFO* pSrc,
@ -4549,13 +4562,7 @@ QXLDrawable *QxlDevice::PrepareBltBits (
src += pSrc->Pitch * (height - 1);
if (!AttachNewBitmap(drawable, src, src_end, (INT)pSrc->Pitch, !g_bSupportVSync)) {
PLIST_ENTRY pDelayedList = DelayedList(drawable);
// if some delayed chunks were allocated, free them
while (!IsListEmpty(pDelayedList)) {
DelayedChunk *pdc = (DelayedChunk *)RemoveHeadList(pDelayedList);
delete[] reinterpret_cast<BYTE*>(pdc);
}
ReleaseOutput(drawable->release_info.id);
DiscardDrawable(drawable);
drawable = NULL;
} else {
DbgPrint(TRACE_LEVEL_INFORMATION, ("%s drawable= %p type = %d, effect = %d Dest right(%d) left(%d) top(%d) bottom(%d) src_bitmap= %p.\n", __FUNCTION__,

View File

@ -603,6 +603,7 @@ private:
void WaitForCursorRing(void);
void PushCursor(void);
BOOLEAN AttachNewBitmap(QXLDrawable *drawable, UINT8 *src, UINT8 *src_end, INT pitch, BOOLEAN bForce);
void DiscardDrawable(QXLDrawable *drawable);
BOOLEAN PutBytesAlign(QXLDataChunk **chunk_ptr, UINT8 **now_ptr,
UINT8 **end_ptr, UINT8 *src, int size,
size_t alloc_size, PLIST_ENTRY pDelayed);