backend update from Raze

* moving large allocations off the stack
* use proper printf formatters for size_t and ptrdiff_t.
* adding some missing 'noexcept'.
This commit is contained in:
Christoph Oelckers 2024-01-06 15:24:10 +01:00
commit 83aa9388ca
29 changed files with 117 additions and 109 deletions

View file

@ -192,6 +192,11 @@ void nsvgDelete(NSVGimage* image);
#include <stdio.h>
#include <math.h>
#ifdef _MSC_VER
#pragma warning(push);
#pragma warning(disable:4244)
#endif
#define NSVG_PI (3.14159265358979323846264338327f)
#define NSVG_KAPPA90 (0.5522847493f) // Length proportional to radius of a cubic bezier handle for 90deg arcs.
@ -3093,6 +3098,10 @@ void nsvgDelete(NSVGimage* image)
free(image);
}
#ifdef _MSC_VER
#pragma warning(pop);
#endif
#endif // NANOSVG_IMPLEMENTATION
#endif // NANOSVG_H

View file

@ -1548,7 +1548,7 @@ render_outline(Outline *outl, double transform[6], SFT_Image image)
numPixels = (unsigned int) image.width * (unsigned int) image.height;
STACK_ALLOC(cells, Cell, 128 * 128, numPixels);
STACK_ALLOC(cells, Cell, 32 * 32, numPixels);
if (!cells) {
return -1;
}

View file

@ -24,7 +24,6 @@ void ImageBox::SetImage(std::shared_ptr<Image> newImage)
void ImageBox::OnPaint(Canvas* canvas)
{
canvas->fillRect(Rect::xywh(0.0, 0.0, GetWidth(), GetHeight()), Colorf::fromRgba8(0, 0, 0));
if (image)
{
canvas->drawImage(image, Point((GetWidth() - (double)image->GetWidth()) * 0.5, (GetHeight() - (double)image->GetHeight()) * 0.5));