Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
askmeaboutlo0m committed Sep 6, 2023
1 parent abaf31f commit 4a5f0f6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 7 additions & 1 deletion src/drawdance/libengine/dpengine/draw_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,14 @@ DP_DrawContext *DP_draw_context_new(void)
DP_DrawContext *dc = DP_malloc_simd(sizeof(*dc));
dc->pool_size = 0;
dc->pool = NULL;
DP_warn("Allocate draw context %p", (void *)dc);
return dc;
}

void DP_draw_context_free(DP_DrawContext *dc)
{
if (dc) {
DP_warn("Free draw context %p", (void *)dc);
DP_free(dc->pool);
DP_free_simd(dc);
}
Expand Down Expand Up @@ -203,8 +205,12 @@ unsigned char *DP_draw_context_raster_pool_resize(DP_DrawContext *dc,
{
DP_ASSERT(dc);
DP_ASSERT(new_size > dc->pool_size);
DP_ASSERT(new_size < DP_DRAW_CONTEXT_RASTER_POOL_MAX_SIZE);
DP_ASSERT(new_size <= DP_DRAW_CONTEXT_RASTER_POOL_MAX_SIZE);
DP_ASSERT(dc->pool);
DP_warn("Raster pool resize form %zu to %zu (min %zu/max %zu)",
dc->pool_size, new_size,
(size_t)DP_DRAW_CONTEXT_RASTER_POOL_MIN_SIZE,
(size_t)DP_DRAW_CONTEXT_RASTER_POOL_MAX_SIZE);
DP_free(dc->pool);
void *new_raster_pool = DP_malloc(new_size);
dc->pool = new_raster_pool;
Expand Down
1 change: 1 addition & 0 deletions src/drawdance/libengine/dpengine/preview.c
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ static bool preview_transform_prepare_image(DP_PreviewTransform *pvtf,
pvtf->pixels.dispose = NULL;

if (img) {
DP_warn("Transformed onl layer %d", pvtf->target_layer_id);
pvtf->img = img;
return true;
}
Expand Down
7 changes: 4 additions & 3 deletions src/libclient/drawdance/global.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ DrawContext DrawContextPool::acquireContext()
DP_DrawContext *dc;
if(m_available.isEmpty()) {
dc = DP_draw_context_new();
m_contexts.append(dc);
// m_contexts.append(dc);
} else {
dc = m_available.pop();
}
Expand All @@ -141,8 +141,9 @@ DrawContext DrawContextPool::acquireContext()
void DrawContextPool::releaseContext(DP_DrawContext *dc)
{
Q_ASSERT(dc);
QMutexLocker locker{&m_mutex};
m_available.push(dc);
// QMutexLocker locker{&m_mutex};
// m_available.push(dc);
DP_draw_context_free(dc);
}

DrawContextPoolStatistics DrawContextPool::instanceStatistics()
Expand Down

0 comments on commit 4a5f0f6

Please sign in to comment.