]> O.S.I.I.S - jp/vkvg.git/commitdiff
rename fill rect
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 30 Apr 2018 16:09:30 +0000 (18:09 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Mon, 30 Apr 2018 16:09:30 +0000 (18:09 +0200)
src/vkvg_context.c
src/vkvg_context_internal.c
src/vkvg_context_internal.h

index 13e84b7aad2e3e2fe0a029a7dbf8dd2541a69eb7..c2b943fa7464a7ea425b1e07b63331e197d0eda2 100644 (file)
@@ -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);
 }
index 36cfae38e9d71e5cf2af3b46d50bb29df7dee9b0..4d28b14e648d9a880d9abad6304e29283b8d189a 100644 (file)
@@ -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);
 }
index 7ac2c05dab0ac179e1c4aa2fa97bfec231fa3720..84c7afe339a6b4dedb72c742af9c7493d4e93c34 100644 (file)
@@ -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);