mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
common: Pointer that can declare const are refactored to use const
Pointer and reference parameters should be "const" if the corresponding object is not modified
This commit is contained in:
parent
3c7adb0a95
commit
08c37978a9
16 changed files with 56 additions and 56 deletions
|
@ -165,7 +165,7 @@ TVG_EXPORT Tvg_Result tvg_paint_transform(Tvg_Paint* paint, const Tvg_Matrix* m)
|
|||
|
||||
TVG_EXPORT Tvg_Paint* tvg_paint_duplicate(Tvg_Paint* paint)
|
||||
{
|
||||
if (!paint) return NULL;
|
||||
if (!paint) return nullptr;
|
||||
return (Tvg_Paint*) reinterpret_cast<Paint*>(paint)->duplicate();
|
||||
}
|
||||
|
||||
|
@ -263,7 +263,7 @@ TVG_EXPORT Tvg_Result tvg_shape_append_circle(Tvg_Paint* paint, float cx, float
|
|||
TVG_EXPORT Tvg_Result tvg_shape_append_path(Tvg_Paint* paint, const Tvg_Path_Command* cmds, uint32_t cmdCnt, const Tvg_Point* pts, uint32_t ptsCnt)
|
||||
{
|
||||
if (!paint) return TVG_RESULT_INVALID_ARGUMENT;
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->appendPath((PathCommand*)cmds, cmdCnt, (Point*)pts, ptsCnt);
|
||||
return (Tvg_Result) reinterpret_cast<Shape*>(paint)->appendPath((const PathCommand*)cmds, cmdCnt, (const Point*)pts, ptsCnt);
|
||||
}
|
||||
|
||||
TVG_EXPORT Tvg_Result tvg_shape_get_path_coords(const Tvg_Paint* paint, const Tvg_Point** pts, uint32_t* cnt)
|
||||
|
|
|
@ -281,15 +281,15 @@ SwFixed mathCos(SwFixed angle);
|
|||
SwFixed mathSin(SwFixed angle);
|
||||
void mathSplitCubic(SwPoint* base);
|
||||
SwFixed mathDiff(SwFixed angle1, SwFixed angle2);
|
||||
SwFixed mathLength(SwPoint& pt);
|
||||
bool mathSmallCubic(SwPoint* base, SwFixed& angleIn, SwFixed& angleMid, SwFixed& angleOut);
|
||||
SwFixed mathLength(const SwPoint& pt);
|
||||
bool mathSmallCubic(const SwPoint* base, SwFixed& angleIn, SwFixed& angleMid, SwFixed& angleOut);
|
||||
SwFixed mathMean(SwFixed angle1, SwFixed angle2);
|
||||
SwPoint mathTransform(const Point* to, const Matrix* transform);
|
||||
|
||||
void shapeReset(SwShape* shape);
|
||||
bool shapeGenOutline(SwShape* shape, const Shape* sdata, unsigned tid, const Matrix* transform);
|
||||
bool shapePrepare(SwShape* shape, const Shape* sdata, unsigned tid, const SwSize& clip, const Matrix* transform, SwBBox& bbox);
|
||||
bool shapePrepared(SwShape* shape);
|
||||
bool shapePrepared(const SwShape* shape);
|
||||
bool shapeGenRle(SwShape* shape, const Shape* sdata, const SwSize& clip, bool antiAlias, bool hasComposite);
|
||||
void shapeDelOutline(SwShape* shape, uint32_t tid);
|
||||
void shapeResetStroke(SwShape* shape, const Shape* sdata, const Matrix* transform);
|
||||
|
@ -306,8 +306,8 @@ SwOutline* strokeExportOutline(SwStroke* stroke, unsigned tid);
|
|||
void strokeFree(SwStroke* stroke);
|
||||
|
||||
bool imagePrepare(SwImage* image, const Picture* pdata, unsigned tid, const SwSize& clip, const Matrix* transform, SwBBox& bbox);
|
||||
bool imagePrepared(SwImage* image);
|
||||
bool imageGenRle(SwImage* image, TVG_UNUSED const Picture* pdata, const SwSize& clip, SwBBox& bbox, bool antiAlias, bool hasComposite);
|
||||
bool imagePrepared(const SwImage* image);
|
||||
bool imageGenRle(SwImage* image, TVG_UNUSED const Picture* pdata, const SwSize& clip, const SwBBox& bbox, bool antiAlias, bool hasComposite);
|
||||
void imageDelOutline(SwImage* image, uint32_t tid);
|
||||
void imageReset(SwImage* image);
|
||||
bool imageGenOutline(SwImage* image, const Picture* pdata, unsigned tid, const Matrix* transform);
|
||||
|
@ -337,7 +337,7 @@ void mpoolRetStrokeOutline(unsigned idx);
|
|||
bool rasterCompositor(SwSurface* surface);
|
||||
bool rasterGradientShape(SwSurface* surface, SwShape* shape, unsigned id);
|
||||
bool rasterSolidShape(SwSurface* surface, SwShape* shape, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
|
||||
bool rasterImage(SwSurface* surface, SwImage* image, const Matrix* transform, SwBBox& bbox, uint32_t opacity);
|
||||
bool rasterImage(SwSurface* surface, SwImage* image, const Matrix* transform, const SwBBox& bbox, uint32_t opacity);
|
||||
bool rasterStroke(SwSurface* surface, SwShape* shape, uint8_t r, uint8_t g, uint8_t b, uint8_t a);
|
||||
bool rasterClear(SwSurface* surface);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#define FIXPT_SIZE (1<<FIXPT_BITS)
|
||||
|
||||
|
||||
static bool _updateColorTable(SwFill* fill, const Fill* fdata, SwSurface* surface, uint32_t opacity)
|
||||
static bool _updateColorTable(SwFill* fill, const Fill* fdata, const SwSurface* surface, uint32_t opacity)
|
||||
{
|
||||
if (!fill->ctable) {
|
||||
fill->ctable = static_cast<uint32_t*>(malloc(GRADIENT_STOP_SIZE * sizeof(uint32_t)));
|
||||
|
@ -311,4 +311,4 @@ void fillFree(SwFill* fill)
|
|||
if (fill->ctable) free(fill->ctable);
|
||||
|
||||
free(fill);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ static void _initBBox(SwBBox& bbox)
|
|||
}
|
||||
|
||||
|
||||
static bool _updateBBox(SwOutline* outline, SwBBox& bbox, const SwSize& clip)
|
||||
static bool _updateBBox(const SwOutline* outline, SwBBox& bbox, const SwSize& clip)
|
||||
{
|
||||
if (!outline) return false;
|
||||
|
||||
|
@ -102,13 +102,13 @@ bool imagePrepare(SwImage* image, const Picture* pdata, unsigned tid, const SwSi
|
|||
}
|
||||
|
||||
|
||||
bool imagePrepared(SwImage* image)
|
||||
bool imagePrepared(const SwImage* image)
|
||||
{
|
||||
return image->rle ? true : false;
|
||||
}
|
||||
|
||||
|
||||
bool imageGenRle(SwImage* image, TVG_UNUSED const Picture* pdata, const SwSize& clip, SwBBox& bbox, bool antiAlias, bool hasComposite)
|
||||
bool imageGenRle(SwImage* image, TVG_UNUSED const Picture* pdata, const SwSize& clip, const SwBBox& bbox, bool antiAlias, bool hasComposite)
|
||||
{
|
||||
if ((image->rle = rleRender(image->rle, image->outline, bbox, clip, antiAlias))) return true;
|
||||
|
||||
|
|
|
@ -194,7 +194,7 @@ SwFixed mathMean(SwFixed angle1, SwFixed angle2)
|
|||
}
|
||||
|
||||
|
||||
bool mathSmallCubic(SwPoint* base, SwFixed& angleIn, SwFixed& angleMid, SwFixed& angleOut)
|
||||
bool mathSmallCubic(const SwPoint* base, SwFixed& angleIn, SwFixed& angleMid, SwFixed& angleOut)
|
||||
{
|
||||
auto d1 = base[2] - base[3];
|
||||
auto d2 = base[1] - base[2];
|
||||
|
@ -362,7 +362,7 @@ SwFixed mathCos(SwFixed angle)
|
|||
}
|
||||
|
||||
|
||||
SwFixed mathLength(SwPoint& pt)
|
||||
SwFixed mathLength(const SwPoint& pt)
|
||||
{
|
||||
auto v = pt;
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ static bool _identify(const Matrix* transform)
|
|||
}
|
||||
|
||||
|
||||
static SwBBox _clipRegion(Surface* surface, SwBBox& in)
|
||||
static SwBBox _clipRegion(const Surface* surface, const SwBBox& in)
|
||||
{
|
||||
auto bbox = in;
|
||||
|
||||
|
@ -98,7 +98,7 @@ static SwBBox _clipRegion(Surface* surface, SwBBox& in)
|
|||
}
|
||||
|
||||
|
||||
static bool _translucent(SwSurface* surface, uint8_t a)
|
||||
static bool _translucent(const SwSurface* surface, uint8_t a)
|
||||
{
|
||||
if (a < 255) return true;
|
||||
if (!surface->compositor || surface->compositor->method == CompositeMethod::None) return false;
|
||||
|
@ -208,7 +208,7 @@ static bool _rasterSolidRect(SwSurface* surface, const SwBBox& region, uint32_t
|
|||
/************************************************************************/
|
||||
|
||||
|
||||
static bool _translucentRle(SwSurface* surface, SwRleData* rle, uint32_t color)
|
||||
static bool _translucentRle(SwSurface* surface, const SwRleData* rle, uint32_t color)
|
||||
{
|
||||
auto span = rle->spans;
|
||||
uint32_t src;
|
||||
|
@ -227,7 +227,7 @@ static bool _translucentRle(SwSurface* surface, SwRleData* rle, uint32_t color)
|
|||
}
|
||||
|
||||
|
||||
static bool _translucentRleAlphaMask(SwSurface* surface, SwRleData* rle, uint32_t color)
|
||||
static bool _translucentRleAlphaMask(SwSurface* surface, const SwRleData* rle, uint32_t color)
|
||||
{
|
||||
#ifdef THORVG_LOG_ENABLED
|
||||
printf("SW_ENGINE: Rle Alpha Mask Composition\n");
|
||||
|
@ -298,7 +298,7 @@ static bool _rasterTranslucentRle(SwSurface* surface, SwRleData* rle, uint32_t c
|
|||
}
|
||||
|
||||
|
||||
static bool _rasterSolidRle(SwSurface* surface, SwRleData* rle, uint32_t color)
|
||||
static bool _rasterSolidRle(SwSurface* surface, const SwRleData* rle, uint32_t color)
|
||||
{
|
||||
if (!rle) return false;
|
||||
|
||||
|
@ -325,7 +325,7 @@ static bool _rasterSolidRle(SwSurface* surface, SwRleData* rle, uint32_t color)
|
|||
/* Image */
|
||||
/************************************************************************/
|
||||
|
||||
static bool _rasterTranslucentImageRle(SwSurface* surface, SwRleData* rle, uint32_t *img, uint32_t w, uint32_t h, uint32_t opacity)
|
||||
static bool _rasterTranslucentImageRle(SwSurface* surface, const SwRleData* rle, uint32_t *img, uint32_t w, uint32_t h, uint32_t opacity)
|
||||
{
|
||||
auto span = rle->spans;
|
||||
|
||||
|
@ -342,7 +342,7 @@ static bool _rasterTranslucentImageRle(SwSurface* surface, SwRleData* rle, uint3
|
|||
}
|
||||
|
||||
|
||||
static bool _rasterTranslucentImageRle(SwSurface* surface, SwRleData* rle, uint32_t *img, uint32_t w, uint32_t h, uint32_t opacity, const Matrix* invTransform)
|
||||
static bool _rasterTranslucentImageRle(SwSurface* surface, const SwRleData* rle, uint32_t *img, uint32_t w, uint32_t h, uint32_t opacity, const Matrix* invTransform)
|
||||
{
|
||||
auto span = rle->spans;
|
||||
|
||||
|
@ -401,7 +401,7 @@ static bool _rasterImageRle(SwSurface* surface, SwRleData* rle, uint32_t *img, u
|
|||
}
|
||||
|
||||
|
||||
static bool _translucentImage(SwSurface* surface, uint32_t *img, uint32_t w, uint32_t h, uint32_t opacity, const SwBBox& region, const Matrix* invTransform)
|
||||
static bool _translucentImage(SwSurface* surface, const uint32_t *img, uint32_t w, uint32_t h, uint32_t opacity, const SwBBox& region, const Matrix* invTransform)
|
||||
{
|
||||
for (auto y = region.min.y; y < region.max.y; ++y) {
|
||||
auto dst = &surface->buffer[y * surface->stride + region.min.x];
|
||||
|
@ -419,7 +419,7 @@ static bool _translucentImage(SwSurface* surface, uint32_t *img, uint32_t w, uin
|
|||
}
|
||||
|
||||
|
||||
static bool _translucentImageAlphaMask(SwSurface* surface, uint32_t *img, uint32_t w, uint32_t h, uint32_t opacity, const SwBBox& region, const Matrix* invTransform)
|
||||
static bool _translucentImageAlphaMask(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
|
||||
printf("SW_ENGINE: Transformed Image Alpha Mask Composition\n");
|
||||
|
@ -440,7 +440,7 @@ static bool _translucentImageAlphaMask(SwSurface* surface, uint32_t *img, uint32
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool _translucentImageInvAlphaMask(SwSurface* surface, 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
|
||||
printf("SW_ENGINE: Transformed Image Alpha Mask Composition\n");
|
||||
|
@ -461,7 +461,7 @@ static bool _translucentImageInvAlphaMask(SwSurface* surface, uint32_t *img, uin
|
|||
return true;
|
||||
}
|
||||
|
||||
static bool _rasterTranslucentImage(SwSurface* surface, uint32_t *img, uint32_t w, uint32_t h, uint32_t opacity, const SwBBox& region, const Matrix* invTransform)
|
||||
static bool _rasterTranslucentImage(SwSurface* surface, const uint32_t *img, uint32_t w, uint32_t h, uint32_t opacity, const SwBBox& region, const Matrix* invTransform)
|
||||
{
|
||||
if (surface->compositor) {
|
||||
if (surface->compositor->method == CompositeMethod::AlphaMask) {
|
||||
|
@ -568,7 +568,7 @@ static bool _rasterImage(SwSurface* surface, uint32_t *img, uint32_t w, uint32_t
|
|||
}
|
||||
|
||||
|
||||
static bool _rasterImage(SwSurface* surface, uint32_t *img, uint32_t w, uint32_t h, const SwBBox& region, const Matrix* invTransform)
|
||||
static bool _rasterImage(SwSurface* surface, const uint32_t *img, uint32_t w, uint32_t h, const SwBBox& region, const Matrix* invTransform)
|
||||
{
|
||||
for (auto y = region.min.y; y < region.max.y; ++y) {
|
||||
auto dst = &surface->buffer[y * surface->stride + region.min.x];
|
||||
|
@ -653,7 +653,7 @@ static bool _rasterRadialGradientRect(SwSurface* surface, const SwBBox& region,
|
|||
}
|
||||
|
||||
|
||||
static bool _rasterLinearGradientRle(SwSurface* surface, SwRleData* rle, const SwFill* fill)
|
||||
static bool _rasterLinearGradientRle(SwSurface* surface, const SwRleData* rle, const SwFill* fill)
|
||||
{
|
||||
if (!rle || !fill || fill->linear.len < FLT_EPSILON) return false;
|
||||
|
||||
|
@ -699,7 +699,7 @@ static bool _rasterLinearGradientRle(SwSurface* surface, SwRleData* rle, const S
|
|||
}
|
||||
|
||||
|
||||
static bool _rasterRadialGradientRle(SwSurface* surface, SwRleData* rle, const SwFill* fill)
|
||||
static bool _rasterRadialGradientRle(SwSurface* surface, const SwRleData* rle, const SwFill* fill)
|
||||
{
|
||||
if (!rle || !fill || fill->radial.a < FLT_EPSILON) return false;
|
||||
|
||||
|
@ -832,7 +832,7 @@ bool rasterClear(SwSurface* surface)
|
|||
}
|
||||
|
||||
|
||||
bool rasterImage(SwSurface* surface, SwImage* image, const Matrix* transform, SwBBox& bbox, uint32_t opacity)
|
||||
bool rasterImage(SwSurface* surface, SwImage* image, const Matrix* transform, const SwBBox& bbox, uint32_t opacity)
|
||||
{
|
||||
Matrix invTransform;
|
||||
|
||||
|
|
|
@ -468,7 +468,7 @@ bool SwRenderer::dispose(RenderData data)
|
|||
}
|
||||
|
||||
|
||||
void* SwRenderer::prepareCommon(SwTask* task, const RenderTransform* transform, uint32_t opacity, Array<RenderData>& clips, RenderUpdateFlag flags)
|
||||
void* SwRenderer::prepareCommon(SwTask* task, const RenderTransform* transform, uint32_t opacity, const Array<RenderData>& clips, RenderUpdateFlag flags)
|
||||
{
|
||||
if (flags == RenderUpdateFlag::None) return task;
|
||||
|
||||
|
|
|
@ -63,7 +63,7 @@ private:
|
|||
SwRenderer(){};
|
||||
~SwRenderer();
|
||||
|
||||
RenderData prepareCommon(SwTask* task, const RenderTransform* transform, uint32_t opacity, Array<RenderData>& clips, RenderUpdateFlag flags);
|
||||
RenderData prepareCommon(SwTask* task, const RenderTransform* transform, uint32_t opacity, const Array<RenderData>& clips, RenderUpdateFlag flags);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -135,7 +135,7 @@ static inline SwCoord HYPOT(SwPoint pt)
|
|||
return ((pt.x > pt.y) ? (pt.x + (3 * pt.y >> 3)) : (pt.y + (3 * pt.x >> 3)));
|
||||
}
|
||||
|
||||
static void _genSpan(SwRleData* rle, SwSpan* spans, uint32_t count)
|
||||
static void _genSpan(SwRleData* rle, const SwSpan* spans, uint32_t count)
|
||||
{
|
||||
auto newSize = rle->size + count;
|
||||
|
||||
|
@ -915,7 +915,7 @@ void rleFree(SwRleData* rle)
|
|||
free(rle);
|
||||
}
|
||||
|
||||
void updateRleSpans(SwRleData *rle, SwSpan* curSpans, uint32_t size)
|
||||
void updateRleSpans(SwRleData *rle, const SwSpan* curSpans, uint32_t size)
|
||||
{
|
||||
if (size == 0) {
|
||||
rle->size = 0;
|
||||
|
|
|
@ -164,7 +164,7 @@ static void _initBBox(SwBBox& bbox)
|
|||
}
|
||||
|
||||
|
||||
static bool _updateBBox(SwOutline* outline, SwBBox& bbox)
|
||||
static bool _updateBBox(const SwOutline* outline, SwBBox& bbox)
|
||||
{
|
||||
if (!outline) return false;
|
||||
|
||||
|
@ -434,7 +434,7 @@ bool shapePrepare(SwShape* shape, const Shape* sdata, unsigned tid, const SwSize
|
|||
}
|
||||
|
||||
|
||||
bool shapePrepared(SwShape* shape)
|
||||
bool shapePrepared(const SwShape* shape)
|
||||
{
|
||||
return shape->rle ? true : false;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ static inline SwFixed SIDE_TO_ROTATE(const int32_t s)
|
|||
}
|
||||
|
||||
|
||||
static inline void SCALE(SwStroke& stroke, SwPoint& pt)
|
||||
static inline void SCALE(const SwStroke& stroke, SwPoint& pt)
|
||||
{
|
||||
pt.x *= stroke.sx;
|
||||
pt.y *= stroke.sy;
|
||||
|
@ -113,7 +113,7 @@ static void _borderClose(SwStrokeBorder* border, bool reverse)
|
|||
}
|
||||
|
||||
|
||||
static void _borderCubicTo(SwStrokeBorder* border, SwPoint& ctrl1, SwPoint& ctrl2, SwPoint& to)
|
||||
static void _borderCubicTo(SwStrokeBorder* border, const SwPoint& ctrl1, const SwPoint& ctrl2, const SwPoint& to)
|
||||
{
|
||||
_growBorder(border, 3);
|
||||
|
||||
|
@ -134,7 +134,7 @@ static void _borderCubicTo(SwStrokeBorder* border, SwPoint& ctrl1, SwPoint& ctrl
|
|||
}
|
||||
|
||||
|
||||
static void _borderArcTo(SwStrokeBorder* border, SwPoint& center, SwFixed radius, SwFixed angleStart, SwFixed angleDiff, SwStroke& stroke)
|
||||
static void _borderArcTo(SwStrokeBorder* border, const SwPoint& center, SwFixed radius, SwFixed angleStart, SwFixed angleDiff, SwStroke& stroke)
|
||||
{
|
||||
constexpr SwFixed ARC_CUBIC_ANGLE = SW_ANGLE_PI / 2;
|
||||
SwPoint a = {static_cast<SwCoord>(radius), 0};
|
||||
|
@ -187,7 +187,7 @@ static void _borderArcTo(SwStrokeBorder* border, SwPoint& center, SwFixed radius
|
|||
}
|
||||
|
||||
|
||||
static void _borderLineTo(SwStrokeBorder* border, SwPoint& to, bool movable)
|
||||
static void _borderLineTo(SwStrokeBorder* border, const SwPoint& to, bool movable)
|
||||
{
|
||||
if (border->movable) {
|
||||
//move last point
|
||||
|
@ -660,7 +660,7 @@ static void _addReverseLeft(SwStroke& stroke, bool opened)
|
|||
}
|
||||
|
||||
|
||||
static void _beginSubPath(SwStroke& stroke, SwPoint& to, bool opened)
|
||||
static void _beginSubPath(SwStroke& stroke, const SwPoint& to, bool opened)
|
||||
{
|
||||
/* We cannot process the first point because there is not enough
|
||||
information regarding its corner/cap. Later, it will be processed
|
||||
|
@ -771,7 +771,7 @@ fail:
|
|||
}
|
||||
|
||||
|
||||
static void _exportBorderOutline(SwStroke& stroke, SwOutline* outline, uint32_t side)
|
||||
static void _exportBorderOutline(const SwStroke& stroke, SwOutline* outline, uint32_t side)
|
||||
{
|
||||
auto border = stroke.borders + side;
|
||||
|
||||
|
@ -930,4 +930,4 @@ SwOutline* strokeExportOutline(SwStroke* stroke, unsigned tid)
|
|||
_exportBorderOutline(*stroke, outline, 1); //right
|
||||
|
||||
return outline;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,4 +80,4 @@ unique_ptr<GlCanvas> GlCanvas::gen() noexcept
|
|||
return unique_ptr<GlCanvas>(new GlCanvas);
|
||||
#endif
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ unique_ptr<Loader> LoaderMgr::loader(const char* data, uint32_t size)
|
|||
}
|
||||
|
||||
|
||||
unique_ptr<Loader> LoaderMgr::loader(uint32_t *data, uint32_t w, uint32_t h, bool copy)
|
||||
unique_ptr<Loader> LoaderMgr::loader(const uint32_t *data, uint32_t w, uint32_t h, bool copy)
|
||||
{
|
||||
for (int i = 0; i < static_cast<int>(FileType::Unknown); i++) {
|
||||
auto loader = _find(static_cast<FileType>(i));
|
||||
|
|
|
@ -32,7 +32,7 @@ struct LoaderMgr
|
|||
static bool term();
|
||||
static unique_ptr<Loader> loader(const string& path);
|
||||
static unique_ptr<Loader> loader(const char* data, uint32_t size);
|
||||
static unique_ptr<Loader> loader(uint32_t* data, uint32_t w, uint32_t h, bool copy);
|
||||
static unique_ptr<Loader> loader(const uint32_t* data, uint32_t w, uint32_t h, bool copy);
|
||||
};
|
||||
|
||||
#endif //_TVG_LOADER_MGR_H_
|
||||
|
|
|
@ -79,7 +79,7 @@ static bool _parseNumber(const char** content, float* number)
|
|||
* Since this documentation is not obvious, more clean recalculation with dpi
|
||||
* is required, but for now default w3 constants would be used
|
||||
*/
|
||||
static float _toFloat(SvgParser* svgParse, const char* str, SvgParserLengthType type)
|
||||
static float _toFloat(const SvgParser* svgParse, const char* str, SvgParserLengthType type)
|
||||
{
|
||||
float parsedValue = strtof(str, nullptr);
|
||||
|
||||
|
@ -106,7 +106,7 @@ static float _toFloat(SvgParser* svgParse, const char* str, SvgParserLengthType
|
|||
}
|
||||
|
||||
|
||||
static float _gradientToFloat(SvgParser* svgParse, const char* str, SvgParserLengthType type)
|
||||
static float _gradientToFloat(const SvgParser* svgParse, const char* str, SvgParserLengthType type)
|
||||
{
|
||||
char* end = nullptr;
|
||||
|
||||
|
@ -1467,7 +1467,7 @@ static SvgNode* _getDefsNode(SvgNode* node)
|
|||
}
|
||||
|
||||
|
||||
static SvgNode* _findChildById(SvgNode* node, const char* id)
|
||||
static SvgNode* _findChildById(const SvgNode* node, const char* id)
|
||||
{
|
||||
if (!node) return nullptr;
|
||||
|
||||
|
@ -1493,7 +1493,7 @@ static SvgNode* _findNodeById(SvgNode *node, string* id)
|
|||
return result;
|
||||
}
|
||||
|
||||
static void _cloneGradStops(Array<Fill::ColorStop*>* dst, Array<Fill::ColorStop*>* src)
|
||||
static void _cloneGradStops(Array<Fill::ColorStop*>* dst, const Array<Fill::ColorStop*>* src)
|
||||
{
|
||||
for (uint32_t i = 0; i < src->count; ++i) {
|
||||
auto stop = static_cast<Fill::ColorStop *>(malloc(sizeof(Fill::ColorStop)));
|
||||
|
@ -1543,7 +1543,7 @@ error_grad_alloc:
|
|||
}
|
||||
|
||||
|
||||
static void _copyAttr(SvgNode* to, SvgNode* from)
|
||||
static void _copyAttr(SvgNode* to, const SvgNode* from)
|
||||
{
|
||||
//Copy matrix attribute
|
||||
if (from->transform) {
|
||||
|
@ -2226,7 +2226,7 @@ static bool _svgLoaderParser(void* data, SimpleXMLType type, const char* content
|
|||
}
|
||||
|
||||
|
||||
static void _styleInherit(SvgStyleProperty* child, SvgStyleProperty* parent)
|
||||
static void _styleInherit(SvgStyleProperty* child, const SvgStyleProperty* parent)
|
||||
{
|
||||
if (parent == nullptr) return;
|
||||
//Inherit the property of parent if not present in child.
|
||||
|
@ -2329,7 +2329,7 @@ static void _updateStyle(SvgNode* node, SvgStyleProperty* parentStyle)
|
|||
}
|
||||
|
||||
|
||||
static SvgStyleGradient* _gradientDup(Array<SvgStyleGradient*>* gradients, string* id)
|
||||
static SvgStyleGradient* _gradientDup(Array<SvgStyleGradient*>* gradients, const string* id)
|
||||
{
|
||||
SvgStyleGradient* result = nullptr;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ bool _isGroupType(SvgNodeType type)
|
|||
return false;
|
||||
}
|
||||
|
||||
unique_ptr<LinearGradient> _applyLinearGradientProperty(SvgStyleGradient* g, Shape* vg, float rx, float ry, float rw, float rh)
|
||||
unique_ptr<LinearGradient> _applyLinearGradientProperty(SvgStyleGradient* g, const Shape* vg, float rx, float ry, float rw, float rh)
|
||||
{
|
||||
Fill::ColorStop* stops;
|
||||
int stopCount = 0;
|
||||
|
@ -114,7 +114,7 @@ unique_ptr<LinearGradient> _applyLinearGradientProperty(SvgStyleGradient* g, Sha
|
|||
}
|
||||
|
||||
|
||||
unique_ptr<RadialGradient> _applyRadialGradientProperty(SvgStyleGradient* g, Shape* vg, float rx, float ry, float rw, float rh)
|
||||
unique_ptr<RadialGradient> _applyRadialGradientProperty(SvgStyleGradient* g, const Shape* vg, float rx, float ry, float rw, float rh)
|
||||
{
|
||||
Fill::ColorStop *stops;
|
||||
int stopCount = 0;
|
||||
|
@ -339,7 +339,7 @@ bool _appendShape(SvgNode* node, Shape* shape, float vx, float vy, float vw, flo
|
|||
return true;
|
||||
}
|
||||
|
||||
unique_ptr<Scene> _sceneBuildHelper(SvgNode* node, float vx, float vy, float vw, float vh)
|
||||
unique_ptr<Scene> _sceneBuildHelper(const SvgNode* node, float vx, float vy, float vw, float vh)
|
||||
{
|
||||
if (_isGroupType(node->type)) {
|
||||
auto scene = Scene::gen();
|
||||
|
|
Loading…
Add table
Reference in a new issue