Replace color_replacements with fitzpatrick_type as needed by the latest rlottie version.

This commit is contained in:
levlam 2021-11-23 15:01:12 +03:00
parent a761e41196
commit 6143bb1b94
3 changed files with 3 additions and 36 deletions

View File

@ -234,10 +234,6 @@ maskPointChin = MaskPoint;
maskPosition point:MaskPoint x_shift:double y_shift:double scale:double = MaskPosition;
//@description Describes a color replacement for animated emoji @old_color Original animated emoji color in the RGB24 format @new_color Replacement animated emoji color in the RGB24 format
colorReplacement old_color:int32 new_color:int32 = ColorReplacement;
//@description Represents a closed vector path. The path begins at the end point of the last command @commands List of vector path commands
closedVectorPath commands:vector<VectorPathCommand> = ClosedVectorPath;
@ -300,9 +296,9 @@ voiceNote duration:int32 waveform:bytes mime_type:string voice:file = VoiceNote;
//@description Describes an animated representation of an emoji
//@sticker Animated sticker for the emoji
//@color_replacements List of colors to be replaced while the sticker is rendered
//@fitzpatrick_type Emoji modifier fitzpatrick type; 0-6; 0 if none
//@sound File containing the sound to be played when the animated emoji is clicked if any; may be null. The sound is encoded with the Opus codec, and stored inside an OGG container
animatedEmoji sticker:sticker color_replacements:vector<colorReplacement> sound:file = AnimatedEmoji;
animatedEmoji sticker:sticker fitzpatrick_type:int32 sound:file = AnimatedEmoji;
//@description Describes a user contact @phone_number Phone number of the user @first_name First name of the user; 1-255 characters in length @last_name Last name of the user @vcard Additional data about the user in a form of vCard; 0-2048 bytes in length @user_id Identifier of the user, if known; otherwise 0
contact phone_number:string first_name:string last_name:string vcard:string user_id:int53 = Contact;

View File

@ -2003,33 +2003,6 @@ FileId StickersManager::get_animated_emoji_sound_file_id(const string &emoji) co
return it->second;
}
vector<td_api::object_ptr<td_api::colorReplacement>> StickersManager::get_color_replacements_object(
int fitzpatrick_modifier) {
vector<td_api::object_ptr<td_api::colorReplacement>> result;
switch (fitzpatrick_modifier) {
case 0:
break;
case 2:
case 3:
case 4:
case 5:
case 6: {
static int32 old_colors[] = {0xf77e41, 0xffb139, 0xffd140, 0xffdf79};
static int32 new_colors[] = {0xcb7b55, 0xf6b689, 0xffcda7, 0xffdfc5, 0xa45a38, 0xdf986b, 0xedb183,
0xf4c3a0, 0x703a17, 0xab673d, 0xc37f4e, 0xd89667, 0x4a2409, 0x7d3e0e,
0x965529, 0xa96337, 0x200f0a, 0x412924, 0x593d37, 0x63453f};
for (size_t i = 0; i < 4; i++) {
result.push_back(td_api::make_object<td_api::colorReplacement>(old_colors[i],
new_colors[(fitzpatrick_modifier - 2) * 4 + i]));
}
break;
}
default:
UNREACHABLE();
}
return result;
}
td_api::object_ptr<td_api::animatedEmoji> StickersManager::get_animated_emoji_object(const string &emoji) {
auto it = emoji_messages_.find(emoji);
if (it == emoji_messages_.end()) {
@ -2045,7 +2018,7 @@ td_api::object_ptr<td_api::animatedEmoji> StickersManager::get_animated_emoji_ob
return nullptr;
}
return td_api::make_object<td_api::animatedEmoji>(
get_sticker_object(animated_sticker.first, true), get_color_replacements_object(animated_sticker.second),
get_sticker_object(animated_sticker.first, true), animated_sticker.second,
sound_file_id.is_valid() ? td_->file_manager_->get_file_object(sound_file_id) : nullptr);
}

View File

@ -613,8 +613,6 @@ class StickersManager final : public Actor {
bool update_sticker_set_cache(const StickerSet *sticker_set, Promise<Unit> &promise);
static vector<td_api::object_ptr<td_api::colorReplacement>> get_color_replacements_object(int fitzpatrick_modifier);
const StickerSet *get_animated_emoji_sticker_set();
static std::pair<FileId, int> get_animated_emoji_sticker(const StickerSet *sticker_set, const string &emoji);