mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-23 20:30:15 +00:00
gsk: Stop using g_slice
This commit is contained in:
parent
98ff6c0d4d
commit
9f88dba162
@ -619,7 +619,7 @@ gsk_gl_driver_after_frame (GskGLDriver *self)
|
||||
|
||||
gsk_gl_driver_autorelease_framebuffer (self, render_target->framebuffer_id);
|
||||
gsk_gl_driver_autorelease_texture (self, render_target->texture_id);
|
||||
g_slice_free (GskGLRenderTarget, render_target);
|
||||
g_free (render_target);
|
||||
|
||||
self->render_targets->len--;
|
||||
}
|
||||
@ -935,7 +935,7 @@ gsk_gl_driver_create_render_target (GskGLDriver *self,
|
||||
{
|
||||
GskGLRenderTarget *render_target;
|
||||
|
||||
render_target = g_slice_new0 (GskGLRenderTarget);
|
||||
render_target = g_new0 (GskGLRenderTarget, 1);
|
||||
render_target->min_filter = min_filter;
|
||||
render_target->mag_filter = mag_filter;
|
||||
render_target->format = format;
|
||||
@ -1007,7 +1007,7 @@ gsk_gl_driver_release_render_target (GskGLDriver *self,
|
||||
g_steal_pointer (&texture));
|
||||
|
||||
gsk_gl_driver_autorelease_framebuffer (self, render_target->framebuffer_id);
|
||||
g_slice_free (GskGLRenderTarget, render_target);
|
||||
g_free (render_target);
|
||||
|
||||
}
|
||||
|
||||
@ -1341,7 +1341,7 @@ create_texture_from_texture_destroy (gpointer data)
|
||||
gdk_gl_context_make_current (state->context);
|
||||
glDeleteTextures (1, &state->texture_id);
|
||||
g_clear_object (&state->context);
|
||||
g_slice_free (GskGLTextureState, state);
|
||||
g_free (state);
|
||||
}
|
||||
|
||||
GdkTexture *
|
||||
@ -1362,7 +1362,7 @@ gsk_gl_driver_create_gdk_texture (GskGLDriver *self,
|
||||
if (!(texture = g_hash_table_lookup (self->textures, GUINT_TO_POINTER (texture_id))))
|
||||
g_return_val_if_reached (NULL);
|
||||
|
||||
state = g_slice_new0 (GskGLTextureState);
|
||||
state = g_new0 (GskGLTextureState, 1);
|
||||
state->texture_id = texture_id;
|
||||
state->context = g_object_ref (self->command_queue->context);
|
||||
|
||||
|
@ -74,13 +74,13 @@ gsk_gl_glyph_key_free (gpointer data)
|
||||
GskGLGlyphKey *key = data;
|
||||
|
||||
g_clear_object (&key->font);
|
||||
g_slice_free (GskGLGlyphKey, key);
|
||||
g_free (key);
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_glyph_value_free (gpointer data)
|
||||
{
|
||||
g_slice_free (GskGLGlyphValue, data);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -88,7 +88,9 @@ gsk_gl_glyph_library_lookup_or_add (GskGLGlyphLibrary *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
GskGLGlyphKey *k = g_slice_copy (sizeof *key, key);
|
||||
GskGLGlyphKey *k;
|
||||
k = g_new (GskGLGlyphKey, 1);
|
||||
memcpy (k, key, sizeof (GskGLGlyphKey));
|
||||
g_object_ref (k->font);
|
||||
gsk_gl_glyph_library_add (self, k, out_value);
|
||||
self->front[front_index].key = *key;
|
||||
|
@ -52,7 +52,7 @@ gsk_gl_icon_data_free (gpointer data)
|
||||
GskGLIconData *icon_data = data;
|
||||
|
||||
g_clear_object (&icon_data->source_texture);
|
||||
g_slice_free (GskGLIconData, icon_data);
|
||||
g_free (icon_data);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -4374,7 +4374,7 @@ gsk_gl_render_job_new (GskGLDriver *driver,
|
||||
if (framebuffer == 0 && default_framebuffer != 0)
|
||||
framebuffer = default_framebuffer;
|
||||
|
||||
job = g_slice_new0 (GskGLRenderJob);
|
||||
job = g_new0 (GskGLRenderJob, 1);
|
||||
job->driver = g_object_ref (driver);
|
||||
job->command_queue = job->driver->command_queue;
|
||||
job->clip = g_array_sized_new (FALSE, FALSE, sizeof (GskGLRenderClip), 16);
|
||||
@ -4439,5 +4439,5 @@ gsk_gl_render_job_free (GskGLRenderJob *job)
|
||||
g_clear_pointer (&job->region, cairo_region_destroy);
|
||||
g_clear_pointer (&job->modelview, g_array_unref);
|
||||
g_clear_pointer (&job->clip, g_array_unref);
|
||||
g_slice_free (GskGLRenderJob, job);
|
||||
g_free (job);
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ gsk_gl_texture_free (GskGLTexture *texture)
|
||||
g_clear_pointer (&texture->slices, g_free);
|
||||
g_clear_pointer (&texture->nine_slice, g_free);
|
||||
|
||||
g_slice_free (GskGLTexture, texture);
|
||||
g_free (texture);
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,7 +66,7 @@ gsk_gl_texture_new (guint texture_id,
|
||||
{
|
||||
GskGLTexture *texture;
|
||||
|
||||
texture = g_slice_new0 (GskGLTexture);
|
||||
texture = g_new0 (GskGLTexture, 1);
|
||||
texture->texture_id = texture_id;
|
||||
texture->link.data = texture;
|
||||
texture->min_filter = min_filter;
|
||||
|
@ -52,7 +52,7 @@ gsk_gl_texture_atlas_free (GskGLTextureAtlas *atlas)
|
||||
}
|
||||
|
||||
g_clear_pointer (&atlas->nodes, g_free);
|
||||
g_slice_free (GskGLTextureAtlas, atlas);
|
||||
g_free (atlas);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@ -388,7 +388,7 @@ gsk_gl_texture_library_pack (GskGLTextureLibrary *self,
|
||||
g_assert (out_packed_x != NULL);
|
||||
g_assert (out_packed_y != NULL);
|
||||
|
||||
entry = g_slice_alloc0 (valuelen);
|
||||
entry = g_malloc0 (valuelen);
|
||||
entry->n_pixels = width * height;
|
||||
entry->accessed = TRUE;
|
||||
entry->used = TRUE;
|
||||
@ -542,7 +542,7 @@ gsk_gl_texture_library_acquire_atlas (GskGLTextureLibrary *self)
|
||||
g_return_val_if_fail (self->atlas_width > 0, NULL);
|
||||
g_return_val_if_fail (self->atlas_height > 0, NULL);
|
||||
|
||||
atlas = g_slice_new0 (GskGLTextureAtlas);
|
||||
atlas = g_new0 (GskGLTextureAtlas, 1);
|
||||
atlas->width = self->atlas_width;
|
||||
atlas->height = self->atlas_height;
|
||||
/* TODO: We might want to change the strategy about the amount of
|
||||
|
@ -53,7 +53,7 @@ gsk_diff_settings_new (GCompareDataFunc compare_func,
|
||||
{
|
||||
GskDiffSettings *settings;
|
||||
|
||||
settings = g_slice_new0 (GskDiffSettings);
|
||||
settings = g_new0 (GskDiffSettings, 1);
|
||||
|
||||
settings->compare_func = compare_func;
|
||||
settings->keep_func = keep_func;
|
||||
@ -73,7 +73,7 @@ gsk_diff_settings_set_allow_abort (GskDiffSettings *settings,
|
||||
void
|
||||
gsk_diff_settings_free (GskDiffSettings *settings)
|
||||
{
|
||||
g_slice_free (GskDiffSettings, settings);
|
||||
g_free (settings);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -53,8 +53,7 @@ named_counter_free (gpointer data)
|
||||
return;
|
||||
|
||||
g_free (counter->description);
|
||||
|
||||
g_slice_free (NamedCounter, counter);
|
||||
g_free (counter);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -66,8 +65,7 @@ named_timer_free (gpointer data)
|
||||
return;
|
||||
|
||||
g_free (timer->description);
|
||||
|
||||
g_slice_free (NamedTimer, timer);
|
||||
g_free (timer);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -109,7 +107,7 @@ named_counter_new (GQuark id,
|
||||
const char *description,
|
||||
gboolean can_reset)
|
||||
{
|
||||
NamedCounter *res = g_slice_new0 (NamedCounter);
|
||||
NamedCounter *res = g_new0 (NamedCounter, 1);
|
||||
|
||||
res->id = id;
|
||||
res->description = g_strdup (description);
|
||||
@ -156,7 +154,7 @@ named_timer_new (GQuark id,
|
||||
gboolean invert,
|
||||
gboolean can_reset)
|
||||
{
|
||||
NamedTimer *res = g_slice_new0 (NamedTimer);
|
||||
NamedTimer *res = g_new0 (NamedTimer, 1);
|
||||
|
||||
res->id = id;
|
||||
res->description = g_strdup (description);
|
||||
|
@ -23,7 +23,7 @@ gsk_vulkan_buffer_new_internal (GdkVulkanContext *context,
|
||||
VkMemoryRequirements requirements;
|
||||
GskVulkanBuffer *self;
|
||||
|
||||
self = g_slice_new0 (GskVulkanBuffer);
|
||||
self = g_new0 (GskVulkanBuffer, 1);
|
||||
|
||||
self->vulkan = g_object_ref (context);
|
||||
self->size = size;
|
||||
@ -88,7 +88,7 @@ gsk_vulkan_buffer_free (GskVulkanBuffer *self)
|
||||
|
||||
g_object_unref (self->vulkan);
|
||||
|
||||
g_slice_free (GskVulkanBuffer, self);
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
VkBuffer
|
||||
|
@ -16,7 +16,7 @@ gsk_vulkan_command_pool_new (GdkVulkanContext *context)
|
||||
{
|
||||
GskVulkanCommandPool *self;
|
||||
|
||||
self = g_slice_new0 (GskVulkanCommandPool);
|
||||
self = g_new0 (GskVulkanCommandPool, 1);
|
||||
|
||||
self->vulkan = g_object_ref (context);
|
||||
|
||||
@ -56,7 +56,7 @@ gsk_vulkan_command_pool_free (GskVulkanCommandPool *self)
|
||||
self->vk_command_pool,
|
||||
NULL);
|
||||
|
||||
g_slice_free (GskVulkanCommandPool, self);
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -49,7 +49,7 @@ gsk_vulkan_uploader_new (GdkVulkanContext *context,
|
||||
{
|
||||
GskVulkanUploader *self;
|
||||
|
||||
self = g_slice_new0 (GskVulkanUploader);
|
||||
self = g_new0 (GskVulkanUploader, 1);
|
||||
|
||||
self->vulkan = g_object_ref (context);
|
||||
self->command_pool = command_pool;
|
||||
@ -75,7 +75,7 @@ gsk_vulkan_uploader_free (GskVulkanUploader *self)
|
||||
|
||||
g_object_unref (self->vulkan);
|
||||
|
||||
g_slice_free (GskVulkanUploader, self);
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -22,7 +22,7 @@ gsk_vulkan_memory_new (GdkVulkanContext *context,
|
||||
GskVulkanMemory *self;
|
||||
uint32_t i;
|
||||
|
||||
self = g_slice_new0 (GskVulkanMemory);
|
||||
self = g_new0 (GskVulkanMemory, 1);
|
||||
|
||||
self->vulkan = g_object_ref (context);
|
||||
self->size = size;
|
||||
@ -62,7 +62,7 @@ gsk_vulkan_memory_free (GskVulkanMemory *self)
|
||||
|
||||
g_object_unref (self->vulkan);
|
||||
|
||||
g_slice_free (GskVulkanMemory, self);
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
VkDeviceMemory
|
||||
|
@ -113,7 +113,7 @@ gsk_vulkan_render_new (GskRenderer *renderer,
|
||||
GskVulkanRender *self;
|
||||
VkDevice device;
|
||||
|
||||
self = g_slice_new0 (GskVulkanRender);
|
||||
self = g_new0 (GskVulkanRender, 1);
|
||||
|
||||
self->vulkan = context;
|
||||
self->renderer = renderer;
|
||||
@ -281,7 +281,7 @@ gsk_vulkan_render_remove_framebuffer_from_image (gpointer data,
|
||||
fb->framebuffer,
|
||||
NULL);
|
||||
|
||||
g_slice_free (HashFramebufferEntry, fb);
|
||||
g_free (fb);
|
||||
}
|
||||
|
||||
VkFramebuffer
|
||||
@ -294,7 +294,7 @@ gsk_vulkan_render_get_framebuffer (GskVulkanRender *self,
|
||||
if (fb)
|
||||
return fb->framebuffer;
|
||||
|
||||
fb = g_slice_new0 (HashFramebufferEntry);
|
||||
fb = g_new0 (HashFramebufferEntry, 1);
|
||||
GSK_VK_CHECK (vkCreateFramebuffer, gdk_vulkan_context_get_device (self->vulkan),
|
||||
&(VkFramebufferCreateInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO,
|
||||
@ -705,7 +705,7 @@ gsk_vulkan_render_free (GskVulkanRender *self)
|
||||
vkDestroyFramebuffer (gdk_vulkan_context_get_device (self->vulkan),
|
||||
fb->framebuffer,
|
||||
NULL);
|
||||
g_slice_free (HashFramebufferEntry, fb);
|
||||
g_free (fb);
|
||||
g_object_weak_unref (G_OBJECT (key), gsk_vulkan_render_remove_framebuffer_from_image, self);
|
||||
g_hash_table_iter_remove (&iter);
|
||||
}
|
||||
@ -749,7 +749,7 @@ gsk_vulkan_render_free (GskVulkanRender *self)
|
||||
|
||||
gsk_vulkan_command_pool_free (self->command_pool);
|
||||
|
||||
g_slice_free (GskVulkanRender, self);
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -326,7 +326,7 @@ gsk_vulkan_renderer_clear_texture (gpointer p)
|
||||
|
||||
g_object_unref (data->image);
|
||||
|
||||
g_slice_free (GskVulkanTextureData, data);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
GskVulkanImage *
|
||||
@ -350,7 +350,7 @@ gsk_vulkan_renderer_ref_texture_image (GskVulkanRenderer *self,
|
||||
cairo_image_surface_get_stride (surface));
|
||||
cairo_surface_destroy (surface);
|
||||
|
||||
data = g_slice_new0 (GskVulkanTextureData);
|
||||
data = g_new0 (GskVulkanTextureData, 1);
|
||||
data->image = image;
|
||||
data->texture = texture;
|
||||
data->renderer = self;
|
||||
@ -362,7 +362,7 @@ gsk_vulkan_renderer_ref_texture_image (GskVulkanRenderer *self,
|
||||
}
|
||||
else
|
||||
{
|
||||
g_slice_free (GskVulkanTextureData, data);
|
||||
g_free (data);
|
||||
}
|
||||
|
||||
return image;
|
||||
|
@ -140,7 +140,7 @@ gsk_vulkan_render_pass_new (GdkVulkanContext *context,
|
||||
GskVulkanRenderPass *self;
|
||||
VkImageLayout final_layout;
|
||||
|
||||
self = g_slice_new0 (GskVulkanRenderPass);
|
||||
self = g_new0 (GskVulkanRenderPass, 1);
|
||||
self->vulkan = g_object_ref (context);
|
||||
self->render_ops = g_array_new (FALSE, FALSE, sizeof (GskVulkanOp));
|
||||
|
||||
@ -231,7 +231,7 @@ gsk_vulkan_render_pass_free (GskVulkanRenderPass *self)
|
||||
g_array_unref (self->wait_semaphores);
|
||||
|
||||
|
||||
g_slice_free (GskVulkanRenderPass, self);
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
#define FALLBACK(...) G_STMT_START { \
|
||||
|
@ -37,7 +37,7 @@ gsk_vulkan_shader_new_from_bytes (GdkVulkanContext *context,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
self = g_slice_new0 (GskVulkanShader);
|
||||
self = g_new0 (GskVulkanShader, 1);
|
||||
|
||||
self->vulkan = g_object_ref (context);
|
||||
self->type = type;
|
||||
@ -85,7 +85,7 @@ gsk_vulkan_shader_free (GskVulkanShader *self)
|
||||
|
||||
g_object_unref (self->vulkan);
|
||||
|
||||
g_slice_free (GskVulkanShader, self);
|
||||
g_free (self);
|
||||
}
|
||||
|
||||
GskVulkanShaderType
|
||||
|
Loading…
Reference in New Issue
Block a user