From 42a911e2e9b1ac3c2d410f06a3987437c9ab9ad7 Mon Sep 17 00:00:00 2001 From: Yuri Benditovich Date: Sun, 16 Apr 2017 22:43:01 +0300 Subject: [PATCH] Move code for discarding drawable to separate procedure Signed-off-by: Yuri Benditovich Acked-by: Frediano Ziglio --- qxldod/QxlDod.cpp | 21 ++++++++++++++------- qxldod/QxlDod.h | 1 + 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/qxldod/QxlDod.cpp b/qxldod/QxlDod.cpp index 1953688..5ee54f5 100755 --- a/qxldod/QxlDod.cpp +++ b/qxldod/QxlDod.cpp @@ -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(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(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__, diff --git a/qxldod/QxlDod.h b/qxldod/QxlDod.h index e865032..b524577 100755 --- a/qxldod/QxlDod.h +++ b/qxldod/QxlDod.h @@ -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);