mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
common/array: code refactoring
Make the array interface pair begin()/end() for consistency.
This commit is contained in:
parent
6d98e16cae
commit
043b6b9f4f
14 changed files with 60 additions and 50 deletions
|
@ -90,6 +90,16 @@ struct Array
|
||||||
return data[idx];
|
return data[idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const T* begin() const
|
||||||
|
{
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
|
T* begin()
|
||||||
|
{
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
|
||||||
T* end()
|
T* end()
|
||||||
{
|
{
|
||||||
return data + count;
|
return data + count;
|
||||||
|
|
|
@ -360,11 +360,11 @@ static void _repeat(LottieGroup* parent, unique_ptr<Shape> path, RenderContext*
|
||||||
|
|
||||||
//push repeat shapes in order.
|
//push repeat shapes in order.
|
||||||
if (repeater->inorder) {
|
if (repeater->inorder) {
|
||||||
for (auto shape = shapes.data; shape < shapes.end(); ++shape) {
|
for (auto shape = shapes.begin(); shape < shapes.end(); ++shape) {
|
||||||
parent->scene->push(cast(*shape));
|
parent->scene->push(cast(*shape));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (auto shape = shapes.end() - 1; shape >= shapes.data; --shape) {
|
for (auto shape = shapes.end() - 1; shape >= shapes.begin(); --shape) {
|
||||||
parent->scene->push(cast(*shape));
|
parent->scene->push(cast(*shape));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -454,15 +454,15 @@ static void _updateText(LottieGroup* parent, LottieObject** child, float frameNo
|
||||||
//text string
|
//text string
|
||||||
while (*p != '\0') {
|
while (*p != '\0') {
|
||||||
//find the glyph
|
//find the glyph
|
||||||
for (auto g = text->font->chars.data; g < text->font->chars.end(); ++g) {
|
for (auto g = text->font->chars.begin(); g < text->font->chars.end(); ++g) {
|
||||||
auto glyph = *g;
|
auto glyph = *g;
|
||||||
//draw matched glyphs
|
//draw matched glyphs
|
||||||
if (!strncmp(glyph->code, p, glyph->len)) {
|
if (!strncmp(glyph->code, p, glyph->len)) {
|
||||||
//TODO: caching?
|
//TODO: caching?
|
||||||
auto shape = Shape::gen();
|
auto shape = Shape::gen();
|
||||||
for (auto g = glyph->children.data; g < glyph->children.end(); ++g) {
|
for (auto g = glyph->children.begin(); g < glyph->children.end(); ++g) {
|
||||||
auto group = static_cast<LottieGroup*>(*g);
|
auto group = static_cast<LottieGroup*>(*g);
|
||||||
for (auto p = group->children.data; p < group->children.end(); ++p) {
|
for (auto p = group->children.begin(); p < group->children.end(); ++p) {
|
||||||
if (static_cast<LottiePath*>(*p)->pathset(frameNo, P(shape)->rs.path.cmds, P(shape)->rs.path.pts)) {
|
if (static_cast<LottiePath*>(*p)->pathset(frameNo, P(shape)->rs.path.cmds, P(shape)->rs.path.pts)) {
|
||||||
P(shape)->update(RenderUpdateFlag::Path);
|
P(shape)->update(RenderUpdateFlag::Path);
|
||||||
}
|
}
|
||||||
|
@ -889,7 +889,7 @@ static void _updatePrecomp(LottieLayer* precomp, float frameNo)
|
||||||
|
|
||||||
frameNo = precomp->remap(frameNo);
|
frameNo = precomp->remap(frameNo);
|
||||||
|
|
||||||
for (auto child = precomp->children.end() - 1; child >= precomp->children.data; --child) {
|
for (auto child = precomp->children.end() - 1; child >= precomp->children.begin(); --child) {
|
||||||
_updateLayer(precomp, static_cast<LottieLayer*>(*child), frameNo);
|
_updateLayer(precomp, static_cast<LottieLayer*>(*child), frameNo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -925,7 +925,7 @@ static void _updateMaskings(LottieLayer* layer, float frameNo)
|
||||||
Shape* pmask = nullptr;
|
Shape* pmask = nullptr;
|
||||||
auto pmethod = CompositeMethod::AlphaMask;
|
auto pmethod = CompositeMethod::AlphaMask;
|
||||||
|
|
||||||
for (auto m = layer->masks.data; m < layer->masks.end(); ++m) {
|
for (auto m = layer->masks.begin(); m < layer->masks.end(); ++m) {
|
||||||
auto mask = static_cast<LottieMask*>(*m);
|
auto mask = static_cast<LottieMask*>(*m);
|
||||||
auto shape = Shape::gen().release();
|
auto shape = Shape::gen().release();
|
||||||
shape->fill(255, 255, 255, mask->opacity(frameNo));
|
shape->fill(255, 255, 255, mask->opacity(frameNo));
|
||||||
|
@ -1029,7 +1029,7 @@ static void _updateLayer(LottieLayer* root, LottieLayer* layer, float frameNo)
|
||||||
|
|
||||||
static void _buildReference(LottieComposition* comp, LottieLayer* layer)
|
static void _buildReference(LottieComposition* comp, LottieLayer* layer)
|
||||||
{
|
{
|
||||||
for (auto asset = comp->assets.data; asset < comp->assets.end(); ++asset) {
|
for (auto asset = comp->assets.begin(); asset < comp->assets.end(); ++asset) {
|
||||||
if (strcmp(layer->refId, (*asset)->name)) continue;
|
if (strcmp(layer->refId, (*asset)->name)) continue;
|
||||||
if (layer->type == LottieLayer::Precomp) {
|
if (layer->type == LottieLayer::Precomp) {
|
||||||
auto assetLayer = static_cast<LottieLayer*>(*asset);
|
auto assetLayer = static_cast<LottieLayer*>(*asset);
|
||||||
|
@ -1055,7 +1055,7 @@ static void _bulidHierarchy(LottieGroup* parent, LottieLayer* child)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto p = parent->children.data; p < parent->children.end(); ++p) {
|
for (auto p = parent->children.begin(); p < parent->children.end(); ++p) {
|
||||||
auto parent = static_cast<LottieLayer*>(*p);
|
auto parent = static_cast<LottieLayer*>(*p);
|
||||||
if (child == parent) continue;
|
if (child == parent) continue;
|
||||||
if (child->pid == parent->id) {
|
if (child->pid == parent->id) {
|
||||||
|
@ -1073,7 +1073,7 @@ static void _bulidHierarchy(LottieGroup* parent, LottieLayer* child)
|
||||||
static void _attachFont(LottieComposition* comp, LottieLayer* parent)
|
static void _attachFont(LottieComposition* comp, LottieLayer* parent)
|
||||||
{
|
{
|
||||||
//TODO: Consider to migrate this attachment to the frame update time.
|
//TODO: Consider to migrate this attachment to the frame update time.
|
||||||
for (auto c = parent->children.data; c < parent->children.end(); ++c) {
|
for (auto c = parent->children.begin(); c < parent->children.end(); ++c) {
|
||||||
auto text = static_cast<LottieText*>(*c);
|
auto text = static_cast<LottieText*>(*c);
|
||||||
auto& doc = text->doc(0);
|
auto& doc = text->doc(0);
|
||||||
if (!doc.name) continue;
|
if (!doc.name) continue;
|
||||||
|
@ -1096,7 +1096,7 @@ static bool _buildComposition(LottieComposition* comp, LottieGroup* parent)
|
||||||
if (parent->buildDone) return true;
|
if (parent->buildDone) return true;
|
||||||
parent->buildDone = true;
|
parent->buildDone = true;
|
||||||
|
|
||||||
for (auto c = parent->children.data; c < parent->children.end(); ++c) {
|
for (auto c = parent->children.begin(); c < parent->children.end(); ++c) {
|
||||||
auto child = static_cast<LottieLayer*>(*c);
|
auto child = static_cast<LottieLayer*>(*c);
|
||||||
|
|
||||||
//attach the precomp layer.
|
//attach the precomp layer.
|
||||||
|
@ -1135,7 +1135,7 @@ bool LottieBuilder::update(LottieComposition* comp, float frameNo)
|
||||||
auto root = comp->root;
|
auto root = comp->root;
|
||||||
root->scene->clear();
|
root->scene->clear();
|
||||||
|
|
||||||
for (auto child = root->children.end() - 1; child >= root->children.data; --child) {
|
for (auto child = root->children.end() - 1; child >= root->children.begin(); --child) {
|
||||||
_updateLayer(root, static_cast<LottieLayer*>(*child), frameNo);
|
_updateLayer(root, static_cast<LottieLayer*>(*child), frameNo);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -141,7 +141,7 @@ void LottieGroup::prepare(LottieObject::Type type)
|
||||||
size_t strokeCnt = 0;
|
size_t strokeCnt = 0;
|
||||||
size_t fillCnt = 0;
|
size_t fillCnt = 0;
|
||||||
|
|
||||||
for (auto c = children.end() - 1; c >= children.data; --c) {
|
for (auto c = children.end() - 1; c >= children.begin(); --c) {
|
||||||
if (reqFragment && !statical) break;
|
if (reqFragment && !statical) break;
|
||||||
auto child = static_cast<LottieObject*>(*c);
|
auto child = static_cast<LottieObject*>(*c);
|
||||||
if (statical) statical &= child->statical;
|
if (statical) statical &= child->statical;
|
||||||
|
@ -170,7 +170,7 @@ LottieLayer::~LottieLayer()
|
||||||
free(refId);
|
free(refId);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto m = masks.data; m < masks.end(); ++m) {
|
for (auto m = masks.begin(); m < masks.end(); ++m) {
|
||||||
delete(*m);
|
delete(*m);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -214,18 +214,18 @@ LottieComposition::~LottieComposition()
|
||||||
free(name);
|
free(name);
|
||||||
|
|
||||||
//delete interpolators
|
//delete interpolators
|
||||||
for (auto i = interpolators.data; i < interpolators.end(); ++i) {
|
for (auto i = interpolators.begin(); i < interpolators.end(); ++i) {
|
||||||
free((*i)->key);
|
free((*i)->key);
|
||||||
free(*i);
|
free(*i);
|
||||||
}
|
}
|
||||||
|
|
||||||
//delete assets
|
//delete assets
|
||||||
for (auto a = assets.data; a < assets.end(); ++a) {
|
for (auto a = assets.begin(); a < assets.end(); ++a) {
|
||||||
delete(*a);
|
delete(*a);
|
||||||
}
|
}
|
||||||
|
|
||||||
//delete fonts
|
//delete fonts
|
||||||
for (auto f = fonts.data; f < fonts.end(); ++f) {
|
for (auto f = fonts.begin(); f < fonts.end(); ++f) {
|
||||||
delete(*f);
|
delete(*f);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -164,7 +164,7 @@ struct LottieGradient
|
||||||
bool prepare()
|
bool prepare()
|
||||||
{
|
{
|
||||||
if (colorStops.frames) {
|
if (colorStops.frames) {
|
||||||
for (auto v = colorStops.frames->data; v < colorStops.frames->end(); ++v) {
|
for (auto v = colorStops.frames->begin(); v < colorStops.frames->end(); ++v) {
|
||||||
colorStops.count = populate(v->value);
|
colorStops.count = populate(v->value);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -253,7 +253,7 @@ struct LottieGlyph
|
||||||
|
|
||||||
~LottieGlyph()
|
~LottieGlyph()
|
||||||
{
|
{
|
||||||
for (auto p = children.data; p < children.end(); ++p) delete(*p);
|
for (auto p = children.begin(); p < children.end(); ++p) delete(*p);
|
||||||
free(code);
|
free(code);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -265,7 +265,7 @@ struct LottieFont
|
||||||
|
|
||||||
~LottieFont()
|
~LottieFont()
|
||||||
{
|
{
|
||||||
for (auto c = chars.data; c < chars.end(); ++c) delete(*c);
|
for (auto c = chars.begin(); c < chars.end(); ++c) delete(*c);
|
||||||
free(style);
|
free(style);
|
||||||
free(family);
|
free(family);
|
||||||
free(name);
|
free(name);
|
||||||
|
@ -524,7 +524,7 @@ struct LottieGroup : LottieObject
|
||||||
{
|
{
|
||||||
virtual ~LottieGroup()
|
virtual ~LottieGroup()
|
||||||
{
|
{
|
||||||
for (auto p = children.data; p < children.end(); ++p) delete(*p);
|
for (auto p = children.begin(); p < children.end(); ++p) delete(*p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void prepare(LottieObject::Type type = LottieObject::Group);
|
void prepare(LottieObject::Type type = LottieObject::Group);
|
||||||
|
|
|
@ -209,9 +209,9 @@ void LottieParser::getValue(PathSet& path)
|
||||||
if (ins.count != outs.count || outs.count != pts.count) return;
|
if (ins.count != outs.count || outs.count != pts.count) return;
|
||||||
|
|
||||||
//convert path
|
//convert path
|
||||||
auto out = outs.data;
|
auto out = outs.begin();
|
||||||
auto in = ins.data;
|
auto in = ins.begin();
|
||||||
auto pt = pts.data;
|
auto pt = pts.begin();
|
||||||
|
|
||||||
//Store manipulated results
|
//Store manipulated results
|
||||||
Array<Point> outPts;
|
Array<Point> outPts;
|
||||||
|
@ -379,7 +379,7 @@ LottieInterpolator* LottieParser::getInterpolator(const char* key, Point& in, Po
|
||||||
LottieInterpolator* interpolator = nullptr;
|
LottieInterpolator* interpolator = nullptr;
|
||||||
|
|
||||||
//get a cached interpolator if it has any.
|
//get a cached interpolator if it has any.
|
||||||
for (auto i = comp->interpolators.data; i < comp->interpolators.end(); ++i) {
|
for (auto i = comp->interpolators.begin(); i < comp->interpolators.end(); ++i) {
|
||||||
if (!strncmp((*i)->key, key, sizeof(buf))) interpolator = *i;
|
if (!strncmp((*i)->key, key, sizeof(buf))) interpolator = *i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -263,7 +263,7 @@ struct LottiePathSet
|
||||||
free(value.pts);
|
free(value.pts);
|
||||||
|
|
||||||
if (!frames) return;
|
if (!frames) return;
|
||||||
for (auto p = frames->data; p < frames->end(); ++p) {
|
for (auto p = frames->begin(); p < frames->end(); ++p) {
|
||||||
free((*p).value.cmds);
|
free((*p).value.cmds);
|
||||||
free((*p).value.pts);
|
free((*p).value.pts);
|
||||||
}
|
}
|
||||||
|
@ -353,7 +353,7 @@ struct LottieColorStop
|
||||||
{
|
{
|
||||||
free(value.data);
|
free(value.data);
|
||||||
if (!frames) return;
|
if (!frames) return;
|
||||||
for (auto p = frames->data; p < frames->end(); ++p) {
|
for (auto p = frames->begin(); p < frames->end(); ++p) {
|
||||||
free((*p).value.data);
|
free((*p).value.data);
|
||||||
}
|
}
|
||||||
free(frames->data);
|
free(frames->data);
|
||||||
|
@ -486,7 +486,7 @@ struct LottiePosition
|
||||||
void prepare()
|
void prepare()
|
||||||
{
|
{
|
||||||
if (!frames || frames->count < 2) return;
|
if (!frames || frames->count < 2) return;
|
||||||
for (auto frame = frames->data + 1; frame < frames->end(); ++frame) {
|
for (auto frame = frames->begin() + 1; frame < frames->end(); ++frame) {
|
||||||
(frame - 1)->prepare(frame);
|
(frame - 1)->prepare(frame);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -504,7 +504,7 @@ struct LottieTextDoc
|
||||||
free(value.name);
|
free(value.name);
|
||||||
|
|
||||||
if (!frames) return;
|
if (!frames) return;
|
||||||
for (auto p = frames->data; p < frames->end(); ++p) {
|
for (auto p = frames->begin(); p < frames->end(); ++p) {
|
||||||
free((*p).value.text);
|
free((*p).value.text);
|
||||||
free((*p).value.name);
|
free((*p).value.name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -3495,7 +3495,7 @@ void SvgLoader::clear(bool all)
|
||||||
free(loaderData.svgParse);
|
free(loaderData.svgParse);
|
||||||
loaderData.svgParse = nullptr;
|
loaderData.svgParse = nullptr;
|
||||||
|
|
||||||
for (auto gradient = loaderData.gradients.data; gradient < loaderData.gradients.end(); ++gradient) {
|
for (auto gradient = loaderData.gradients.begin(); gradient < loaderData.gradients.end(); ++gradient) {
|
||||||
(*gradient)->clear();
|
(*gradient)->clear();
|
||||||
free(*gradient);
|
free(*gradient);
|
||||||
}
|
}
|
||||||
|
@ -3507,7 +3507,7 @@ void SvgLoader::clear(bool all)
|
||||||
|
|
||||||
if (!all) return;
|
if (!all) return;
|
||||||
|
|
||||||
for (auto p = loaderData.images.data; p < loaderData.images.end(); ++p) {
|
for (auto p = loaderData.images.begin(); p < loaderData.images.end(); ++p) {
|
||||||
free(*p);
|
free(*p);
|
||||||
}
|
}
|
||||||
loaderData.images.reset();
|
loaderData.images.reset();
|
||||||
|
|
|
@ -409,7 +409,7 @@ static bool _recognizeShape(SvgNode* node, Shape* shape)
|
||||||
}
|
}
|
||||||
case SvgNodeType::Polygon: {
|
case SvgNodeType::Polygon: {
|
||||||
if (node->node.polygon.pts.count < 2) break;
|
if (node->node.polygon.pts.count < 2) break;
|
||||||
auto pts = node->node.polygon.pts.data;
|
auto pts = node->node.polygon.pts.begin();
|
||||||
shape->moveTo(pts[0], pts[1]);
|
shape->moveTo(pts[0], pts[1]);
|
||||||
for (pts += 2; pts < node->node.polygon.pts.end(); pts += 2) {
|
for (pts += 2; pts < node->node.polygon.pts.end(); pts += 2) {
|
||||||
shape->lineTo(pts[0], pts[1]);
|
shape->lineTo(pts[0], pts[1]);
|
||||||
|
@ -419,7 +419,7 @@ static bool _recognizeShape(SvgNode* node, Shape* shape)
|
||||||
}
|
}
|
||||||
case SvgNodeType::Polyline: {
|
case SvgNodeType::Polyline: {
|
||||||
if (node->node.polyline.pts.count < 2) break;
|
if (node->node.polyline.pts.count < 2) break;
|
||||||
auto pts = node->node.polyline.pts.data;
|
auto pts = node->node.polyline.pts.begin();
|
||||||
shape->moveTo(pts[0], pts[1]);
|
shape->moveTo(pts[0], pts[1]);
|
||||||
for (pts += 2; pts < node->node.polyline.pts.end(); pts += 2) {
|
for (pts += 2; pts < node->node.polyline.pts.end(); pts += 2) {
|
||||||
shape->lineTo(pts[0], pts[1]);
|
shape->lineTo(pts[0], pts[1]);
|
||||||
|
|
|
@ -293,13 +293,13 @@ bool mathUpdateOutlineBBox(const SwOutline* outline, const SwBBox& clipRegion, S
|
||||||
{
|
{
|
||||||
if (!outline) return false;
|
if (!outline) return false;
|
||||||
|
|
||||||
auto pt = outline->pts.data;
|
|
||||||
|
|
||||||
if (outline->pts.empty() || outline->cntrs.empty()) {
|
if (outline->pts.empty() || outline->cntrs.empty()) {
|
||||||
renderRegion.reset();
|
renderRegion.reset();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto pt = outline->pts.begin();
|
||||||
|
|
||||||
auto xMin = pt->x;
|
auto xMin = pt->x;
|
||||||
auto xMax = pt->x;
|
auto xMax = pt->x;
|
||||||
auto yMin = pt->y;
|
auto yMin = pt->y;
|
||||||
|
|
|
@ -182,7 +182,7 @@ struct SwShapeTask : SwTask
|
||||||
shapeDelOutline(&shape, mpool, tid);
|
shapeDelOutline(&shape, mpool, tid);
|
||||||
|
|
||||||
//Clip Path
|
//Clip Path
|
||||||
for (auto clip = clips.data; clip < clips.end(); ++clip) {
|
for (auto clip = clips.begin(); clip < clips.end(); ++clip) {
|
||||||
auto clipper = static_cast<SwTask*>(*clip);
|
auto clipper = static_cast<SwTask*>(*clip);
|
||||||
//Clip shape rle
|
//Clip shape rle
|
||||||
if (shape.rle && !clipper->clip(shape.rle)) goto err;
|
if (shape.rle && !clipper->clip(shape.rle)) goto err;
|
||||||
|
@ -242,7 +242,7 @@ struct SwSceneTask : SwTask
|
||||||
rleMerge(sceneRle, clipper1->rle(), clipper2->rle());
|
rleMerge(sceneRle, clipper1->rle(), clipper2->rle());
|
||||||
|
|
||||||
//Unify the remained clippers
|
//Unify the remained clippers
|
||||||
for (auto rd = scene.data + 2; rd < scene.end(); ++rd) {
|
for (auto rd = scene.begin() + 2; rd < scene.end(); ++rd) {
|
||||||
auto clipper = static_cast<SwTask*>(*rd);
|
auto clipper = static_cast<SwTask*>(*rd);
|
||||||
rleMerge(sceneRle, sceneRle, clipper->rle());
|
rleMerge(sceneRle, sceneRle, clipper->rle());
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ struct SwImageTask : SwTask
|
||||||
if (image.rle) {
|
if (image.rle) {
|
||||||
//Clear current task memorypool here if the clippers would use the same memory pool
|
//Clear current task memorypool here if the clippers would use the same memory pool
|
||||||
imageDelOutline(&image, mpool, tid);
|
imageDelOutline(&image, mpool, tid);
|
||||||
for (auto clip = clips.data; clip < clips.end(); ++clip) {
|
for (auto clip = clips.begin(); clip < clips.end(); ++clip) {
|
||||||
auto clipper = static_cast<SwTask*>(*clip);
|
auto clipper = static_cast<SwTask*>(*clip);
|
||||||
if (!clipper->clip(image.rle)) goto err;
|
if (!clipper->clip(image.rle)) goto err;
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,7 @@ bool SwRenderer::clear()
|
||||||
|
|
||||||
bool SwRenderer::sync()
|
bool SwRenderer::sync()
|
||||||
{
|
{
|
||||||
for (auto task = tasks.data; task < tasks.end(); ++task) {
|
for (auto task = tasks.begin(); task < tasks.end(); ++task) {
|
||||||
if ((*task)->disposed) {
|
if ((*task)->disposed) {
|
||||||
delete(*task);
|
delete(*task);
|
||||||
} else {
|
} else {
|
||||||
|
@ -452,7 +452,7 @@ bool SwRenderer::preRender()
|
||||||
void SwRenderer::clearCompositors()
|
void SwRenderer::clearCompositors()
|
||||||
{
|
{
|
||||||
//Free Composite Caches
|
//Free Composite Caches
|
||||||
for (auto comp = compositors.data; comp < compositors.end(); ++comp) {
|
for (auto comp = compositors.begin(); comp < compositors.end(); ++comp) {
|
||||||
free((*comp)->compositor->image.data);
|
free((*comp)->compositor->image.data);
|
||||||
delete((*comp)->compositor);
|
delete((*comp)->compositor);
|
||||||
delete(*comp);
|
delete(*comp);
|
||||||
|
@ -468,7 +468,7 @@ bool SwRenderer::postRender()
|
||||||
rasterUnpremultiply(surface);
|
rasterUnpremultiply(surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto task = tasks.data; task < tasks.end(); ++task) {
|
for (auto task = tasks.begin(); task < tasks.end(); ++task) {
|
||||||
if ((*task)->disposed) delete(*task);
|
if ((*task)->disposed) delete(*task);
|
||||||
else (*task)->pushed = false;
|
else (*task)->pushed = false;
|
||||||
}
|
}
|
||||||
|
@ -625,7 +625,7 @@ Compositor* SwRenderer::target(const RenderRegion& region, ColorSpace cs)
|
||||||
auto reqChannelSize = CHANNEL_SIZE(cs);
|
auto reqChannelSize = CHANNEL_SIZE(cs);
|
||||||
|
|
||||||
//Use cached data
|
//Use cached data
|
||||||
for (auto p = compositors.data; p < compositors.end(); ++p) {
|
for (auto p = compositors.begin(); p < compositors.end(); ++p) {
|
||||||
if ((*p)->compositor->valid && (*p)->compositor->image.channelSize == reqChannelSize) {
|
if ((*p)->compositor->valid && (*p)->compositor->image.channelSize == reqChannelSize) {
|
||||||
cmp = *p;
|
cmp = *p;
|
||||||
break;
|
break;
|
||||||
|
@ -724,7 +724,7 @@ void* SwRenderer::prepareCommon(SwTask* task, const RenderTransform* transform,
|
||||||
//TODO: Failed threading them. It would be better if it's possible.
|
//TODO: Failed threading them. It would be better if it's possible.
|
||||||
//See: https://github.com/thorvg/thorvg/issues/1409
|
//See: https://github.com/thorvg/thorvg/issues/1409
|
||||||
//Guarantee composition targets get ready.
|
//Guarantee composition targets get ready.
|
||||||
for (auto clip = clips.data; clip < clips.end(); ++clip) {
|
for (auto clip = clips.begin(); clip < clips.end(); ++clip) {
|
||||||
static_cast<SwTask*>(*clip)->done();
|
static_cast<SwTask*>(*clip)->done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -785,7 +785,7 @@ RenderData SwRenderer::prepare(const Array<RenderData>& scene, RenderData data,
|
||||||
//TODO: Failed threading them. It would be better if it's possible.
|
//TODO: Failed threading them. It would be better if it's possible.
|
||||||
//See: https://github.com/thorvg/thorvg/issues/1409
|
//See: https://github.com/thorvg/thorvg/issues/1409
|
||||||
//Guarantee composition targets get ready.
|
//Guarantee composition targets get ready.
|
||||||
for (auto task = scene.data; task < scene.end(); ++task) {
|
for (auto task = scene.begin(); task < scene.end(); ++task) {
|
||||||
static_cast<SwTask*>(*task)->done();
|
static_cast<SwTask*>(*task)->done();
|
||||||
}
|
}
|
||||||
return prepareCommon(task, transform, clips, opacity, flags);
|
return prepareCommon(task, transform, clips, opacity, flags);
|
||||||
|
|
|
@ -713,7 +713,7 @@ static void _decomposeOutline(RleWorker& rw)
|
||||||
auto outline = rw.outline;
|
auto outline = rw.outline;
|
||||||
auto first = 0; //index of first point in contour
|
auto first = 0; //index of first point in contour
|
||||||
|
|
||||||
for (auto cntr = outline->cntrs.data; cntr < outline->cntrs.end(); ++cntr) {
|
for (auto cntr = outline->cntrs.begin(); cntr < outline->cntrs.end(); ++cntr) {
|
||||||
auto last = *cntr;
|
auto last = *cntr;
|
||||||
auto limit = outline->pts.data + last;
|
auto limit = outline->pts.data + last;
|
||||||
auto start = UPSCALE(outline->pts[first]);
|
auto start = UPSCALE(outline->pts[first]);
|
||||||
|
|
|
@ -835,7 +835,7 @@ bool strokeParseOutline(SwStroke* stroke, const SwOutline& outline)
|
||||||
uint32_t first = 0;
|
uint32_t first = 0;
|
||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
|
|
||||||
for (auto cntr = outline.cntrs.data; cntr < outline.cntrs.end(); ++cntr, ++i) {
|
for (auto cntr = outline.cntrs.begin(); cntr < outline.cntrs.end(); ++cntr, ++i) {
|
||||||
auto last = *cntr; //index of last point in contour
|
auto last = *cntr; //index of last point in contour
|
||||||
auto limit = outline.pts.data + last;
|
auto limit = outline.pts.data + last;
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ struct Shape::Impl
|
||||||
{
|
{
|
||||||
//Path bounding size
|
//Path bounding size
|
||||||
if (rs.path.pts.count > 0 ) {
|
if (rs.path.pts.count > 0 ) {
|
||||||
auto pts = rs.path.pts.data;
|
auto pts = rs.path.pts.begin();
|
||||||
Point min = { pts->x, pts->y };
|
Point min = { pts->x, pts->y };
|
||||||
Point max = { pts->x, pts->y };
|
Point max = { pts->x, pts->y };
|
||||||
|
|
||||||
|
|
|
@ -123,14 +123,14 @@ struct TaskSchedulerImpl
|
||||||
|
|
||||||
~TaskSchedulerImpl()
|
~TaskSchedulerImpl()
|
||||||
{
|
{
|
||||||
for (auto tq = taskQueues.data; tq < taskQueues.end(); ++tq) {
|
for (auto tq = taskQueues.begin(); tq < taskQueues.end(); ++tq) {
|
||||||
(*tq)->complete();
|
(*tq)->complete();
|
||||||
}
|
}
|
||||||
for (auto thread = threads.data; thread < threads.end(); ++thread) {
|
for (auto thread = threads.begin(); thread < threads.end(); ++thread) {
|
||||||
(*thread)->join();
|
(*thread)->join();
|
||||||
delete(*thread);
|
delete(*thread);
|
||||||
}
|
}
|
||||||
for (auto tq = taskQueues.data; tq < taskQueues.end(); ++tq) {
|
for (auto tq = taskQueues.begin(); tq < taskQueues.end(); ++tq) {
|
||||||
delete(*tq);
|
delete(*tq);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue