summaryrefslogtreecommitdiff
path: root/thirdparty/thorvg/src/lib/sw_engine/tvgSwRasterAvx.h
diff options
context:
space:
mode:
authorMartin Capitanio <capnm@capitanio.org>2023-05-11 17:39:50 +0200
committerRĂ©mi Verschelde <rverschelde@gmail.com>2023-05-12 12:31:23 +0200
commit9e11b78d1cb6718fa8357be3b3f4b8bdadd6b660 (patch)
tree7245ce16b8f3769b9126a180db7cf961a3855650 /thirdparty/thorvg/src/lib/sw_engine/tvgSwRasterAvx.h
parentce0c61b6e33807bd9868ff3fe18ffac737a1c55d (diff)
Update ThorVG to v0.9.0
https://github.com/thorvg/thorvg/releases/tag/v0.9.0 Fixes #72478 (cherry picked from commit 5db751832d54092c9d153c0fe07f9cc4616a2d01)
Diffstat (limited to 'thirdparty/thorvg/src/lib/sw_engine/tvgSwRasterAvx.h')
-rw-r--r--thirdparty/thorvg/src/lib/sw_engine/tvgSwRasterAvx.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/thirdparty/thorvg/src/lib/sw_engine/tvgSwRasterAvx.h b/thirdparty/thorvg/src/lib/sw_engine/tvgSwRasterAvx.h
index 7a129a3a80..cf658a6abb 100644
--- a/thirdparty/thorvg/src/lib/sw_engine/tvgSwRasterAvx.h
+++ b/thirdparty/thorvg/src/lib/sw_engine/tvgSwRasterAvx.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2021 - 2022 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2021 - 2023 the ThorVG project. All rights reserved.
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -82,9 +82,15 @@ static void avxRasterRGBA32(uint32_t *dst, uint32_t val, uint32_t offset, int32_
}
-static bool avxRasterTranslucentRect(SwSurface* surface, const SwBBox& region, uint32_t color)
+static bool avxRasterTranslucentRect(SwSurface* surface, const SwBBox& region, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{
- auto buffer = surface->buffer + (region.min.y * surface->stride) + region.min.x;
+ if (surface->channelSize != sizeof(uint32_t)) {
+ TVGERR("SW_ENGINE", "Unsupported Channel Size = %d", surface->channelSize);
+ return false;
+ }
+
+ auto color = surface->blender.join(r, g, b, a);
+ auto buffer = surface->buf32 + (region.min.y * surface->stride) + region.min.x;
auto h = static_cast<uint32_t>(region.max.y - region.min.y);
auto w = static_cast<uint32_t>(region.max.x - region.min.x);
@@ -125,13 +131,19 @@ static bool avxRasterTranslucentRect(SwSurface* surface, const SwBBox& region, u
}
-static bool avxRasterTranslucentRle(SwSurface* surface, const SwRleData* rle, uint32_t color)
+static bool avxRasterTranslucentRle(SwSurface* surface, const SwRleData* rle, uint8_t r, uint8_t g, uint8_t b, uint8_t a)
{
+ if (surface->channelSize != sizeof(uint32_t)) {
+ TVGERR("SW_ENGINE", "Unsupported Channel Size = %d", surface->channelSize);
+ return false;
+ }
+
+ auto color = surface->blender.join(r, g, b, a);
auto span = rle->spans;
uint32_t src;
for (uint32_t i = 0; i < rle->size; ++i) {
- auto dst = &surface->buffer[span->y * surface->stride + span->x];
+ auto dst = &surface->buf32[span->y * surface->stride + span->x];
if (span->coverage < 255) src = ALPHA_BLEND(color, span->coverage);
else src = color;