Skip to content

Commit a27b743

Browse files
mhduiydeepin-bot[bot]
authored andcommitted
fix: window preview blurry
Draw directly using the original image and remove anti aliasing pms: BUG-285265
1 parent cdf6ea9 commit a27b743

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

panels/dock/taskmanager/x11preview.cpp

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,6 @@ class AppItemWindowDeletegate : public QAbstractItemDelegate
262262
if (WM_HELPER->hasComposite() && WM_HELPER->hasBlurWindow()) {
263263
auto pixmap = index.data(WindowPreviewContentRole).value<QPixmap>();
264264
auto size = calSize(pixmap.size());
265-
auto scaledPixmap = pixmap.scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
266-
scaledPixmap.setDevicePixelRatio(qApp->devicePixelRatio());
267265

268266
DStyleHelper dstyle(m_listView->style());
269267
const int radius = dstyle.pixelMetric(DStyle::PM_FrameRadius);
@@ -280,19 +278,18 @@ class AppItemWindowDeletegate : public QAbstractItemDelegate
280278

281279

282280
painter->save();
283-
painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);
284281
pen.setWidth(1);
285282
pen.setColor(themeType == DGuiApplicationHelper::DarkType ? QColor(255, 255, 255, 255 * 0.1) : QColor(0, 0, 0, 255 * 0.1));
286283
painter->setPen(pen);
287284
QRect imageRect(
288-
(option.rect.left() + ((option.rect.width() - scaledPixmap.width()) / 2)),
289-
(option.rect.top() + ((option.rect.height() - scaledPixmap.height()) / 2)),
290-
scaledPixmap.width(),
291-
scaledPixmap.height());
285+
(option.rect.left() + ((option.rect.width() - size.width()) / 2)),
286+
(option.rect.top() + ((option.rect.height() - size.height()) / 2)),
287+
size.width(),
288+
size.height());
292289
QPainterPath clipPath;
293290
clipPath.addRoundedRect(imageRect, radius, radius);
294291
painter->setClipPath(clipPath);
295-
painter->drawPixmap(imageRect, scaledPixmap);
292+
painter->drawPixmap(imageRect, pixmap);
296293
painter->setClipping(false);
297294
painter->drawRoundedRect(imageRect, radius, radius);
298295
if (option.state.testFlag(QStyle::State_MouseOver)) {

0 commit comments

Comments
 (0)