mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 10:28:32 +00:00
Fix blurry progress bars in main window (GTK client) (#4756)
* Fix blurry progress bars in main window (GTK client) Create surfaces similar to those provided by GTK, which includes similar scale factor. * Minor simplification to avoid needless macro use
This commit is contained in:
@@ -275,7 +275,7 @@ Gdk::RGBA const& get_progress_bar_color(Torrent const& torrent)
|
|||||||
|
|
||||||
Cairo::RefPtr<Cairo::Surface> get_mask_surface(Cairo::RefPtr<Cairo::Surface> const& surface, Gdk::Rectangle const& area)
|
Cairo::RefPtr<Cairo::Surface> get_mask_surface(Cairo::RefPtr<Cairo::Surface> const& surface, Gdk::Rectangle const& area)
|
||||||
{
|
{
|
||||||
auto const mask_surface = Cairo::ImageSurface::create(TR_CAIRO_SURFACE_FORMAT(A8), area.get_width(), area.get_height());
|
auto const mask_surface = Cairo::Surface::create(surface, Cairo::CONTENT_ALPHA, area.get_width(), area.get_height());
|
||||||
auto const mask_context = Cairo::Context::create(mask_surface);
|
auto const mask_context = Cairo::Context::create(mask_surface);
|
||||||
|
|
||||||
mask_context->set_source_rgb(0, 0, 0);
|
mask_context->set_source_rgb(0, 0, 0);
|
||||||
@@ -325,8 +325,14 @@ void TorrentCellRenderer::Impl::render_progress_bar(
|
|||||||
Gtk::CellRendererState flags,
|
Gtk::CellRendererState flags,
|
||||||
Gdk::RGBA const& color)
|
Gdk::RGBA const& color)
|
||||||
{
|
{
|
||||||
|
auto const context = IF_GTKMM4(snapshot->append_cairo(area), snapshot);
|
||||||
|
|
||||||
auto const temp_area = Gdk::Rectangle(0, 0, area.get_width(), area.get_height());
|
auto const temp_area = Gdk::Rectangle(0, 0, area.get_width(), area.get_height());
|
||||||
auto const temp_surface = Cairo::ImageSurface::create(TR_CAIRO_SURFACE_FORMAT(ARGB32), area.get_width(), area.get_height());
|
auto const temp_surface = Cairo::Surface::create(
|
||||||
|
context->get_target(),
|
||||||
|
Cairo::CONTENT_COLOR_ALPHA,
|
||||||
|
area.get_width(),
|
||||||
|
area.get_height());
|
||||||
auto const temp_context = Cairo::Context::create(temp_surface);
|
auto const temp_context = Cairo::Context::create(temp_surface);
|
||||||
|
|
||||||
{
|
{
|
||||||
@@ -345,8 +351,6 @@ void TorrentCellRenderer::Impl::render_progress_bar(
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
auto const context = IF_GTKMM4(snapshot->append_cairo(area), snapshot);
|
|
||||||
|
|
||||||
adjust_progress_bar_hue(temp_context, color, temp_area);
|
adjust_progress_bar_hue(temp_context, color, temp_area);
|
||||||
|
|
||||||
context->set_source(temp_context->get_target(), area.get_x(), area.get_y());
|
context->set_source(temp_context->get_target(), area.get_x(), area.get_y());
|
||||||
|
|||||||
Reference in New Issue
Block a user