From e9bb8f2a298e81830f91471d65f071967171193b Mon Sep 17 00:00:00 2001 From: levlam Date: Sun, 22 Dec 2019 04:42:22 +0300 Subject: [PATCH] Remove public get_color_hex_string method. GitOrigin-RevId: cfc3100b814766410fadc6749522457f7e5ad514 --- td/telegram/BackgroundManager.cpp | 4 ++-- td/telegram/BackgroundType.cpp | 17 +++++------------ td/telegram/BackgroundType.h | 6 ------ 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/td/telegram/BackgroundManager.cpp b/td/telegram/BackgroundManager.cpp index 0fe26769..c4bcce3d 100644 --- a/td/telegram/BackgroundManager.cpp +++ b/td/telegram/BackgroundManager.cpp @@ -522,7 +522,7 @@ BackgroundId BackgroundManager::add_solid_background(int32 color, bool is_defaul background.is_default = is_default; background.is_dark = is_dark; background.type = BackgroundType(color); - background.name = background.type.get_color_hex_string(); + background.name = background.type.get_link(); add_background(background); return background_id; @@ -546,7 +546,7 @@ BackgroundId BackgroundManager::add_gradient_background(const GradientInfo &grad background.is_default = is_default; background.is_dark = is_dark; background.type = BackgroundType(gradient_info); - background.name = gradient_info.get_colors_hex_string(); + background.name = background.type.get_link(); add_background(background); return background_id; diff --git a/td/telegram/BackgroundType.cpp b/td/telegram/BackgroundType.cpp index a51f5232..84ea702e 100644 --- a/td/telegram/BackgroundType.cpp +++ b/td/telegram/BackgroundType.cpp @@ -10,7 +10,7 @@ namespace td { -string get_color_hex_string(int32 color) { +static string get_color_hex_string(int32 color) { string result; for (int i = 20; i >= 0; i -= 4) { result += "0123456789abcdef"[(color >> i) & 0xf]; @@ -18,18 +18,10 @@ string get_color_hex_string(int32 color) { return result; } -string GradientInfo::get_colors_hex_string() const { - return PSTRING() << get_color_hex_string(top_color) << '-' << get_color_hex_string(bottom_color); -} - bool operator==(const GradientInfo &lhs, const GradientInfo &rhs) { return lhs.top_color == rhs.top_color && lhs.bottom_color == rhs.bottom_color; } -string BackgroundType::get_color_hex_string() const { - return td::get_color_hex_string(color); -} - string BackgroundType::get_link() const { string mode; if (is_blurred) { @@ -50,7 +42,7 @@ string BackgroundType::get_link() const { return string(); } case BackgroundType::Type::Pattern: { - string link = PSTRING() << "intensity=" << intensity << "&bg_color=" << get_color_hex_string(); + string link = PSTRING() << "intensity=" << intensity << "&bg_color=" << get_color_hex_string(color); if (!mode.empty()) { link += "&mode="; link += mode; @@ -58,9 +50,10 @@ string BackgroundType::get_link() const { return link; } case BackgroundType::Type::Solid: - return get_color_hex_string(); + return get_color_hex_string(color); case BackgroundType::Type::Gradient: - return gradient.get_colors_hex_string(); + return PSTRING() << get_color_hex_string(gradient.top_color) << '-' + << get_color_hex_string(gradient.bottom_color); default: UNREACHABLE(); return string(); diff --git a/td/telegram/BackgroundType.h b/td/telegram/BackgroundType.h index b2b3c718..a0586f0f 100644 --- a/td/telegram/BackgroundType.h +++ b/td/telegram/BackgroundType.h @@ -15,8 +15,6 @@ namespace td { -string get_color_hex_string(int32 color); - struct GradientInfo { int32 top_color = 0; int32 bottom_color = 0; @@ -24,8 +22,6 @@ struct GradientInfo { GradientInfo() = default; GradientInfo(int32 top_color, int32 bottom_color) : top_color(top_color), bottom_color(bottom_color) { } - - string get_colors_hex_string() const; }; bool operator==(const GradientInfo &lhs, const GradientInfo &rhs); @@ -56,8 +52,6 @@ struct BackgroundType { } string get_link() const; - - string get_color_hex_string() const; }; bool operator==(const BackgroundType &lhs, const BackgroundType &rhs);