ctx->miterLimit = 10;
ctx->curOperator = VKVG_OPERATOR_OVER;
ctx->curFillRule = VKVG_FILL_RULE_NON_ZERO;
- ctx->bounds = (VkRect2D) {{0,0},{ctx->pSurf->width,ctx->pSurf->height}};
+ ctx->bounds = (VkRect2D) { {0,0}, { ctx->pSurf->width, ctx->pSurf->height } };
ctx->pushConsts = (push_constants) {
{.a = 1},
{(float)ctx->pSurf->width,(float)ctx->pSurf->height},
//compute dyn distanceTolerance depending on current scale
float sx = 1, sy = 1;
vkvg_matrix_get_scale (&ctx->pushConsts.mat, &sx, &sy);
- float distanceTolerance = fabs(0.25f / fmaxf(sx,sy));
+ float distanceTolerance = fabs(0.01f / fmaxf(sx,sy));
_recursive_bezier (ctx, distanceTolerance, cp.x, cp.y, x1, y1, x2, y2, x3, y3, 0);
/*cp.x = x3;
if (surf->status)
return surf;
- surf->width = MAX(1, width);
- surf->height = MAX(1, height);
+ surf->imgWidth = surf->width = MAX(1, width);
+ surf->imgHeight = surf->height = MAX(1, height);
surf->newSurf = true;//used to clear all attacments on first render pass
_create_surface_images (surf);
}
VkhImage img = (VkhImage)vkhImg;
- surf->width = img->infos.extent.width;
- surf->height= img->infos.extent.height;
+ surf->imgWidth = img->infos.extent.width;
+ surf->imgHeight = img->infos.extent.height;
surf->img = img;
return surf;
}
- surf->width = MAX(1, width);
- surf->height = MAX(1, height);
+ surf->imgWidth = surf->width = MAX(1, width);
+ surf->imgHeight = surf->height = MAX(1, height);
_create_surface_images (surf);
return 0;
return surf->references;
}
+void vkvg_surface_resize(VkvgSurface surf, uint32_t width, uint32_t height) {
+ if (surf->status)
+ return;
+
+ surf->width = MAX(1, width);
+ surf->height = MAX(1, height);
+
+ vkDestroyFramebuffer(surf->dev->vkDev, surf->fb, NULL);
+
+ if (width > surf->imgWidth || height > surf->imgHeight) {
+ if (!surf->img->imported)
+ vkh_image_destroy(surf->img);
+ vkh_image_destroy(surf->imgMS);
+ vkh_image_destroy(surf->stencil);
+ surf->newSurf = true;//used to clear all attacments on first render pass
+ _create_surface_images (surf);
+ _transition_surf_images (surf);
+
+ surf->imgWidth = surf->width;
+ surf->imgHeight = surf->height;
+ }
+
+ _create_framebuffer (surf);
+}
VkImage vkvg_surface_get_vk_image(VkvgSurface surf)
{
if (surf->status)
vkvg_status_t status; /**< Current status of surface, affected by last operation */
uint32_t references;
VkvgDevice dev;
- uint32_t width;
- uint32_t height;
+ uint32_t width; /**< surface width, underlying vulkan image may be larger */
+ uint32_t height; /**< surface height, underlying vulkan image may be larger */
+ uint32_t imgWidth; /**< physical surface image width */
+ uint32_t imgHeight; /**< physical surface image height */
VkFormat format;
VkFramebuffer fb;
VkhImage img;