MCPcopy Create free account
hub / github.com/TranslucentTB/TranslucentTB / UpdateBackground

Method UpdateBackground

Xaml/Controls/ColorPickerSlider.cpp:183–218  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181 }
182
183 void ColorPickerSlider::UpdateBackground(txmp::HsvColor color)
184 {
185 const auto orientation = Orientation();
186 if (const auto rect = orientation == wuxc::Orientation::Vertical ? m_VerticalTrackRect : m_HorizontalTrackRect)
187 {
188 auto width = static_cast<int32_t>(rect.ActualWidth());
189 auto height = static_cast<int32_t>(rect.ActualHeight());
190
191 if (width == 0 || height == 0)
192 {
193 if (cachedSize != wf::Size { })
194 {
195 width = static_cast<int32_t>(cachedSize.Width);
196 height = static_cast<int32_t>(cachedSize.Height);
197 }
198 }
199 else
200 {
201 cachedSize = { static_cast<float>(width), static_cast<float>(height) };
202 }
203
204 if (width != 0 && height != 0)
205 {
206 double renderScale = 1.0;
207 if (const auto root = rect.XamlRoot())
208 {
209 renderScale = root.RasterizationScale();
210
211 width = static_cast<int32_t>(width * renderScale);
212 height = static_cast<int32_t>(height * renderScale);
213 }
214
215 RenderBackground(rect, color, orientation, width, height, renderScale);
216 }
217 }
218 }
219
220 fire_and_forget ColorPickerSlider::RenderBackground(weak_ref<wux::Shapes::Rectangle> rect_weak, txmp::HsvColor color, wuxc::Orientation orientation, int32_t width, int32_t height, double renderScale)
221 {

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected