From 64ccf2484424be13e72702b6d808c50cd5191bd9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Mon, 30 Apr 2018 18:09:30 +0200 Subject: [PATCH] rename fill rect --- src/vkvg_context.c | 16 +--------------- src/vkvg_context_internal.c | 14 ++++++++++++++ src/vkvg_context_internal.h | 2 +- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/vkvg_context.c b/src/vkvg_context.c index 13e84b7..c2b943f 100644 --- a/src/vkvg_context.c +++ b/src/vkvg_context.c @@ -77,7 +77,7 @@ VkvgContext vkvg_create(VkvgSurface surf) _update_gradient_desc_set(ctx); //add full screen quad at the beginning, recurently used - _vkvg_fill_rectangle (ctx,0,0,ctx->pSurf->width,ctx->pSurf->height); + _vao_add_rectangle (ctx,0,0,ctx->pSurf->width,ctx->pSurf->height); _init_cmd_buff (ctx); _clear_path (ctx); @@ -519,20 +519,6 @@ void vkvg_stroke_preserve (VkvgContext ctx) } _record_draw_cmd(ctx); } -void _vkvg_fill_rectangle (VkvgContext ctx, float x, float y, float width, float height){ - Vertex v[4] = - { - {{x,y}, {0,0,-1}}, - {{x,y+height}, {0,0,-1}}, - {{x+width,y}, {0,0,-1}}, - {{x+width,y+height},{0,0,-1}} - }; - uint32_t firstIdx = ctx->vertCount; - Vertex* pVert = (Vertex*)(ctx->vertices.mapped + ctx->vertCount * sizeof(Vertex)); - memcpy (pVert,v,4*sizeof(Vertex)); - ctx->vertCount+=4; - _add_tri_indices_for_rect(ctx, firstIdx); -} void vkvg_paint (VkvgContext ctx){ vkCmdDrawIndexed (ctx->cmd,6,1,0,0,0); } diff --git a/src/vkvg_context_internal.c b/src/vkvg_context_internal.c index 36cfae3..4d28b14 100644 --- a/src/vkvg_context_internal.c +++ b/src/vkvg_context_internal.c @@ -151,6 +151,20 @@ void _add_triangle_indices(VkvgContext ctx, uint32_t i0, uint32_t i1, uint32_t i inds[2] = i2; ctx->indCount+=3; } +void _vao_add_rectangle (VkvgContext ctx, float x, float y, float width, float height){ + Vertex v[4] = + { + {{x,y}, {0,0,-1}}, + {{x,y+height}, {0,0,-1}}, + {{x+width,y}, {0,0,-1}}, + {{x+width,y+height},{0,0,-1}} + }; + uint32_t firstIdx = ctx->vertCount; + Vertex* pVert = (Vertex*)(ctx->vertices.mapped + ctx->vertCount * sizeof(Vertex)); + memcpy (pVert,v,4*sizeof(Vertex)); + ctx->vertCount+=4; + _add_tri_indices_for_rect(ctx, firstIdx); +} void _create_cmd_buff (VkvgContext ctx){ ctx->cmd = vkh_cmd_buff_create(ctx->pSurf->dev->vkDev, ctx->cmdPool,VK_COMMAND_BUFFER_LEVEL_PRIMARY); } diff --git a/src/vkvg_context_internal.h b/src/vkvg_context_internal.h index 7ac2c05..84c7afe 100644 --- a/src/vkvg_context_internal.h +++ b/src/vkvg_context_internal.h @@ -148,7 +148,6 @@ float _normalizeAngle (float a); vec2 _get_current_position (VkvgContext ctx); void _add_point (VkvgContext ctx, float x, float y); void _add_point_vec2 (VkvgContext ctx, vec2 v); -void _vkvg_fill_rectangle (VkvgContext ctx, float x, float y, float width, float height); void _create_vertices_buff (VkvgContext ctx); void _add_vertex (VkvgContext ctx, Vertex v); @@ -157,6 +156,7 @@ void _set_vertex (VkvgContext ctx, uint32_t idx, Vertex v); void _add_triangle_indices (VkvgContext ctx, uint32_t i0, uint32_t i1,uint32_t i2); void _add_tri_indices_for_rect (VkvgContext ctx, uint32_t i); void _build_vb_step (vkvg_context* ctx, Vertex v, float hw, uint32_t iL, uint32_t i, uint32_t iR); +void _vao_add_rectangle (VkvgContext ctx, float x, float y, float width, float height); void _bind_draw_pipeline (VkvgContext ctx); void _create_cmd_buff (VkvgContext ctx); -- 2.47.3