mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Fixed warnings reported by LGTM and Coverity Scan.
This commit is contained in:
parent
5b500ad2c2
commit
359fe9088c
@ -41,7 +41,7 @@ public:
|
|||||||
onUpdate(time, x, y);
|
onUpdate(time, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void draw(sf::RenderTarget& target, sf::RenderStates states) const override
|
void draw(sf::RenderTarget& target, const sf::RenderStates& states) const override
|
||||||
{
|
{
|
||||||
if (m_isLoaded)
|
if (m_isLoaded)
|
||||||
{
|
{
|
||||||
@ -75,7 +75,7 @@ private:
|
|||||||
// Virtual functions to be implemented in derived effects
|
// Virtual functions to be implemented in derived effects
|
||||||
virtual bool onLoad() = 0;
|
virtual bool onLoad() = 0;
|
||||||
virtual void onUpdate(float time, float x, float y) = 0;
|
virtual void onUpdate(float time, float x, float y) = 0;
|
||||||
virtual void onDraw(sf::RenderTarget& target, sf::RenderStates states) const = 0;
|
virtual void onDraw(sf::RenderTarget& target, const sf::RenderStates& states) const = 0;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -41,10 +41,11 @@ public:
|
|||||||
m_shader.setUniform("pixel_threshold", (x + y) / 30);
|
m_shader.setUniform("pixel_threshold", (x + y) / 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDraw(sf::RenderTarget& target, sf::RenderStates states) const override
|
void onDraw(sf::RenderTarget& target, const sf::RenderStates& states) const override
|
||||||
{
|
{
|
||||||
states.shader = &m_shader;
|
sf::RenderStates statesCopy(states);
|
||||||
target.draw(m_sprite, states);
|
statesCopy.shader = &m_shader;
|
||||||
|
target.draw(m_sprite, statesCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -106,10 +107,11 @@ public:
|
|||||||
m_shader.setUniform("blur_radius", (x + y) * 0.008f);
|
m_shader.setUniform("blur_radius", (x + y) * 0.008f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDraw(sf::RenderTarget& target, sf::RenderStates states) const override
|
void onDraw(sf::RenderTarget& target, const sf::RenderStates& states) const override
|
||||||
{
|
{
|
||||||
states.shader = &m_shader;
|
sf::RenderStates statesCopy(states);
|
||||||
target.draw(m_text, states);
|
statesCopy.shader = &m_shader;
|
||||||
|
target.draw(m_text, statesCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -161,10 +163,11 @@ public:
|
|||||||
m_shader.setUniform("blink_alpha", 0.5f + std::cos(time * 3) * 0.25f);
|
m_shader.setUniform("blink_alpha", 0.5f + std::cos(time * 3) * 0.25f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDraw(sf::RenderTarget& target, sf::RenderStates states) const override
|
void onDraw(sf::RenderTarget& target, const sf::RenderStates& states) const override
|
||||||
{
|
{
|
||||||
states.shader = &m_shader;
|
sf::RenderStates statesCopy(states);
|
||||||
target.draw(m_points, states);
|
statesCopy.shader = &m_shader;
|
||||||
|
target.draw(m_points, statesCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -241,10 +244,11 @@ public:
|
|||||||
m_surface.display();
|
m_surface.display();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDraw(sf::RenderTarget& target, sf::RenderStates states) const override
|
void onDraw(sf::RenderTarget& target, const sf::RenderStates& states) const override
|
||||||
{
|
{
|
||||||
states.shader = &m_shader;
|
sf::RenderStates statesCopy(states);
|
||||||
target.draw(sf::Sprite(m_surface.getTexture()), states);
|
statesCopy.shader = &m_shader;
|
||||||
|
target.draw(sf::Sprite(m_surface.getTexture()), statesCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -317,15 +321,17 @@ public:
|
|||||||
m_shader.setUniform("size", sf::Vector2f(size, size));
|
m_shader.setUniform("size", sf::Vector2f(size, size));
|
||||||
}
|
}
|
||||||
|
|
||||||
void onDraw(sf::RenderTarget& target, sf::RenderStates states) const override
|
void onDraw(sf::RenderTarget& target, const sf::RenderStates& states) const override
|
||||||
{
|
{
|
||||||
|
sf::RenderStates statesCopy(states);
|
||||||
|
|
||||||
// Prepare the render state
|
// Prepare the render state
|
||||||
states.shader = &m_shader;
|
statesCopy.shader = &m_shader;
|
||||||
states.texture = &m_logoTexture;
|
statesCopy.texture = &m_logoTexture;
|
||||||
states.transform = m_transform;
|
statesCopy.transform = m_transform;
|
||||||
|
|
||||||
// Draw the point cloud
|
// Draw the point cloud
|
||||||
target.draw(m_pointCloud, states);
|
target.draw(m_pointCloud, statesCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -66,7 +66,7 @@ protected:
|
|||||||
/// \param states Current render states
|
/// \param states Current render states
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void draw(RenderTarget& target, RenderStates states) const = 0;
|
virtual void draw(RenderTarget& target, const RenderStates& states) const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace sf
|
||||||
@ -100,14 +100,15 @@ protected:
|
|||||||
///
|
///
|
||||||
/// private:
|
/// private:
|
||||||
///
|
///
|
||||||
/// void draw(sf::RenderTarget& target, sf::RenderStates states) const override
|
/// void draw(sf::RenderTarget& target, const sf::RenderStates& states) const override
|
||||||
/// {
|
/// {
|
||||||
/// // You can draw other high-level objects
|
/// // You can draw other high-level objects
|
||||||
/// target.draw(m_sprite, states);
|
/// target.draw(m_sprite, states);
|
||||||
///
|
///
|
||||||
/// // ... or use the low-level API
|
/// // ... or use the low-level API
|
||||||
/// states.texture = &m_texture;
|
/// sf::RenderStates statesCopy(states);
|
||||||
/// target.draw(m_vertices, states);
|
/// statesCopy.texture = &m_texture;
|
||||||
|
/// target.draw(m_vertices, statesCopy);
|
||||||
///
|
///
|
||||||
/// // ... or draw with OpenGL directly
|
/// // ... or draw with OpenGL directly
|
||||||
/// glBegin(GL_TRIANGLES);
|
/// glBegin(GL_TRIANGLES);
|
||||||
|
@ -46,7 +46,7 @@ public:
|
|||||||
/// \brief Default constructor
|
/// \brief Default constructor
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Glyph() : advance(0) {}
|
Glyph() : advance(0), lsbDelta(0), rsbDelta(0) {}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
|
@ -276,7 +276,7 @@ private:
|
|||||||
/// \param states Current render states
|
/// \param states Current render states
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void draw(RenderTarget& target, RenderStates states) const override;
|
void draw(RenderTarget& target, const RenderStates& states) const override;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Update the fill vertices' color
|
/// \brief Update the fill vertices' color
|
||||||
|
@ -198,7 +198,7 @@ private:
|
|||||||
/// \param states Current render states
|
/// \param states Current render states
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void draw(RenderTarget& target, RenderStates states) const override;
|
void draw(RenderTarget& target, const RenderStates& states) const override;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Update the vertices' positions
|
/// \brief Update the vertices' positions
|
||||||
|
@ -390,7 +390,7 @@ private:
|
|||||||
/// \param states Current render states
|
/// \param states Current render states
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void draw(RenderTarget& target, RenderStates states) const override;
|
void draw(RenderTarget& target, const RenderStates& states) const override;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Make sure the text's geometry is updated
|
/// \brief Make sure the text's geometry is updated
|
||||||
|
@ -292,10 +292,11 @@ private:
|
|||||||
/// \code
|
/// \code
|
||||||
/// class MyEntity : public sf::Transformable, public sf::Drawable
|
/// class MyEntity : public sf::Transformable, public sf::Drawable
|
||||||
/// {
|
/// {
|
||||||
/// void draw(sf::RenderTarget& target, sf::RenderStates states) const override
|
/// void draw(sf::RenderTarget& target, const sf::RenderStates& states) const override
|
||||||
/// {
|
/// {
|
||||||
/// states.transform *= getTransform();
|
/// sf::RenderStates statesCopy(states);
|
||||||
/// target.draw(..., states);
|
/// statesCopy.transform *= getTransform();
|
||||||
|
/// target.draw(..., statesCopy);
|
||||||
/// }
|
/// }
|
||||||
/// };
|
/// };
|
||||||
///
|
///
|
||||||
|
@ -179,7 +179,7 @@ private:
|
|||||||
/// \param states Current render states
|
/// \param states Current render states
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void draw(RenderTarget& target, RenderStates states) const override;
|
void draw(RenderTarget& target, const RenderStates& states) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -328,7 +328,7 @@ private:
|
|||||||
/// \param states Current render states
|
/// \param states Current render states
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void draw(RenderTarget& target, RenderStates states) const override;
|
void draw(RenderTarget& target, const RenderStates& states) const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ void Music::initialize()
|
|||||||
m_loopSpan.length = m_file.getSampleCount();
|
m_loopSpan.length = m_file.getSampleCount();
|
||||||
|
|
||||||
// Resize the internal buffer so that it can contain 1 second of audio samples
|
// Resize the internal buffer so that it can contain 1 second of audio samples
|
||||||
m_samples.resize(m_file.getSampleRate() * m_file.getChannelCount());
|
m_samples.resize(static_cast<std::size_t>(m_file.getSampleRate()) * static_cast<std::size_t>(m_file.getChannelCount()));
|
||||||
|
|
||||||
// Initialize the stream
|
// Initialize the stream
|
||||||
SoundStream::initialize(m_file.getChannelCount(), m_file.getSampleRate());
|
SoundStream::initialize(m_file.getChannelCount(), m_file.getSampleRate());
|
||||||
|
@ -303,7 +303,7 @@ void SoundRecorder::processCapturedSamples()
|
|||||||
if (samplesAvailable > 0)
|
if (samplesAvailable > 0)
|
||||||
{
|
{
|
||||||
// Get the recorded samples
|
// Get the recorded samples
|
||||||
m_samples.resize(static_cast<unsigned int>(samplesAvailable) * getChannelCount());
|
m_samples.resize(static_cast<std::size_t>(samplesAvailable) * getChannelCount());
|
||||||
alcCaptureSamples(captureDevice, m_samples.data(), samplesAvailable);
|
alcCaptureSamples(captureDevice, m_samples.data(), samplesAvailable);
|
||||||
|
|
||||||
// Forward them to the derived class
|
// Forward them to the derived class
|
||||||
|
@ -82,7 +82,11 @@ void SoundStream::initialize(unsigned int channelCount, unsigned int sampleRate)
|
|||||||
m_channelCount = channelCount;
|
m_channelCount = channelCount;
|
||||||
m_sampleRate = sampleRate;
|
m_sampleRate = sampleRate;
|
||||||
m_samplesProcessed = 0;
|
m_samplesProcessed = 0;
|
||||||
m_isStreaming = false;
|
|
||||||
|
{
|
||||||
|
std::scoped_lock lock(m_threadMutex);
|
||||||
|
m_isStreaming = false;
|
||||||
|
}
|
||||||
|
|
||||||
// Deduce the format from the number of channels
|
// Deduce the format from the number of channels
|
||||||
m_format = priv::AudioDevice::getFormatFromChannelCount(channelCount);
|
m_format = priv::AudioDevice::getFormatFromChannelCount(channelCount);
|
||||||
@ -494,8 +498,11 @@ void SoundStream::clearQueue()
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void SoundStream::launchStreamingThread(Status threadStartState)
|
void SoundStream::launchStreamingThread(Status threadStartState)
|
||||||
{
|
{
|
||||||
m_isStreaming = true;
|
{
|
||||||
m_threadStartState = threadStartState;
|
std::scoped_lock lock(m_threadMutex);
|
||||||
|
m_isStreaming = true;
|
||||||
|
m_threadStartState = threadStartState;
|
||||||
|
}
|
||||||
|
|
||||||
assert(!m_thread.joinable());
|
assert(!m_thread.joinable());
|
||||||
m_thread = std::thread(&SoundStream::streamData, this);
|
m_thread = std::thread(&SoundStream::streamData, this);
|
||||||
|
@ -629,7 +629,7 @@ Glyph Font::loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, f
|
|||||||
glyph.bounds.height = static_cast<float>( bitmap.rows);
|
glyph.bounds.height = static_cast<float>( bitmap.rows);
|
||||||
|
|
||||||
// Resize the pixel buffer to the new size and fill it with transparent white pixels
|
// Resize the pixel buffer to the new size and fill it with transparent white pixels
|
||||||
m_pixelBuffer.resize(width * height * 4);
|
m_pixelBuffer.resize(static_cast<std::size_t>(width) * static_cast<std::size_t>(height) * 4);
|
||||||
|
|
||||||
Uint8* current = m_pixelBuffer.data();
|
Uint8* current = m_pixelBuffer.data();
|
||||||
Uint8* end = current + width * height * 4;
|
Uint8* end = current + width * height * 4;
|
||||||
|
@ -58,7 +58,7 @@ void Image::create(unsigned int width, unsigned int height, const Color& color)
|
|||||||
if (width && height)
|
if (width && height)
|
||||||
{
|
{
|
||||||
// Create a new pixel buffer first for exception safety's sake
|
// Create a new pixel buffer first for exception safety's sake
|
||||||
std::vector<Uint8> newPixels(width * height * 4);
|
std::vector<Uint8> newPixels(static_cast<std::size_t>(width) * static_cast<std::size_t>(height) * 4);
|
||||||
|
|
||||||
// Fill it with the specified color
|
// Fill it with the specified color
|
||||||
Uint8* ptr = newPixels.data();
|
Uint8* ptr = newPixels.data();
|
||||||
|
@ -209,19 +209,21 @@ void Shape::update()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Shape::draw(RenderTarget& target, RenderStates states) const
|
void Shape::draw(RenderTarget& target, const RenderStates& states) const
|
||||||
{
|
{
|
||||||
states.transform *= getTransform();
|
RenderStates statesCopy(states);
|
||||||
|
|
||||||
|
statesCopy.transform *= getTransform();
|
||||||
|
|
||||||
// Render the inside
|
// Render the inside
|
||||||
states.texture = m_texture;
|
statesCopy.texture = m_texture;
|
||||||
target.draw(m_vertices, states);
|
target.draw(m_vertices, statesCopy);
|
||||||
|
|
||||||
// Render the outline
|
// Render the outline
|
||||||
if (m_outlineThickness != 0)
|
if (m_outlineThickness != 0)
|
||||||
{
|
{
|
||||||
states.texture = nullptr;
|
statesCopy.texture = nullptr;
|
||||||
target.draw(m_outlineVertices, states);
|
target.draw(m_outlineVertices, statesCopy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,13 +138,15 @@ FloatRect Sprite::getGlobalBounds() const
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Sprite::draw(RenderTarget& target, RenderStates states) const
|
void Sprite::draw(RenderTarget& target, const RenderStates& states) const
|
||||||
{
|
{
|
||||||
if (m_texture)
|
if (m_texture)
|
||||||
{
|
{
|
||||||
states.transform *= getTransform();
|
RenderStates statesCopy(states);
|
||||||
states.texture = m_texture;
|
|
||||||
target.draw(m_vertices, 4, TriangleStrip, states);
|
statesCopy.transform *= getTransform();
|
||||||
|
statesCopy.texture = m_texture;
|
||||||
|
target.draw(m_vertices, 4, TriangleStrip, statesCopy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,20 +359,22 @@ FloatRect Text::getGlobalBounds() const
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void Text::draw(RenderTarget& target, RenderStates states) const
|
void Text::draw(RenderTarget& target, const RenderStates& states) const
|
||||||
{
|
{
|
||||||
if (m_font)
|
if (m_font)
|
||||||
{
|
{
|
||||||
ensureGeometryUpdate();
|
ensureGeometryUpdate();
|
||||||
|
|
||||||
states.transform *= getTransform();
|
RenderStates statesCopy(states);
|
||||||
states.texture = &m_font->getTexture(m_characterSize);
|
|
||||||
|
statesCopy.transform *= getTransform();
|
||||||
|
statesCopy.texture = &m_font->getTexture(m_characterSize);
|
||||||
|
|
||||||
// Only draw the outline if there is something to draw
|
// Only draw the outline if there is something to draw
|
||||||
if (m_outlineThickness != 0)
|
if (m_outlineThickness != 0)
|
||||||
target.draw(m_outlineVertices, states);
|
target.draw(m_outlineVertices, statesCopy);
|
||||||
|
|
||||||
target.draw(m_vertices, states);
|
target.draw(m_vertices, statesCopy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -330,7 +330,7 @@ Image Texture::copyToImage() const
|
|||||||
priv::TextureSaver save;
|
priv::TextureSaver save;
|
||||||
|
|
||||||
// Create an array of pixels
|
// Create an array of pixels
|
||||||
std::vector<Uint8> pixels(m_size.x * m_size.y * 4);
|
std::vector<Uint8> pixels(static_cast<std::size_t>(m_size.x) * static_cast<std::size_t>(m_size.y) * 4);
|
||||||
|
|
||||||
#ifdef SFML_OPENGL_ES
|
#ifdef SFML_OPENGL_ES
|
||||||
|
|
||||||
@ -364,7 +364,7 @@ Image Texture::copyToImage() const
|
|||||||
// Texture is either padded or flipped, we have to use a slower algorithm
|
// Texture is either padded or flipped, we have to use a slower algorithm
|
||||||
|
|
||||||
// All the pixels will first be copied to a temporary array
|
// All the pixels will first be copied to a temporary array
|
||||||
std::vector<Uint8> allPixels(m_actualSize.x * m_actualSize.y * 4);
|
std::vector<Uint8> allPixels(static_cast<std::size_t>(m_actualSize.x) * static_cast<std::size_t>(m_actualSize.y) * 4);
|
||||||
glCheck(glBindTexture(GL_TEXTURE_2D, m_texture));
|
glCheck(glBindTexture(GL_TEXTURE_2D, m_texture));
|
||||||
glCheck(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, allPixels.data()));
|
glCheck(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, allPixels.data()));
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ FloatRect VertexArray::getBounds() const
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void VertexArray::draw(RenderTarget& target, RenderStates states) const
|
void VertexArray::draw(RenderTarget& target, const RenderStates& states) const
|
||||||
{
|
{
|
||||||
if (!m_vertices.empty())
|
if (!m_vertices.empty())
|
||||||
target.draw(m_vertices.data(), m_vertices.size(), m_primitiveType, states);
|
target.draw(m_vertices.data(), m_vertices.size(), m_primitiveType, states);
|
||||||
|
@ -360,7 +360,7 @@ bool VertexBuffer::isAvailable()
|
|||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void VertexBuffer::draw(RenderTarget& target, RenderStates states) const
|
void VertexBuffer::draw(RenderTarget& target, const RenderStates& states) const
|
||||||
{
|
{
|
||||||
if (m_buffer && m_size)
|
if (m_buffer && m_size)
|
||||||
target.draw(*this, 0, m_size, states);
|
target.draw(*this, 0, m_size, states);
|
||||||
|
@ -77,7 +77,7 @@ bool CursorImpl::loadFromPixelsARGB(const Uint8* pixels, Vector2u size, Vector2u
|
|||||||
cursorImage->xhot = hotspot.x;
|
cursorImage->xhot = hotspot.x;
|
||||||
cursorImage->yhot = hotspot.y;
|
cursorImage->yhot = hotspot.y;
|
||||||
|
|
||||||
const std::size_t numPixels = size.x * size.y;
|
const std::size_t numPixels = static_cast<std::size_t>(size.x) * static_cast<std::size_t>(size.y);
|
||||||
for (std::size_t pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex)
|
for (std::size_t pixelIndex = 0; pixelIndex < numPixels; ++pixelIndex)
|
||||||
{
|
{
|
||||||
cursorImage->pixels[pixelIndex] = static_cast<Uint8>(pixels[pixelIndex * 4 + 2] +
|
cursorImage->pixels[pixelIndex] = static_cast<Uint8>(pixels[pixelIndex * 4 + 2] +
|
||||||
|
@ -41,7 +41,10 @@ namespace
|
|||||||
struct VulkanLibraryWrapper
|
struct VulkanLibraryWrapper
|
||||||
{
|
{
|
||||||
VulkanLibraryWrapper() :
|
VulkanLibraryWrapper() :
|
||||||
library(nullptr)
|
library(nullptr),
|
||||||
|
vkGetInstanceProcAddr(nullptr),
|
||||||
|
vkEnumerateInstanceLayerProperties(nullptr),
|
||||||
|
vkEnumerateInstanceExtensionProperties(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1009,8 +1009,8 @@ void WindowImplX11::setIcon(unsigned int width, unsigned int height, const Uint8
|
|||||||
{
|
{
|
||||||
// X11 wants BGRA pixels: swap red and blue channels
|
// X11 wants BGRA pixels: swap red and blue channels
|
||||||
// Note: this memory will be freed by XDestroyImage
|
// Note: this memory will be freed by XDestroyImage
|
||||||
auto* iconPixels = static_cast<Uint8*>(std::malloc(width * height * 4));
|
auto* iconPixels = static_cast<Uint8*>(std::malloc(static_cast<std::size_t>(width) * static_cast<std::size_t>(height) * 4));
|
||||||
for (std::size_t i = 0; i < width * height; ++i)
|
for (std::size_t i = 0; i < static_cast<std::size_t>(width) * static_cast<std::size_t>(height); ++i)
|
||||||
{
|
{
|
||||||
iconPixels[i * 4 + 0] = pixels[i * 4 + 2];
|
iconPixels[i * 4 + 0] = pixels[i * 4 + 2];
|
||||||
iconPixels[i * 4 + 1] = pixels[i * 4 + 1];
|
iconPixels[i * 4 + 1] = pixels[i * 4 + 1];
|
||||||
@ -1079,7 +1079,7 @@ void WindowImplX11::setIcon(unsigned int width, unsigned int height, const Uint8
|
|||||||
*ptr++ = height;
|
*ptr++ = height;
|
||||||
#pragma GCC diagnostic pop
|
#pragma GCC diagnostic pop
|
||||||
|
|
||||||
for (std::size_t i = 0; i < width * height; ++i)
|
for (std::size_t i = 0; i < static_cast<std::size_t>(width) * static_cast<std::size_t>(height); ++i)
|
||||||
{
|
{
|
||||||
*ptr++ = static_cast<unsigned long>((pixels[i * 4 + 2] << 0 ) |
|
*ptr++ = static_cast<unsigned long>((pixels[i * 4 + 2] << 0 ) |
|
||||||
(pixels[i * 4 + 1] << 8 ) |
|
(pixels[i * 4 + 1] << 8 ) |
|
||||||
|
@ -40,7 +40,10 @@ namespace
|
|||||||
struct VulkanLibraryWrapper
|
struct VulkanLibraryWrapper
|
||||||
{
|
{
|
||||||
VulkanLibraryWrapper() :
|
VulkanLibraryWrapper() :
|
||||||
library(nullptr)
|
library(nullptr),
|
||||||
|
vkGetInstanceProcAddr(nullptr),
|
||||||
|
vkEnumerateInstanceLayerProperties(nullptr),
|
||||||
|
vkEnumerateInstanceExtensionProperties(nullptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ m_size(0, 0)
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
WindowBase::~WindowBase()
|
WindowBase::~WindowBase()
|
||||||
{
|
{
|
||||||
close();
|
WindowBase::close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
namespace sf
|
namespace sf
|
||||||
{
|
{
|
||||||
class BlendMode;
|
struct BlendMode;
|
||||||
class Color;
|
class Color;
|
||||||
class Transform;
|
class Transform;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user