From f54fdd3926a98a279fade40c9ab52239a9fd7f31 Mon Sep 17 00:00:00 2001 From: levlam Date: Thu, 2 May 2024 18:42:08 +0300 Subject: [PATCH] Ignore rotation angle for non-gradient patterns. --- td/telegram/BackgroundType.cpp | 3 +++ td/telegram/BackgroundType.h | 3 +++ td/telegram/cli.cpp | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/td/telegram/BackgroundType.cpp b/td/telegram/BackgroundType.cpp index 816f9958a..4fecd8532 100644 --- a/td/telegram/BackgroundType.cpp +++ b/td/telegram/BackgroundType.cpp @@ -89,6 +89,9 @@ BackgroundFill::BackgroundFill(const telegram_api::wallPaperSettings *settings) } else { bottom_color_ = top_color_; } + if (get_type() != Type::Gradient) { + rotation_angle_ = 0; + } } Result BackgroundFill::get_background_fill(const td_api::BackgroundFill *fill) { diff --git a/td/telegram/BackgroundType.h b/td/telegram/BackgroundType.h index 494aae353..2e6ab0a04 100644 --- a/td/telegram/BackgroundType.h +++ b/td/telegram/BackgroundType.h @@ -28,6 +28,9 @@ class BackgroundFill { } BackgroundFill(int32 top_color, int32 bottom_color, int32 rotation_angle) : top_color_(top_color), bottom_color_(bottom_color), rotation_angle_(rotation_angle) { + if (get_type() != Type::Gradient) { + rotation_angle_ = 0; + } } BackgroundFill(int32 first_color, int32 second_color, int32 third_color, int32 fourth_color) : top_color_(first_color), bottom_color_(second_color), third_color_(third_color), fourth_color_(fourth_color) { diff --git a/td/telegram/cli.cpp b/td/telegram/cli.cpp index d1dc4c1c9..b0127e483 100644 --- a/td/telegram/cli.cpp +++ b/td/telegram/cli.cpp @@ -2299,7 +2299,7 @@ class CliClient final : public Actor { } static td_api::object_ptr as_background_fill(int32 top_color, int32 bottom_color) { - return td_api::make_object(top_color, bottom_color, Random::fast(0, 7) * 45); + return td_api::make_object(top_color, bottom_color, Random::fast(1, 7) * 45); } static td_api::object_ptr as_background_fill(vector colors) {