forked from AuroraMiddleware/gtk
vulkan: Allow to control scaling in the blend pipeline
Pass in a second rect that defines the size of the texture. Update the sole caller to pass in the same rect, for unchanged behavior.
This commit is contained in:
parent
e91051a562
commit
538e7c7982
@ -93,7 +93,8 @@ gsk_vulkan_blend_pipeline_count_vertex_data (GskVulkanBlendPipeline *pipeline)
|
||||
void
|
||||
gsk_vulkan_blend_pipeline_collect_vertex_data (GskVulkanBlendPipeline *pipeline,
|
||||
guchar *data,
|
||||
const graphene_rect_t *rect)
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_rect_t *tex_rect)
|
||||
{
|
||||
GskVulkanBlendInstance *instance = (GskVulkanBlendInstance *) data;
|
||||
|
||||
@ -101,10 +102,10 @@ gsk_vulkan_blend_pipeline_collect_vertex_data (GskVulkanBlendPipeline *pipeline,
|
||||
instance->rect[1] = rect->origin.y;
|
||||
instance->rect[2] = rect->size.width;
|
||||
instance->rect[3] = rect->size.height;
|
||||
instance->tex_rect[0] = 0.0;
|
||||
instance->tex_rect[1] = 0.0;
|
||||
instance->tex_rect[2] = 1.0;
|
||||
instance->tex_rect[3] = 1.0;
|
||||
instance->tex_rect[0] = (rect->origin.x - tex_rect->origin.x)/tex_rect->size.width;
|
||||
instance->tex_rect[1] = (rect->origin.y - tex_rect->origin.y)/tex_rect->size.height;
|
||||
instance->tex_rect[2] = (rect->size.width + rect->origin.x - tex_rect->origin.x)/tex_rect->size.width;
|
||||
instance->tex_rect[3] = (rect->size.height + rect->origin.y - tex_rect->origin.y)/tex_rect->size.height;
|
||||
}
|
||||
|
||||
gsize
|
||||
|
@ -21,7 +21,8 @@ GskVulkanPipeline * gsk_vulkan_blend_pipeline_new (GdkVulk
|
||||
gsize gsk_vulkan_blend_pipeline_count_vertex_data (GskVulkanBlendPipeline *pipeline);
|
||||
void gsk_vulkan_blend_pipeline_collect_vertex_data (GskVulkanBlendPipeline *pipeline,
|
||||
guchar *data,
|
||||
const graphene_rect_t *rect);
|
||||
const graphene_rect_t *rect,
|
||||
const graphene_rect_t *tex_rect);
|
||||
gsize gsk_vulkan_blend_pipeline_draw (GskVulkanBlendPipeline *pipeline,
|
||||
VkCommandBuffer command_buffer,
|
||||
gsize offset,
|
||||
|
@ -1055,6 +1055,7 @@ gsk_vulkan_render_pass_collect_vertex_data (GskVulkanRenderPass *self,
|
||||
op->render.vertex_offset = offset + n_bytes;
|
||||
gsk_vulkan_blend_pipeline_collect_vertex_data (GSK_VULKAN_BLEND_PIPELINE (op->render.pipeline),
|
||||
data + n_bytes + offset,
|
||||
&op->render.node->bounds,
|
||||
&op->render.node->bounds);
|
||||
n_bytes += op->render.vertex_count;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user