]> O.S.I.I.S - jp/vkvg.git/commitdiff
wip
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 14 Jul 2020 13:37:51 +0000 (15:37 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Tue, 14 Jul 2020 13:37:51 +0000 (15:37 +0200)
shaders/vkvg_main.frag
shaders/vkvg_main.vert
src/vkvg_context_internal.c
tests/img_surf.c

index 8a3209033b04e3d8533926511ad5e9f5523f6d35..6649582097ac5f6a1cca22627218d81bf11ce603 100644 (file)
@@ -25,7 +25,7 @@
 #extension GL_ARB_shading_language_420pack     : enable
 
 layout (set=0, binding = 0) uniform sampler2DArray fontMap;
-layout (set=1, binding = 0) uniform sampler2D          source;
+layout (set=1, binding = 0) uniform sampler2D source;
 layout (set=2, binding = 0) uniform _uboGrad {
        vec4    cp[3];
        vec4    colors[16];
index c6fee38a30615f808be55f6732b535087769ba8d..28267134e359b588059b22263257e4fa5870e807 100644 (file)
@@ -60,7 +60,7 @@ void main()
        outMat          = pc.matInv;
 
        if (pc.fullScreenQuad != 0) {
-               gl_Position = vec4(vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2) * 2.0f + -1.0f, 0.0f, 1.0f);
+               gl_Position = vec4(vec2((gl_VertexIndex << 1) & 2, gl_VertexIndex & 2) * 2.0f 1.0f, 0.0f, 1.0f);
                outUV = vec3(0,0,-1);
                return;
        }
index 1910635c3ea42d1d6435b2cea7e75af3e1ad19fb..29434a754e1b5347b545e6dca6d4bbb66560073f 100644 (file)
@@ -1112,6 +1112,7 @@ void _poly_fill (VkvgContext ctx){
        }
        ctx->curVertOffset = ctx->vertCount;
 }
+//create fill from current path with ear clipping technic
 void _fill_ec (VkvgContext ctx){
        Vertex v = {0};
        v.uv.z = -1;
index 458b23200f2019a78d95c6105378096d4f48d3c1..ad0abc43fa6457cecb4b98c1b51b7acf6f3b16ae 100644 (file)
@@ -3,7 +3,7 @@ void paint () {
        VkvgContext ctx = vkvg_create(surf);
        VkvgSurface imgSurf = vkvg_surface_create_from_image(device, "data/miroir.jpg");
 
-       vkvg_set_source_surface(ctx, imgSurf, 00, 00);
+       vkvg_set_source_surface(ctx, imgSurf, 00);
        vkvg_paint(ctx);
 
        vkvg_surface_destroy(imgSurf);
@@ -19,6 +19,18 @@ void paint_offset () {
        vkvg_surface_destroy(imgSurf);
        vkvg_destroy(ctx);
 }
+void paint_with_scale(){
+       VkvgContext ctx = vkvg_create(surf);
+       vkvg_scale (ctx, 0.2f,0.2f);
+       VkvgSurface imgSurf = vkvg_surface_create_from_image(device, "data/miroir.jpg");
+       vkvg_set_source_surface(ctx, imgSurf, 0, 0);
+
+       vkvg_paint(ctx);
+
+       vkvg_surface_destroy(imgSurf);
+       vkvg_destroy(ctx);
+}
+
 void paint_pattern () {
        VkvgContext ctx = vkvg_create(surf);
        VkvgSurface imgSurf = vkvg_surface_create_from_image(device, "data/miroir.jpg");
@@ -40,6 +52,18 @@ void paint_pattern_repeat () {
        vkvg_surface_destroy(imgSurf);
        vkvg_destroy(ctx);
 }
+void paint_pattern_repeat_scalled () {
+       VkvgContext ctx = vkvg_create(surf);
+       vkvg_scale (ctx, 0.2f,0.2f);
+       VkvgSurface imgSurf = vkvg_surface_create_from_image(device, "data/miroir.jpg");
+       VkvgPattern pat = vkvg_pattern_create_for_surface(imgSurf);
+       vkvg_pattern_set_extend(pat,VKVG_EXTEND_REPEAT);
+       vkvg_set_source(ctx, pat);
+       vkvg_paint(ctx);
+       vkvg_pattern_destroy(pat);
+       vkvg_surface_destroy(imgSurf);
+       vkvg_destroy(ctx);
+}
 void paint_pattern_pad () {
        VkvgContext ctx = vkvg_create(surf);
        VkvgSurface imgSurf = vkvg_surface_create_from_image(device, "data/miroir.jpg");
@@ -66,7 +90,7 @@ void test(){
        vkvg_new_sub_path(ctx);
        vkvg_arc(ctx,200,200,100,0,2.f*M_PIF);
 
-       vkvg_set_source_surface(ctx, imgSurf, 00, 00);
+       vkvg_set_source_surface(ctx, imgSurf, 00);
        vkvg_fill_preserve(ctx);
        vkvg_set_source_rgba(ctx,0.2f,0.3f,0.8f,1);
 
@@ -80,8 +104,10 @@ void test(){
 int main(int argc, char *argv[]) {
        PERFORM_TEST (paint, argc, argv);
        PERFORM_TEST (paint_offset, argc, argv);
+       PERFORM_TEST (paint_with_scale, argc, argv);
        PERFORM_TEST (paint_pattern, argc, argv);
        PERFORM_TEST (paint_pattern_repeat, argc, argv);
+       PERFORM_TEST (paint_pattern_repeat_scalled, argc, argv);
        PERFORM_TEST (paint_pattern_pad, argc, argv);
        PERFORM_TEST (test, argc, argv);