Merge commit '84361278945ace6a5d865ceb1ed7f04a0936eb99' into library-updates

This commit is contained in:
Leon Styhre 2023-01-06 11:28:43 +01:00
commit 1cd0c30b4a
5 changed files with 11 additions and 10 deletions

View file

@ -6,12 +6,13 @@
#include <math.h> #include <math.h>
#include <limits.h> #include <limits.h>
#define ALIGN_SIZE(size) (((size) + 7ul) & ~7ul)
static void ft_outline_init(PVG_FT_Outline* outline, plutovg_t* pluto, int points, int contours) static void ft_outline_init(PVG_FT_Outline* outline, plutovg_t* pluto, int points, int contours)
{ {
size_t size_a = (points + contours) * sizeof(PVG_FT_Vector); size_t size_a = ALIGN_SIZE((points + contours) * sizeof(PVG_FT_Vector));
size_t size_b = (points + contours) * sizeof(char); size_t size_b = ALIGN_SIZE((points + contours) * sizeof(char));
size_t size_c = contours * sizeof(int); size_t size_c = ALIGN_SIZE(contours * sizeof(int));
size_t size_d = contours * sizeof(char); size_t size_d = ALIGN_SIZE(contours * sizeof(char));
size_t size_n = size_a + size_b + size_c + size_d; size_t size_n = size_a + size_b + size_c + size_d;
if(size_n > pluto->outline_size) { if(size_n > pluto->outline_size) {
pluto->outline_data = realloc(pluto->outline_data, size_n); pluto->outline_data = realloc(pluto->outline_data, size_n);

View file

@ -223,7 +223,7 @@ plutovg_texture_t* plutovg_set_texture(plutovg_t* pluto, plutovg_surface_t* surf
{ {
plutovg_paint_t* paint = &pluto->state->paint; plutovg_paint_t* paint = &pluto->state->paint;
paint->type = plutovg_paint_type_texture; paint->type = plutovg_paint_type_texture;
plutovg_texture_init(&paint->texture, surface, plutovg_texture_type_plain); plutovg_texture_init(&paint->texture, surface, type);
return &paint->texture; return &paint->texture;
} }

View file

@ -24,13 +24,13 @@ Length MarkerElement::refY() const
Length MarkerElement::markerWidth() const Length MarkerElement::markerWidth() const
{ {
auto& value = get(PropertyID::MarkerWidth); auto& value = get(PropertyID::MarkerWidth);
return Parser::parseLength(value, ForbidNegativeLengths, Length::ThreePercent); return Parser::parseLength(value, ForbidNegativeLengths, Length::Three);
} }
Length MarkerElement::markerHeight() const Length MarkerElement::markerHeight() const
{ {
auto& value = get(PropertyID::MarkerHeight); auto& value = get(PropertyID::MarkerHeight);
return Parser::parseLength(value, ForbidNegativeLengths, Length::ThreePercent); return Parser::parseLength(value, ForbidNegativeLengths, Length::Three);
} }
Angle MarkerElement::orient() const Angle MarkerElement::orient() const

View file

@ -1,5 +1,5 @@
#include "property.h" #include "property.h"
#include "styledelement.h" #include "element.h"
#include "lunasvg.h" #include "lunasvg.h"
#include <algorithm> #include <algorithm>
@ -547,7 +547,7 @@ void PathIterator::next()
const Length Length::Unknown{0, LengthUnits::Unknown}; const Length Length::Unknown{0, LengthUnits::Unknown};
const Length Length::Zero{0, LengthUnits::Number}; const Length Length::Zero{0, LengthUnits::Number};
const Length Length::One{1, LengthUnits::Number}; const Length Length::One{1, LengthUnits::Number};
const Length Length::ThreePercent{3, LengthUnits::Percent}; const Length Length::Three{3, LengthUnits::Number};
const Length Length::HundredPercent{100, LengthUnits::Percent}; const Length Length::HundredPercent{100, LengthUnits::Percent};
const Length Length::FiftyPercent{50, LengthUnits::Percent}; const Length Length::FiftyPercent{50, LengthUnits::Percent};
const Length Length::OneTwentyPercent{120, LengthUnits::Percent}; const Length Length::OneTwentyPercent{120, LengthUnits::Percent};

View file

@ -285,7 +285,7 @@ public:
static const Length Unknown; static const Length Unknown;
static const Length Zero; static const Length Zero;
static const Length One; static const Length One;
static const Length ThreePercent; static const Length Three;
static const Length HundredPercent; static const Length HundredPercent;
static const Length FiftyPercent; static const Length FiftyPercent;
static const Length OneTwentyPercent; static const Length OneTwentyPercent;