mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-20 06:52:03 +00:00
common: replace the id() -> identifier()
This commit is contained in:
parent
8cc7f50235
commit
36270f588e
5 changed files with 10 additions and 11 deletions
|
@ -54,7 +54,6 @@ protected: \
|
||||||
|
|
||||||
|
|
||||||
#define _TVG_DECALRE_IDENTIFIER() \
|
#define _TVG_DECALRE_IDENTIFIER() \
|
||||||
auto id() const { return _id; } \
|
|
||||||
protected: \
|
protected: \
|
||||||
unsigned _id
|
unsigned _id
|
||||||
|
|
||||||
|
|
|
@ -276,9 +276,9 @@ bool fillGenColorTable(SwFill* fill, const Fill* fdata, const Matrix* transform,
|
||||||
if (!_updateColorTable(fill, fdata, surface, opacity)) return false;
|
if (!_updateColorTable(fill, fdata, surface, opacity)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fdata->id() == TVG_CLASS_ID_LINEAR) {
|
if (fdata->identifier() == TVG_CLASS_ID_LINEAR) {
|
||||||
return _prepareLinear(fill, static_cast<const LinearGradient*>(fdata), transform);
|
return _prepareLinear(fill, static_cast<const LinearGradient*>(fdata), transform);
|
||||||
} else if (fdata->id() == TVG_CLASS_ID_RADIAL) {
|
} else if (fdata->identifier() == TVG_CLASS_ID_RADIAL) {
|
||||||
return _prepareRadial(fill, static_cast<const RadialGradient*>(fdata), transform);
|
return _prepareRadial(fill, static_cast<const RadialGradient*>(fdata), transform);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -364,7 +364,7 @@ bool SwRenderer::renderShape(RenderData data)
|
||||||
uint8_t r, g, b, a;
|
uint8_t r, g, b, a;
|
||||||
|
|
||||||
if (auto fill = task->sdata->fill()) {
|
if (auto fill = task->sdata->fill()) {
|
||||||
rasterGradientShape(surface, &task->shape, fill->id());
|
rasterGradientShape(surface, &task->shape, fill->identifier());
|
||||||
} else {
|
} else {
|
||||||
task->sdata->fillColor(&r, &g, &b, &a);
|
task->sdata->fillColor(&r, &g, &b, &a);
|
||||||
a = static_cast<uint8_t>((opacity * (uint32_t) a) / 255);
|
a = static_cast<uint8_t>((opacity * (uint32_t) a) / 255);
|
||||||
|
@ -372,7 +372,7 @@ bool SwRenderer::renderShape(RenderData data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auto strokeFill = task->sdata->strokeFill()) {
|
if (auto strokeFill = task->sdata->strokeFill()) {
|
||||||
rasterGradientStroke(surface, &task->shape, strokeFill->id());
|
rasterGradientStroke(surface, &task->shape, strokeFill->identifier());
|
||||||
} else {
|
} else {
|
||||||
if (task->sdata->strokeColor(&r, &g, &b, &a) == Result::Success) {
|
if (task->sdata->strokeColor(&r, &g, &b, &a) == Result::Success) {
|
||||||
a = static_cast<uint8_t>((opacity * (uint32_t) a) / 255);
|
a = static_cast<uint8_t>((opacity * (uint32_t) a) / 255);
|
||||||
|
|
|
@ -86,7 +86,7 @@ struct Scene::Impl
|
||||||
|
|
||||||
//If scene has several children or only scene, it may require composition.
|
//If scene has several children or only scene, it may require composition.
|
||||||
if (paints.count > 1) return true;
|
if (paints.count > 1) return true;
|
||||||
if (paints.count == 1 && (*paints.data)->id() == TVG_CLASS_ID_SCENE) return true;
|
if (paints.count == 1 && (*paints.data)->identifier() == TVG_CLASS_ID_SCENE) return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -435,7 +435,7 @@ TvgBinCounter TvgSaver::serializeFill(const Fill* fill, TvgBinTag tag)
|
||||||
TvgBinCounter cnt = 0;
|
TvgBinCounter cnt = 0;
|
||||||
|
|
||||||
//radial fill
|
//radial fill
|
||||||
if (fill->id() == TVG_CLASS_ID_RADIAL) {
|
if (fill->identifier() == TVG_CLASS_ID_RADIAL) {
|
||||||
float args[3];
|
float args[3];
|
||||||
static_cast<const RadialGradient*>(fill)->radial(args, args + 1, args + 2);
|
static_cast<const RadialGradient*>(fill)->radial(args, args + 1, args + 2);
|
||||||
cnt += writeTagProperty(TVG_TAG_FILL_RADIAL_GRADIENT, SIZE(args), args);
|
cnt += writeTagProperty(TVG_TAG_FILL_RADIAL_GRADIENT, SIZE(args), args);
|
||||||
|
@ -672,10 +672,10 @@ TvgBinCounter TvgSaver::serializeChildren(Iterator* it, const Matrix* pTransform
|
||||||
children.push(it->next());
|
children.push(it->next());
|
||||||
|
|
||||||
while (auto child = it->next()) {
|
while (auto child = it->next()) {
|
||||||
if (child->id() == TVG_CLASS_ID_SHAPE) {
|
if (child->identifier() == TVG_CLASS_ID_SHAPE) {
|
||||||
//only dosable if the previous child is a shape.
|
//only dosable if the previous child is a shape.
|
||||||
auto target = children.ptr() - 1;
|
auto target = children.ptr() - 1;
|
||||||
if ((*target)->id() == TVG_CLASS_ID_SHAPE) {
|
if ((*target)->identifier() == TVG_CLASS_ID_SHAPE) {
|
||||||
if (_merge((Shape*)child, (Shape*)*target)) {
|
if (_merge((Shape*)child, (Shape*)*target)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -709,7 +709,7 @@ TvgBinCounter TvgSaver::serialize(const Paint* paint, const Matrix* pTransform,
|
||||||
auto transform = const_cast<Paint*>(paint)->transform();
|
auto transform = const_cast<Paint*>(paint)->transform();
|
||||||
if (pTransform) transform = _multiply(pTransform, &transform);
|
if (pTransform) transform = _multiply(pTransform, &transform);
|
||||||
|
|
||||||
switch (paint->id()) {
|
switch (paint->identifier()) {
|
||||||
case TVG_CLASS_ID_SHAPE: return serializeShape(static_cast<const Shape*>(paint), pTransform, &transform);
|
case TVG_CLASS_ID_SHAPE: return serializeShape(static_cast<const Shape*>(paint), pTransform, &transform);
|
||||||
case TVG_CLASS_ID_SCENE: return serializeScene(static_cast<const Scene*>(paint), pTransform, &transform);
|
case TVG_CLASS_ID_SCENE: return serializeScene(static_cast<const Scene*>(paint), pTransform, &transform);
|
||||||
case TVG_CLASS_ID_PICTURE: return serializePicture(static_cast<const Picture*>(paint), pTransform, &transform);
|
case TVG_CLASS_ID_PICTURE: return serializePicture(static_cast<const Picture*>(paint), pTransform, &transform);
|
||||||
|
@ -727,7 +727,7 @@ void TvgSaver::run(unsigned tid)
|
||||||
Matrix transform = {1, 0, 0, 0, 1, 0, 0, 0, 1};
|
Matrix transform = {1, 0, 0, 0, 1, 0, 0, 0, 1};
|
||||||
|
|
||||||
if (paint->opacity() > 0) {
|
if (paint->opacity() > 0) {
|
||||||
switch (paint->id()) {
|
switch (paint->identifier()) {
|
||||||
case TVG_CLASS_ID_SHAPE: {
|
case TVG_CLASS_ID_SHAPE: {
|
||||||
serializeShape(static_cast<const Shape*>(paint), nullptr, &transform);
|
serializeShape(static_cast<const Shape*>(paint), nullptr, &transform);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Reference in a new issue