From f381bcd4699d910f4a35af0ad7d6aa3c17f5a8a5 Mon Sep 17 00:00:00 2001 From: "chunmao.guo" Date: Mon, 3 Jul 2023 15:48:57 +0800 Subject: [PATCH] FIX: [STUDIO-3459,STUDIO-3065] use FromDIP instead of em_unit load svg Change-Id: I4be0de849ab825011c241d6da932a2574783ed6f --- src/slic3r/GUI/BitmapCache.cpp | 2 +- src/slic3r/GUI/wxExtensions.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/slic3r/GUI/BitmapCache.cpp b/src/slic3r/GUI/BitmapCache.cpp index 15d83541e..ea8c6dcbe 100644 --- a/src/slic3r/GUI/BitmapCache.cpp +++ b/src/slic3r/GUI/BitmapCache.cpp @@ -372,7 +372,7 @@ wxBitmap* BitmapCache::load_svg(const std::string &bitmap_name, unsigned target_ std::vector data(n_pixels * 4, 0); // BBS: support resize by fill border - if (scale_in_center > 0) { + if (scale_in_center > 0 && scale_in_center < svg_scale) { int w = (int)(image->width * scale_in_center); int h = (int)(image->height * scale_in_center); ::nsvgRasterize(rast, image, 0, 0, scale_in_center, data.data() + int(height - h) / 2 * width * 4 + int(width - w) / 2 * 4, w, h, width * 4); diff --git a/src/slic3r/GUI/wxExtensions.cpp b/src/slic3r/GUI/wxExtensions.cpp index 1ba8129fc..092c7a582 100644 --- a/src/slic3r/GUI/wxExtensions.cpp +++ b/src/slic3r/GUI/wxExtensions.cpp @@ -451,7 +451,7 @@ wxBitmap create_scaled_bitmap( const std::string& bmp_name_in, // Try loading an SVG first, then PNG if SVG is not found: wxBitmap *bmp = cache.load_svg(bmp_name, width, height, grayscale, dark_mode, new_color, resize ? em_unit(win) * 0.1f : 0.f); if (bmp == nullptr) { - bmp = cache.load_png(bmp_name, width, height, grayscale, resize ? em_unit(win) * 0.1f : 0.f); + bmp = cache.load_png(bmp_name, width, height, grayscale, resize ? win->FromDIP(10) * 0.1f : 0.f); } if (bmp == nullptr) {