-
-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcursor.cpp
32 lines (25 loc) · 952 Bytes
/
cursor.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
This file is part of the Okteta Gui library, made within the KDE community.
SPDX-FileCopyrightText: 2003 Friedrich W. H. Kossebau <[email protected]>
SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
*/
#include "cursor.hpp"
namespace Okteta {
void Cursor::setSize(PixelX Width, PixelY Height, qreal devicePixelRatio)
{
const int scaledWidth = Width * devicePixelRatio;
const int scaledHeight = Height * devicePixelRatio;
if (scaledWidth != OnPixmap.width() || scaledHeight != OnPixmap.height()) {
OnPixmap = QPixmap(scaledWidth, scaledHeight);
OffPixmap = QPixmap(scaledWidth, scaledHeight);
}
OnPixmap.setDevicePixelRatio(devicePixelRatio);
OffPixmap.setDevicePixelRatio(devicePixelRatio);
}
void Cursor::setShape(PixelX X, PixelX W, qreal devicePixelRatio)
{
CursorX = X;
ShapeX = X * devicePixelRatio;
ShapeW = W * devicePixelRatio;
}
}