common: replace the id() -> identifier()

This commit is contained in:
Hermet Park 2021-10-22 16:18:35 +09:00 committed by Hermet Park
parent 8cc7f50235
commit 36270f588e
5 changed files with 10 additions and 11 deletions

View file

@ -54,7 +54,6 @@ protected: \
#define _TVG_DECALRE_IDENTIFIER() \
auto id() const { return _id; } \
protected: \
unsigned _id

View file

@ -276,9 +276,9 @@ bool fillGenColorTable(SwFill* fill, const Fill* fdata, const Matrix* transform,
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);
} 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);
}

View file

@ -364,7 +364,7 @@ bool SwRenderer::renderShape(RenderData data)
uint8_t r, g, b, a;
if (auto fill = task->sdata->fill()) {
rasterGradientShape(surface, &task->shape, fill->id());
rasterGradientShape(surface, &task->shape, fill->identifier());
} else {
task->sdata->fillColor(&r, &g, &b, &a);
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()) {
rasterGradientStroke(surface, &task->shape, strokeFill->id());
rasterGradientStroke(surface, &task->shape, strokeFill->identifier());
} else {
if (task->sdata->strokeColor(&r, &g, &b, &a) == Result::Success) {
a = static_cast<uint8_t>((opacity * (uint32_t) a) / 255);

View file

@ -86,7 +86,7 @@ struct Scene::Impl
//If scene has several children or only scene, it may require composition.
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;
}

View file

@ -435,7 +435,7 @@ TvgBinCounter TvgSaver::serializeFill(const Fill* fill, TvgBinTag tag)
TvgBinCounter cnt = 0;
//radial fill
if (fill->id() == TVG_CLASS_ID_RADIAL) {
if (fill->identifier() == TVG_CLASS_ID_RADIAL) {
float args[3];
static_cast<const RadialGradient*>(fill)->radial(args, args + 1, args + 2);
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());
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.
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)) {
continue;
}
@ -709,7 +709,7 @@ TvgBinCounter TvgSaver::serialize(const Paint* paint, const Matrix* pTransform,
auto transform = const_cast<Paint*>(paint)->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_SCENE: return serializeScene(static_cast<const Scene*>(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};
if (paint->opacity() > 0) {
switch (paint->id()) {
switch (paint->identifier()) {
case TVG_CLASS_ID_SHAPE: {
serializeShape(static_cast<const Shape*>(paint), nullptr, &transform);
break;