mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 02:40:11 +00:00
gpu: Use builder for memory texture
This commit is contained in:
parent
3db858b45f
commit
6a1cd87480
@ -119,6 +119,7 @@ gsk_gpu_download_op_vk_create (GskGpuDownloadOp *self)
|
|||||||
guchar *data;
|
guchar *data;
|
||||||
gsize width, height, stride;
|
gsize width, height, stride;
|
||||||
GdkMemoryFormat format;
|
GdkMemoryFormat format;
|
||||||
|
GdkMemoryTextureBuilder *builder;
|
||||||
|
|
||||||
data = gsk_gpu_buffer_map (self->buffer);
|
data = gsk_gpu_buffer_map (self->buffer);
|
||||||
width = gsk_gpu_image_get_width (self->image);
|
width = gsk_gpu_image_get_width (self->image);
|
||||||
@ -126,11 +127,16 @@ gsk_gpu_download_op_vk_create (GskGpuDownloadOp *self)
|
|||||||
format = gsk_gpu_image_get_format (self->image);
|
format = gsk_gpu_image_get_format (self->image);
|
||||||
stride = width * gdk_memory_format_bytes_per_pixel (format);
|
stride = width * gdk_memory_format_bytes_per_pixel (format);
|
||||||
bytes = g_bytes_new (data, stride * height);
|
bytes = g_bytes_new (data, stride * height);
|
||||||
self->texture = gdk_memory_texture_new (width,
|
|
||||||
height,
|
builder = gdk_memory_texture_builder_new ();
|
||||||
format,
|
gdk_memory_texture_builder_set_width (builder, width);
|
||||||
bytes,
|
gdk_memory_texture_builder_set_height (builder, height);
|
||||||
stride);
|
gdk_memory_texture_builder_set_format (builder, format);
|
||||||
|
gdk_memory_texture_builder_set_bytes (builder, bytes);
|
||||||
|
gdk_memory_texture_builder_set_stride (builder, stride);
|
||||||
|
self->texture = gdk_memory_texture_builder_build (builder);
|
||||||
|
|
||||||
|
g_object_unref (builder);
|
||||||
g_bytes_unref (bytes);
|
g_bytes_unref (bytes);
|
||||||
gsk_gpu_buffer_unmap (self->buffer, 0);
|
gsk_gpu_buffer_unmap (self->buffer, 0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user