File indexing completed on 2024-04-14 05:45:55
0001 /* 0002 This file is part of the Okteta Gui library, made within the KDE community. 0003 0004 SPDX-FileCopyrightText: 2003 Friedrich W. H. Kossebau <kossebau@kde.org> 0005 0006 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 0009 #include "cursor.hpp" 0010 0011 namespace Okteta { 0012 0013 Cursor::Cursor() = default; 0014 0015 Cursor::~Cursor() = default; 0016 0017 void Cursor::setSize(PixelX Width, PixelY Height, qreal devicePixelRatio) 0018 { 0019 const int scaledWidth = Width * devicePixelRatio; 0020 const int scaledHeight = Height * devicePixelRatio; 0021 if (scaledWidth != OnPixmap.width() || scaledHeight != OnPixmap.height()) { 0022 OnPixmap = QPixmap(scaledWidth, scaledHeight); 0023 OffPixmap = QPixmap(scaledWidth, scaledHeight); 0024 } 0025 OnPixmap.setDevicePixelRatio(devicePixelRatio); 0026 OffPixmap.setDevicePixelRatio(devicePixelRatio); 0027 } 0028 0029 void Cursor::setShape(PixelX X, PixelX W, qreal devicePixelRatio) 0030 { 0031 CursorX = X; 0032 ShapeX = X * devicePixelRatio; 0033 ShapeW = W * devicePixelRatio; 0034 } 0035 0036 }