diff --git a/src/DrawComponents/DrawImage.cpp b/src/DrawComponents/DrawImage.cpp index 39aebc9..7a66f89 100644 --- a/src/DrawComponents/DrawImage.cpp +++ b/src/DrawComponents/DrawImage.cpp @@ -59,18 +59,22 @@ void DrawImage::update_from_delayed_ptr(const std::shared_ptr& de void DrawImage::draw_download_progress_bar(SkCanvas* canvas, const DrawData& drawData, float progress) { if(progress == 0.0f) return; - canvas->save(); - canvas_do_calculated_transform(canvas); - SkPaint p; - p.setStroke(true); - p.setStrokeWidth(10.0f); - p.setStrokeCap(SkPaint::kRound_Cap); - p.setColor4f(drawData.main->toolbar.io->theme->fillColor5); - Vector2f center = (d.p1 + d.p2) * 0.5f; + calculate_draw_transform(drawData); + if(drawSetupData.shouldDraw) { + canvas->save(); + canvas_do_calculated_transform(canvas); + SkPaint p; + p.setStroke(true); + p.setStrokeWidth(10.0f); + p.setStrokeCap(SkPaint::kRound_Cap); + p.setColor4f(drawData.main->toolbar.io->theme->fillColor5); + Vector2f center = convert_vec2(imRect.center()); - const float DOWNLOAD_ARC_RADIUS = 50.0f; - canvas->drawArc(SkRect::MakeLTRB(center.x() - DOWNLOAD_ARC_RADIUS, center.y() - DOWNLOAD_ARC_RADIUS, center.x() + DOWNLOAD_ARC_RADIUS, center.y() + DOWNLOAD_ARC_RADIUS), 0.0f, progress * 360.0f, false, p); - canvas->restore(); + const float DOWNLOAD_ARC_RADIUS = 50.0f; + canvas->drawArc(SkRect::MakeLTRB(center.x() - DOWNLOAD_ARC_RADIUS, center.y() - DOWNLOAD_ARC_RADIUS, center.x() + DOWNLOAD_ARC_RADIUS, center.y() + DOWNLOAD_ARC_RADIUS), 0.0f, progress * 360.0f, false, p); + canvas->restore(); + drawSetupData.shouldDraw = false; + } } void DrawImage::draw(SkCanvas* canvas, const DrawData& drawData) {