mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-03 00:15:21 +00:00
optimize icon memory usage
Change-Id: I0d2196ffab2dae44c27d28580fc101706bb317ea
This commit is contained in:
parent
ed4ac954e3
commit
35c8ad7215
Notes:
Deepin Code Review
2017-12-28 16:45:07 +08:00
Verified+1: Anonymous Coward #1000004 Code-Review+2: 石博文 <sbw@sbw.so> Submitted-by: 石博文 <sbw@sbw.so> Submitted-at: Thu, 28 Dec 2017 16:45:06 +0800 Reviewed-on: https://cr.deepin.io/29810 Project: dde/dde-dock Branch: refs/heads/master
@ -55,8 +55,7 @@ AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent)
|
||||
|
||||
m_draging(false),
|
||||
|
||||
m_smallIcon(QPixmap()),
|
||||
m_largeIcon(QPixmap()),
|
||||
m_appIcon(QPixmap()),
|
||||
|
||||
m_horizontalIndicator(QPixmap(":/indicator/resources/indicator.png")),
|
||||
m_verticalIndicator(QPixmap(":/indicator/resources/indicator_ver.png")),
|
||||
@ -272,7 +271,7 @@ void AppItem::paintEvent(QPaintEvent *e)
|
||||
}
|
||||
|
||||
// icon
|
||||
const QPixmap pixmap = DockDisplayMode == Efficient ? m_smallIcon : m_largeIcon;
|
||||
const QPixmap &pixmap = m_appIcon;
|
||||
if (pixmap.isNull())
|
||||
return;
|
||||
|
||||
@ -303,7 +302,7 @@ void AppItem::mouseReleaseEvent(QMouseEvent *e)
|
||||
m_itemScene->clear();
|
||||
const auto ratio = qApp->devicePixelRatio();
|
||||
const QRect r = rect();
|
||||
const QPixmap icon = DockDisplayMode == Efficient ? m_smallIcon : m_largeIcon;
|
||||
const QPixmap &icon = m_appIcon;
|
||||
QGraphicsPixmapItem *item = m_itemScene->addPixmap(icon);
|
||||
item->setTransformationMode(Qt::SmoothTransformation);
|
||||
item->setPos(QPointF(r.center()) - QPointF(icon.rect().center()) / ratio);
|
||||
@ -483,7 +482,7 @@ void AppItem::startDrag()
|
||||
m_draging = true;
|
||||
update();
|
||||
|
||||
const QPixmap dragPix = DockDisplayMode == Dock::Fashion ? m_largeIcon : m_smallIcon;
|
||||
const QPixmap &dragPix = m_appIcon;
|
||||
|
||||
QDrag *drag = new QDrag(this);
|
||||
drag->setPixmap(dragPix);
|
||||
@ -518,13 +517,9 @@ void AppItem::refershIcon()
|
||||
const int iconSize = qMin(width(), height());
|
||||
|
||||
if (DockDisplayMode == Efficient)
|
||||
{
|
||||
m_smallIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.7);
|
||||
m_largeIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.9);
|
||||
} else {
|
||||
m_smallIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.6);
|
||||
m_largeIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.8);
|
||||
}
|
||||
m_appIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.7);
|
||||
else
|
||||
m_appIcon = ThemeAppIcon::getIcon(icon, iconSize * 0.8);
|
||||
|
||||
update();
|
||||
|
||||
|
@ -91,8 +91,7 @@ private:
|
||||
bool m_active;
|
||||
WindowDict m_titles;
|
||||
QString m_id;
|
||||
QPixmap m_smallIcon;
|
||||
QPixmap m_largeIcon;
|
||||
QPixmap m_appIcon;
|
||||
QPixmap m_horizontalIndicator;
|
||||
QPixmap m_verticalIndicator;
|
||||
QPixmap m_activeHorizontalIndicator;
|
||||
|
@ -44,9 +44,7 @@ DockItem::DockItem(QWidget *parent)
|
||||
{
|
||||
DockPopupWindow *arrowRectangle = new DockPopupWindow(nullptr);
|
||||
arrowRectangle->setShadowBlurRadius(20);
|
||||
// arrowRectangle->setBorderWidth(0);
|
||||
arrowRectangle->setRadius(6);
|
||||
// arrowRectangle->setShadowDistance(0);
|
||||
arrowRectangle->setShadowYOffset(2);
|
||||
arrowRectangle->setShadowXOffset(0);
|
||||
arrowRectangle->setArrowWidth(18);
|
||||
|
Loading…
x
Reference in New Issue
Block a user