vulkan: Split out a function

This is refactoring for future changes.
This commit is contained in:
Benjamin Otte 2023-07-11 08:50:20 +02:00
parent 6f76c37fed
commit 70a12c4efb

View File

@ -38,11 +38,10 @@ gsk_vulkan_upload_cairo_op_print (GskVulkanOp *op,
}
static void
gsk_vulkan_upload_cairo_op_upload (GskVulkanOp *op,
GskVulkanUploader *uploader)
gsk_vulkan_upload_cairo_op_draw (GskVulkanUploadCairoOp *self,
guchar *data,
gsize stride)
{
GskVulkanUploadCairoOp *self = (GskVulkanUploadCairoOp *) op;
GskVulkanImageMap map;
cairo_surface_t *surface;
cairo_t *cr;
int width, height;
@ -50,11 +49,10 @@ gsk_vulkan_upload_cairo_op_upload (GskVulkanOp *op,
width = gsk_vulkan_image_get_width (self->image);
height = gsk_vulkan_image_get_height (self->image);
gsk_vulkan_image_map_memory (self->image, uploader, GSK_VULKAN_WRITE, &map);
surface = cairo_image_surface_create_for_data (map.data,
surface = cairo_image_surface_create_for_data (data,
CAIRO_FORMAT_ARGB32,
width, height,
map.stride);
stride);
cairo_surface_set_device_scale (surface,
width / self->viewport.size.width,
height / self->viewport.size.height);
@ -67,6 +65,18 @@ gsk_vulkan_upload_cairo_op_upload (GskVulkanOp *op,
cairo_surface_finish (surface);
cairo_surface_destroy (surface);
}
static void
gsk_vulkan_upload_cairo_op_upload (GskVulkanOp *op,
GskVulkanUploader *uploader)
{
GskVulkanUploadCairoOp *self = (GskVulkanUploadCairoOp *) op;
GskVulkanImageMap map;
gsk_vulkan_image_map_memory (self->image, uploader, GSK_VULKAN_WRITE, &map);
gsk_vulkan_upload_cairo_op_draw (self, map.data, map.stride);
gsk_vulkan_image_unmap_memory (self->image, uploader, &map);
}