[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [krita] libs/ui/widgets: Use qint64 when calculating memory usage for layer in "New" dialog
From: Nicholas LaPointe <null () kde ! org>
Date: 2018-01-01 7:29:31
Message-ID: E1eVuXL-0002tW-39 () code ! kde ! org
[Download RAW message or body]
Git commit 8c8c2c91aad4617969ebc94c67d40768897b7bc7 by Nicholas LaPointe.
Committed on 01/01/2018 at 07:27.
Pushed by nicholasl into branch 'master'.
Use qint64 when calculating memory usage for layer in "New" dialog
This prevents overflow when the layer will be larger than 2 GB or 2.1 gigapixels.
M +4 -4 libs/ui/widgets/kis_custom_image_widget.cc
https://commits.kde.org/krita/8c8c2c91aad4617969ebc94c67d40768897b7bc7
diff --git a/libs/ui/widgets/kis_custom_image_widget.cc b/libs/ui/widgets/kis_custom_image_widget.cc
index c88ecd7a7f0..4d4f0478e2e 100644
--- a/libs/ui/widgets/kis_custom_image_widget.cc
+++ b/libs/ui/widgets/kis_custom_image_widget.cc
@@ -480,14 +480,14 @@ void KisCustomImageWidget::switchPortraitLandscape()
void KisCustomImageWidget::changeDocumentInfoLabel()
{
- qint32 width, height;
+ qint64 width, height;
double resolution;
resolution = doubleResolution->value() / 72.0; // internal resolution is in pixels per pt
- width = static_cast<qint32>(0.5 + KoUnit::ptToUnit(m_width, KoUnit(KoUnit::Pixel, resolution)));
- height = static_cast<qint32>(0.5 + KoUnit::ptToUnit(m_height, KoUnit(KoUnit::Pixel, resolution)));
+ width = static_cast<qint64>(0.5 + KoUnit::ptToUnit(m_width, KoUnit(KoUnit::Pixel, resolution)));
+ height = static_cast<qint64>(0.5 + KoUnit::ptToUnit(m_height, KoUnit(KoUnit::Pixel, resolution)));
- int layerSize = width * height;
+ qint64 layerSize = width * height;
const KoColorSpace *cs = colorSpaceSelector->currentColorSpace();
int bitSize = 8 * cs->pixelSize(); //pixelsize is in bytes.
layerSize = layerSize * cs->pixelSize();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic