From 84361278945ace6a5d865ceb1ed7f04a0936eb99 Mon Sep 17 00:00:00 2001 From: Leon Styhre Date: Fri, 6 Jan 2023 11:28:43 +0100 Subject: [PATCH] Squashed 'external/lunasvg/' changes from 0562a5dcc..585d61eef 585d61eef Fix invalid marker size #70 3881f345c Fix plutovg misaligned address 56ddf2a5a Fix plutovg pattern type git-subtree-dir: external/lunasvg git-subtree-split: 585d61eef24510bc0b7fe3d9e768d0675d4b5a6f --- 3rdparty/plutovg/plutovg-rle.c | 9 +++++---- 3rdparty/plutovg/plutovg.c | 2 +- source/markerelement.cpp | 4 ++-- source/property.cpp | 4 ++-- source/property.h | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/3rdparty/plutovg/plutovg-rle.c b/3rdparty/plutovg/plutovg-rle.c index 783ee8354..857628ad0 100644 --- a/3rdparty/plutovg/plutovg-rle.c +++ b/3rdparty/plutovg/plutovg-rle.c @@ -6,12 +6,13 @@ #include #include +#define ALIGN_SIZE(size) (((size) + 7ul) & ~7ul) 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_b = (points + contours) * sizeof(char); - size_t size_c = contours * sizeof(int); - size_t size_d = contours * sizeof(char); + size_t size_a = ALIGN_SIZE((points + contours) * sizeof(PVG_FT_Vector)); + size_t size_b = ALIGN_SIZE((points + contours) * sizeof(char)); + size_t size_c = ALIGN_SIZE(contours * sizeof(int)); + size_t size_d = ALIGN_SIZE(contours * sizeof(char)); size_t size_n = size_a + size_b + size_c + size_d; if(size_n > pluto->outline_size) { pluto->outline_data = realloc(pluto->outline_data, size_n); diff --git a/3rdparty/plutovg/plutovg.c b/3rdparty/plutovg/plutovg.c index a5ee85c73..3b357bcbf 100644 --- a/3rdparty/plutovg/plutovg.c +++ b/3rdparty/plutovg/plutovg.c @@ -223,7 +223,7 @@ plutovg_texture_t* plutovg_set_texture(plutovg_t* pluto, plutovg_surface_t* surf { plutovg_paint_t* paint = &pluto->state->paint; 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; } diff --git a/source/markerelement.cpp b/source/markerelement.cpp index 5a61aff69..1de0aba90 100644 --- a/source/markerelement.cpp +++ b/source/markerelement.cpp @@ -24,13 +24,13 @@ Length MarkerElement::refY() const Length MarkerElement::markerWidth() const { auto& value = get(PropertyID::MarkerWidth); - return Parser::parseLength(value, ForbidNegativeLengths, Length::ThreePercent); + return Parser::parseLength(value, ForbidNegativeLengths, Length::Three); } Length MarkerElement::markerHeight() const { auto& value = get(PropertyID::MarkerHeight); - return Parser::parseLength(value, ForbidNegativeLengths, Length::ThreePercent); + return Parser::parseLength(value, ForbidNegativeLengths, Length::Three); } Angle MarkerElement::orient() const diff --git a/source/property.cpp b/source/property.cpp index 44b1414df..6dd4e2c32 100644 --- a/source/property.cpp +++ b/source/property.cpp @@ -1,5 +1,5 @@ #include "property.h" -#include "styledelement.h" +#include "element.h" #include "lunasvg.h" #include @@ -547,7 +547,7 @@ void PathIterator::next() const Length Length::Unknown{0, LengthUnits::Unknown}; const Length Length::Zero{0, 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::FiftyPercent{50, LengthUnits::Percent}; const Length Length::OneTwentyPercent{120, LengthUnits::Percent}; diff --git a/source/property.h b/source/property.h index 619581046..cdbff73e6 100644 --- a/source/property.h +++ b/source/property.h @@ -285,7 +285,7 @@ public: static const Length Unknown; static const Length Zero; static const Length One; - static const Length ThreePercent; + static const Length Three; static const Length HundredPercent; static const Length FiftyPercent; static const Length OneTwentyPercent;