fixed all wasm build breaks.

This commit is contained in:
Hermet Park 2021-02-23 10:47:46 +09:00
parent d6d65c3bd6
commit 197879f2ef
4 changed files with 16 additions and 14 deletions

View file

@ -21,6 +21,7 @@
*/ */
#include "tvgSwCommon.h" #include "tvgSwCommon.h"
#include "tvgRender.h" #include "tvgRender.h"
#include <iostream>
#include <float.h> #include <float.h>
#include <math.h> #include <math.h>
@ -134,7 +135,7 @@ static bool _translucentRectAlphaMask(SwSurface* surface, const SwBBox& region,
auto w = static_cast<uint32_t>(region.max.x - region.min.x); auto w = static_cast<uint32_t>(region.max.x - region.min.x);
#ifdef THORVG_LOG_ENABLED #ifdef THORVG_LOG_ENABLED
printf("SW_ENGINE: Rectangle Alpha Mask Composition\n"); cout <<"SW_ENGINE: Rectangle Alpha Mask Composition" << endl;
#endif #endif
auto cbuffer = surface->compositor->image.data + (region.min.y * surface->stride) + region.min.x; //compositor buffer auto cbuffer = surface->compositor->image.data + (region.min.y * surface->stride) + region.min.x; //compositor buffer
@ -158,7 +159,7 @@ static bool _translucentRectInvAlphaMask(SwSurface* surface, const SwBBox& regio
auto w = static_cast<uint32_t>(region.max.x - region.min.x); auto w = static_cast<uint32_t>(region.max.x - region.min.x);
#ifdef THORVG_LOG_ENABLED #ifdef THORVG_LOG_ENABLED
printf("SW_ENGINE: Rectangle Inverse Alpha Mask Composition\n"); cout <<"SW_ENGINE: Rectangle Inverse Alpha Mask Composition" << endl;
#endif #endif
auto cbuffer = surface->compositor->image.data + (region.min.y * surface->stride) + region.min.x; //compositor buffer auto cbuffer = surface->compositor->image.data + (region.min.y * surface->stride) + region.min.x; //compositor buffer
@ -230,7 +231,7 @@ static bool _translucentRle(SwSurface* surface, const SwRleData* rle, uint32_t c
static bool _translucentRleAlphaMask(SwSurface* surface, const SwRleData* rle, uint32_t color) static bool _translucentRleAlphaMask(SwSurface* surface, const SwRleData* rle, uint32_t color)
{ {
#ifdef THORVG_LOG_ENABLED #ifdef THORVG_LOG_ENABLED
printf("SW_ENGINE: Rle Alpha Mask Composition\n"); cout <<"SW_ENGINE: Rle Alpha Mask Composition" << endl;
#endif #endif
auto span = rle->spans; auto span = rle->spans;
uint32_t src; uint32_t src;
@ -257,7 +258,7 @@ static bool _translucentRleAlphaMask(SwSurface* surface, const SwRleData* rle, u
static bool _translucentRleInvAlphaMask(SwSurface* surface, SwRleData* rle, uint32_t color) static bool _translucentRleInvAlphaMask(SwSurface* surface, SwRleData* rle, uint32_t color)
{ {
#ifdef THORVG_LOG_ENABLED #ifdef THORVG_LOG_ENABLED
printf("SW_ENGINE: Rle Inverse Alpha Mask Composition\n"); cout <<"SW_ENGINE: Rle Inverse Alpha Mask Composition" << endl;
#endif #endif
auto span = rle->spans; auto span = rle->spans;
uint32_t src; uint32_t src;
@ -422,7 +423,7 @@ static bool _translucentImage(SwSurface* surface, const uint32_t *img, uint32_t
static bool _translucentImageAlphaMask(SwSurface* surface, const uint32_t *img, uint32_t w, TVG_UNUSED uint32_t h, uint32_t opacity, const SwBBox& region, const Matrix* invTransform) static bool _translucentImageAlphaMask(SwSurface* surface, const uint32_t *img, uint32_t w, TVG_UNUSED uint32_t h, uint32_t opacity, const SwBBox& region, const Matrix* invTransform)
{ {
#ifdef THORVG_LOG_ENABLED #ifdef THORVG_LOG_ENABLED
printf("SW_ENGINE: Transformed Image Alpha Mask Composition\n"); cout <<"SW_ENGINE: Transformed Image Alpha Mask Composition" << endl;
#endif #endif
for (auto y = region.min.y; y < region.max.y; ++y) { for (auto y = region.min.y; y < region.max.y; ++y) {
auto dst = &surface->buffer[y * surface->stride + region.min.x]; auto dst = &surface->buffer[y * surface->stride + region.min.x];
@ -443,7 +444,7 @@ static bool _translucentImageAlphaMask(SwSurface* surface, const uint32_t *img,
static bool _translucentImageInvAlphaMask(SwSurface* surface, const uint32_t *img, uint32_t w, uint32_t h, uint32_t opacity, const SwBBox& region, const Matrix* invTransform) static bool _translucentImageInvAlphaMask(SwSurface* surface, const uint32_t *img, uint32_t w, uint32_t h, uint32_t opacity, const SwBBox& region, const Matrix* invTransform)
{ {
#ifdef THORVG_LOG_ENABLED #ifdef THORVG_LOG_ENABLED
printf("SW_ENGINE: Transformed Image Inverse Alpha Mask Composition\n"); cout <<"SW_ENGINE: Transformed Image Inverse Alpha Mask Composition" << endl;
#endif #endif
for (auto y = region.min.y; y < region.max.y; ++y) { for (auto y = region.min.y; y < region.max.y; ++y) {
auto dst = &surface->buffer[y * surface->stride + region.min.x]; auto dst = &surface->buffer[y * surface->stride + region.min.x];
@ -497,7 +498,7 @@ static bool _translucentImageAlphaMask(SwSurface* surface, uint32_t *img, uint32
auto w2 = static_cast<uint32_t>(region.max.x - region.min.x); auto w2 = static_cast<uint32_t>(region.max.x - region.min.x);
#ifdef THORVG_LOG_ENABLED #ifdef THORVG_LOG_ENABLED
printf("SW_ENGINE: Image Alpha Mask Composition\n"); cout <<"SW_ENGINE: Image Alpha Mask Composition" << endl;
#endif #endif
auto sbuffer = img + (region.min.y * w) + region.min.x; auto sbuffer = img + (region.min.y * w) + region.min.x;
@ -523,7 +524,7 @@ static bool _translucentImageInvAlphaMask(SwSurface* surface, uint32_t *img, uin
auto w2 = static_cast<uint32_t>(region.max.x - region.min.x); auto w2 = static_cast<uint32_t>(region.max.x - region.min.x);
#ifdef THORVG_LOG_ENABLED #ifdef THORVG_LOG_ENABLED
printf("SW_ENGINE: Image Inverse Alpha Mask Composition\n"); cout <<"SW_ENGINE: Image Inverse Alpha Mask Composition" << endl;
#endif #endif
auto sbuffer = img + (region.min.y * w) + region.min.x; auto sbuffer = img + (region.min.y * w) + region.min.x;

View file

@ -22,7 +22,7 @@
#include <setjmp.h> #include <setjmp.h>
#include <limits.h> #include <limits.h>
#include <memory.h> #include <memory.h>
#include <iostream>
#include "tvgSwCommon.h" #include "tvgSwCommon.h"
/************************************************************************/ /************************************************************************/
@ -951,7 +951,7 @@ void rleClipPath(SwRleData *rle, const SwRleData *clip)
if (spans) free(spans); if (spans) free(spans);
#ifdef THORVG_LOG_ENABLED #ifdef THORVG_LOG_ENABLED
printf("SW_ENGINE: Using ClipPath!\n"); cout << "SW_ENGINE: Using ClipPath!" << endl;
#endif #endif
} }
@ -968,7 +968,7 @@ void rleClipRect(SwRleData *rle, const SwBBox* clip)
if (spans) free(spans); if (spans) free(spans);
#ifdef THORVG_LOG_ENABLED #ifdef THORVG_LOG_ENABLED
printf("SW_ENGINE: Using ClipRect!\n"); cout <<"SW_ENGINE: Using ClipRect!" << endl;
#endif #endif
} }

View file

@ -62,8 +62,9 @@ struct RenderTransform
RenderTransform(const RenderTransform* lhs, const RenderTransform* rhs); RenderTransform(const RenderTransform* lhs, const RenderTransform* rhs);
}; };
struct RenderMethod class RenderMethod
{ {
public:
virtual ~RenderMethod() {} virtual ~RenderMethod() {}
virtual RenderData prepare(const Shape& shape, RenderData data, const RenderTransform* transform, uint32_t opacity, Array<RenderData>& clips, RenderUpdateFlag flags) = 0; virtual RenderData prepare(const Shape& shape, RenderData data, const RenderTransform* transform, uint32_t opacity, Array<RenderData>& clips, RenderUpdateFlag flags) = 0;
virtual RenderData prepare(const Picture& picture, RenderData data, const RenderTransform* transform, uint32_t opacity, Array<RenderData>& clips, RenderUpdateFlag flags) = 0; virtual RenderData prepare(const Picture& picture, RenderData data, const RenderTransform* transform, uint32_t opacity, Array<RenderData>& clips, RenderUpdateFlag flags) = 0;

View file

@ -2155,7 +2155,7 @@ static void _svgLoaderParserXmlOpen(SvgLoaderData* loader, const char* content,
sz = attrs - content; sz = attrs - content;
attrsLength = length - sz; attrsLength = length - sz;
while ((sz > 0) && (isspace(content[sz - 1]))) sz--; while ((sz > 0) && (isspace(content[sz - 1]))) sz--;
if ((uint)sz >= sizeof(tagName)) return; if ((unsigned)sz >= sizeof(tagName)) return;
strncpy(tagName, content, sz); strncpy(tagName, content, sz);
tagName[sz] = '\0'; tagName[sz] = '\0';
} }
@ -2517,7 +2517,7 @@ static bool _svgLoaderParserForValidCheckXmlOpen(SvgLoaderData* loader, const ch
sz = attrs - content; sz = attrs - content;
attrsLength = length - sz; attrsLength = length - sz;
while ((sz > 0) && (isspace(content[sz - 1]))) sz--; while ((sz > 0) && (isspace(content[sz - 1]))) sz--;
if ((uint)sz >= sizeof(tagName)) return false; if ((unsigned)sz >= sizeof(tagName)) return false;
strncpy(tagName, content, sz); strncpy(tagName, content, sz);
tagName[sz] = '\0'; tagName[sz] = '\0';
} }