[Qt] Fix deprecation warnings in Qt 5.10
This commit is contained in:
committed by
Thiago Marcos P. Santos
parent
92608f5885
commit
10a9b25928
@@ -111,8 +111,13 @@ std::unique_ptr<mbgl::style::Image> toStyleImage(const QString &id, const QImage
|
||||
.rgbSwapped()
|
||||
.convertToFormat(QImage::Format_ARGB32_Premultiplied);
|
||||
|
||||
#if QT_VERSION >= 0x051000
|
||||
auto img = std::make_unique<uint8_t[]>(swapped.sizeInBytes());
|
||||
memcpy(img.get(), swapped.constBits(), swapped.sizeInBytes());
|
||||
#else
|
||||
auto img = std::make_unique<uint8_t[]>(swapped.byteCount());
|
||||
memcpy(img.get(), swapped.constBits(), swapped.byteCount());
|
||||
#endif
|
||||
|
||||
return std::make_unique<mbgl::style::Image>(
|
||||
id.toStdString(),
|
||||
|
||||
@@ -54,8 +54,13 @@ PremultipliedImage decodeImage(const std::string& string) {
|
||||
throw std::runtime_error("Unsupported image type");
|
||||
}
|
||||
|
||||
#if QT_VERSION >= 0x051000
|
||||
auto img = std::make_unique<uint8_t[]>(image.sizeInBytes());
|
||||
memcpy(img.get(), image.constBits(), image.sizeInBytes());
|
||||
#else
|
||||
auto img = std::make_unique<uint8_t[]>(image.byteCount());
|
||||
memcpy(img.get(), image.constBits(), image.byteCount());
|
||||
#endif
|
||||
|
||||
return { { static_cast<uint32_t>(image.width()), static_cast<uint32_t>(image.height()) },
|
||||
std::move(img) };
|
||||
|
||||
Reference in New Issue
Block a user