Use std::vector.data() where appropriate
This commit is contained in:
parent
f87f5a3f72
commit
f03a415121
@ -142,7 +142,7 @@ int main()
|
||||
terrainStagingBuffer.resize(resolutionX * resolutionY * 6);
|
||||
|
||||
// Generate the initial terrain
|
||||
generateTerrain(&terrainStagingBuffer[0]);
|
||||
generateTerrain(terrainStagingBuffer.data());
|
||||
|
||||
statusText.setString("Generating Terrain...");
|
||||
}
|
||||
@ -189,7 +189,7 @@ int main()
|
||||
{
|
||||
switch (event.key.code)
|
||||
{
|
||||
case sf::Keyboard::Return: generateTerrain(&terrainStagingBuffer[0]); break;
|
||||
case sf::Keyboard::Return: generateTerrain(terrainStagingBuffer.data()); break;
|
||||
case sf::Keyboard::Down: currentSetting = (currentSetting + 1) % settingCount; break;
|
||||
case sf::Keyboard::Up: currentSetting = (currentSetting + settingCount - 1) % settingCount; break;
|
||||
case sf::Keyboard::Left: *(settings[currentSetting].value) -= 0.1f; break;
|
||||
@ -215,7 +215,7 @@ int main()
|
||||
// If there is new data pending to be uploaded to the VertexBuffer, do it now
|
||||
if (bufferUploadPending)
|
||||
{
|
||||
terrain.update(&terrainStagingBuffer[0]);
|
||||
terrain.update(terrainStagingBuffer.data());
|
||||
bufferUploadPending = false;
|
||||
}
|
||||
|
||||
@ -513,7 +513,7 @@ void processWorkItem(std::vector<sf::Vertex>& vertices, const WorkItem& workItem
|
||||
}
|
||||
|
||||
// Copy the resulting geometry from our thread-local buffer into the target buffer
|
||||
std::memcpy(workItem.targetBuffer + (resolutionX * rowStart * 6), &vertices[0], sizeof(sf::Vertex) * resolutionX * rowCount * 6);
|
||||
std::memcpy(workItem.targetBuffer + (resolutionX * rowStart * 6), vertices.data(), sizeof(sf::Vertex) * resolutionX * rowCount * 6);
|
||||
}
|
||||
|
||||
|
||||
|
@ -89,7 +89,7 @@ private:
|
||||
}
|
||||
|
||||
// Fill audio data to pass to the stream
|
||||
data.samples = &m_tempBuffer[0];
|
||||
data.samples = m_tempBuffer.data();
|
||||
data.sampleCount = m_tempBuffer.size();
|
||||
|
||||
// Update the playing offset
|
||||
|
@ -341,7 +341,7 @@ public:
|
||||
vkWaitForFences(device, 1, &fences[i], VK_TRUE, std::numeric_limits<uint64_t>::max());
|
||||
|
||||
if (commandBuffers.size())
|
||||
vkFreeCommandBuffers(device, commandPool, static_cast<sf::Uint32>(commandBuffers.size()), &commandBuffers[0]);
|
||||
vkFreeCommandBuffers(device, commandPool, static_cast<sf::Uint32>(commandBuffers.size()), commandBuffers.data());
|
||||
|
||||
commandBuffers.clear();
|
||||
|
||||
@ -424,7 +424,7 @@ public:
|
||||
|
||||
layers.resize(objectCount);
|
||||
|
||||
if (vkEnumerateInstanceLayerProperties(&objectCount, &layers[0]) != VK_SUCCESS)
|
||||
if (vkEnumerateInstanceLayerProperties(&objectCount, layers.data()) != VK_SUCCESS)
|
||||
{
|
||||
vulkanAvailable = false;
|
||||
return;
|
||||
@ -486,7 +486,7 @@ public:
|
||||
requiredExtentions.pop_back();
|
||||
|
||||
instanceCreateInfo.enabledExtensionCount = static_cast<sf::Uint32>(requiredExtentions.size());
|
||||
instanceCreateInfo.ppEnabledExtensionNames = &requiredExtentions[0];
|
||||
instanceCreateInfo.ppEnabledExtensionNames = requiredExtentions.data();
|
||||
|
||||
result = vkCreateInstance(&instanceCreateInfo, 0, &instance);
|
||||
}
|
||||
@ -553,7 +553,7 @@ public:
|
||||
|
||||
devices.resize(objectCount);
|
||||
|
||||
if (vkEnumeratePhysicalDevices(instance, &objectCount, &devices[0]) != VK_SUCCESS)
|
||||
if (vkEnumeratePhysicalDevices(instance, &objectCount, devices.data()) != VK_SUCCESS)
|
||||
{
|
||||
vulkanAvailable = false;
|
||||
return;
|
||||
@ -575,7 +575,7 @@ public:
|
||||
|
||||
extensions.resize(objectCount);
|
||||
|
||||
if (vkEnumerateDeviceExtensionProperties(devices[i], 0, &objectCount, &extensions[0]) != VK_SUCCESS)
|
||||
if (vkEnumerateDeviceExtensionProperties(devices[i], 0, &objectCount, extensions.data()) != VK_SUCCESS)
|
||||
{
|
||||
vulkanAvailable = false;
|
||||
return;
|
||||
@ -659,7 +659,7 @@ public:
|
||||
|
||||
queueFamilyProperties.resize(objectCount);
|
||||
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(gpu, &objectCount, &queueFamilyProperties[0]);
|
||||
vkGetPhysicalDeviceQueueFamilyProperties(gpu, &objectCount, queueFamilyProperties.data());
|
||||
|
||||
for (std::size_t i = 0; i < queueFamilyProperties.size(); i++)
|
||||
{
|
||||
@ -730,7 +730,7 @@ public:
|
||||
|
||||
surfaceFormats.resize(objectCount);
|
||||
|
||||
if (vkGetPhysicalDeviceSurfaceFormatsKHR(gpu, surface, &objectCount, &surfaceFormats[0]) != VK_SUCCESS)
|
||||
if (vkGetPhysicalDeviceSurfaceFormatsKHR(gpu, surface, &objectCount, surfaceFormats.data()) != VK_SUCCESS)
|
||||
{
|
||||
vulkanAvailable = false;
|
||||
return;
|
||||
@ -774,7 +774,7 @@ public:
|
||||
|
||||
presentModes.resize(objectCount);
|
||||
|
||||
if (vkGetPhysicalDeviceSurfacePresentModesKHR(gpu, surface, &objectCount, &presentModes[0]) != VK_SUCCESS)
|
||||
if (vkGetPhysicalDeviceSurfacePresentModesKHR(gpu, surface, &objectCount, presentModes.data()) != VK_SUCCESS)
|
||||
{
|
||||
vulkanAvailable = false;
|
||||
return;
|
||||
@ -845,7 +845,7 @@ public:
|
||||
swapchainImages.resize(objectCount);
|
||||
swapchainImageViews.resize(objectCount);
|
||||
|
||||
if (vkGetSwapchainImagesKHR(device, swapchain, &objectCount, &swapchainImages[0]) != VK_SUCCESS)
|
||||
if (vkGetSwapchainImagesKHR(device, swapchain, &objectCount, swapchainImages.data()) != VK_SUCCESS)
|
||||
{
|
||||
vulkanAvailable = false;
|
||||
return;
|
||||
@ -896,14 +896,14 @@ public:
|
||||
|
||||
std::vector<uint32_t> buffer(static_cast<std::size_t>(file.getSize()) / sizeof(uint32_t));
|
||||
|
||||
if (file.read(&buffer[0], file.getSize()) != file.getSize())
|
||||
if (file.read(buffer.data(), file.getSize()) != file.getSize())
|
||||
{
|
||||
vulkanAvailable = false;
|
||||
return;
|
||||
}
|
||||
|
||||
shaderModuleCreateInfo.codeSize = buffer.size() * sizeof(uint32_t);
|
||||
shaderModuleCreateInfo.pCode = &buffer[0];
|
||||
shaderModuleCreateInfo.pCode = buffer.data();
|
||||
|
||||
if (vkCreateShaderModule(device, &shaderModuleCreateInfo, 0, &vertexShaderModule) != VK_SUCCESS)
|
||||
{
|
||||
@ -924,14 +924,14 @@ public:
|
||||
|
||||
std::vector<uint32_t> buffer(static_cast<std::size_t>(file.getSize()) / sizeof(uint32_t));
|
||||
|
||||
if (file.read(&buffer[0], file.getSize()) != file.getSize())
|
||||
if (file.read(buffer.data(), file.getSize()) != file.getSize())
|
||||
{
|
||||
vulkanAvailable = false;
|
||||
return;
|
||||
}
|
||||
|
||||
shaderModuleCreateInfo.codeSize = buffer.size() * sizeof(uint32_t);
|
||||
shaderModuleCreateInfo.pCode = &buffer[0];
|
||||
shaderModuleCreateInfo.pCode = buffer.data();
|
||||
|
||||
if (vkCreateShaderModule(device, &shaderModuleCreateInfo, 0, &fragmentShaderModule) != VK_SUCCESS)
|
||||
{
|
||||
@ -981,22 +981,20 @@ public:
|
||||
attachmentDescriptions[1].initialLayout = VK_IMAGE_LAYOUT_UNDEFINED;
|
||||
attachmentDescriptions[1].finalLayout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
|
||||
VkAttachmentReference attachmentReferences[2];
|
||||
VkAttachmentReference colorAttachmentReference = {};
|
||||
colorAttachmentReference.attachment = 0;
|
||||
colorAttachmentReference.layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
|
||||
attachmentReferences[0] = VkAttachmentReference();
|
||||
attachmentReferences[0].attachment = 0;
|
||||
attachmentReferences[0].layout = VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL;
|
||||
|
||||
attachmentReferences[1] = VkAttachmentReference();
|
||||
attachmentReferences[1].attachment = 1;
|
||||
attachmentReferences[1].layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
VkAttachmentReference depthStencilAttachmentReference = {};
|
||||
depthStencilAttachmentReference.attachment = 1;
|
||||
depthStencilAttachmentReference.layout = VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL;
|
||||
|
||||
// Set up the renderpass to depend on commands that execute before the renderpass begins
|
||||
VkSubpassDescription subpassDescription = VkSubpassDescription();
|
||||
subpassDescription.pipelineBindPoint = VK_PIPELINE_BIND_POINT_GRAPHICS;
|
||||
subpassDescription.colorAttachmentCount = 1;
|
||||
subpassDescription.pColorAttachments = &attachmentReferences[0];
|
||||
subpassDescription.pDepthStencilAttachment = &attachmentReferences[1];
|
||||
subpassDescription.pColorAttachments = &colorAttachmentReference;
|
||||
subpassDescription.pDepthStencilAttachment = &depthStencilAttachmentReference;
|
||||
|
||||
VkSubpassDependency subpassDependency = VkSubpassDependency();
|
||||
subpassDependency.srcSubpass = VK_SUBPASS_EXTERNAL;
|
||||
@ -2109,11 +2107,11 @@ public:
|
||||
descriptorSetAllocateInfo.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO;
|
||||
descriptorSetAllocateInfo.descriptorPool = descriptorPool;
|
||||
descriptorSetAllocateInfo.descriptorSetCount = static_cast<uint32_t>(swapchainImages.size());
|
||||
descriptorSetAllocateInfo.pSetLayouts = &descriptorSetLayouts[0];
|
||||
descriptorSetAllocateInfo.pSetLayouts = descriptorSetLayouts.data();
|
||||
|
||||
descriptorSets.resize(swapchainImages.size());
|
||||
|
||||
if (vkAllocateDescriptorSets(device, &descriptorSetAllocateInfo, &descriptorSets[0]) != VK_SUCCESS)
|
||||
if (vkAllocateDescriptorSets(device, &descriptorSetAllocateInfo, descriptorSets.data()) != VK_SUCCESS)
|
||||
{
|
||||
descriptorSets.clear();
|
||||
|
||||
@ -2175,7 +2173,7 @@ public:
|
||||
commandBufferAllocateInfo.commandBufferCount = static_cast<uint32_t>(commandBuffers.size());
|
||||
|
||||
// Allocate the command buffers from our command pool
|
||||
if (vkAllocateCommandBuffers(device, &commandBufferAllocateInfo, &commandBuffers[0]) != VK_SUCCESS)
|
||||
if (vkAllocateCommandBuffers(device, &commandBufferAllocateInfo, commandBuffers.data()) != VK_SUCCESS)
|
||||
{
|
||||
commandBuffers.clear();
|
||||
vulkanAvailable = false;
|
||||
|
@ -192,8 +192,8 @@ bool Music::onGetData(SoundStream::Chunk& data)
|
||||
toFill = static_cast<std::size_t>(loopEnd - currentOffset);
|
||||
|
||||
// Fill the chunk parameters
|
||||
data.samples = &m_samples[0];
|
||||
data.sampleCount = static_cast<std::size_t>(m_file.read(&m_samples[0], toFill));
|
||||
data.samples = m_samples.data();
|
||||
data.sampleCount = static_cast<std::size_t>(m_file.read(m_samples.data(), toFill));
|
||||
currentOffset += data.sampleCount;
|
||||
|
||||
// Check if we have stopped obtaining samples or reached either the EOF or the loop end point
|
||||
|
@ -148,7 +148,7 @@ bool SoundBuffer::saveToFile(const std::string& filename) const
|
||||
if (file.openFromFile(filename, getSampleRate(), getChannelCount()))
|
||||
{
|
||||
// Write the samples to the opened file
|
||||
file.write(&m_samples[0], m_samples.size());
|
||||
file.write(m_samples.data(), m_samples.size());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -162,7 +162,7 @@ bool SoundBuffer::saveToFile(const std::string& filename) const
|
||||
////////////////////////////////////////////////////////////
|
||||
const Int16* SoundBuffer::getSamples() const
|
||||
{
|
||||
return m_samples.empty() ? nullptr : &m_samples[0];
|
||||
return m_samples.empty() ? nullptr : m_samples.data();
|
||||
}
|
||||
|
||||
|
||||
@ -224,7 +224,7 @@ bool SoundBuffer::initialize(InputSoundFile& file)
|
||||
|
||||
// Read the samples from the provided file
|
||||
m_samples.resize(static_cast<std::size_t>(sampleCount));
|
||||
if (file.read(&m_samples[0], sampleCount) == sampleCount)
|
||||
if (file.read(m_samples.data(), sampleCount) == sampleCount)
|
||||
{
|
||||
// Update the internal buffer with the new samples
|
||||
return update(channelCount, sampleRate);
|
||||
@ -262,7 +262,7 @@ bool SoundBuffer::update(unsigned int channelCount, unsigned int sampleRate)
|
||||
|
||||
// Fill the buffer
|
||||
ALsizei size = static_cast<ALsizei>(m_samples.size() * sizeof(Int16));
|
||||
alCheck(alBufferData(m_buffer, format, &m_samples[0], size, static_cast<ALsizei>(sampleRate)));
|
||||
alCheck(alBufferData(m_buffer, format, m_samples.data(), size, static_cast<ALsizei>(sampleRate)));
|
||||
|
||||
// Compute the duration
|
||||
m_duration = seconds(static_cast<float>(m_samples.size()) / static_cast<float>(sampleRate) / static_cast<float>(channelCount));
|
||||
|
@ -63,7 +63,7 @@ bool SoundBufferRecorder::onProcessSamples(const Int16* samples, std::size_t sam
|
||||
void SoundBufferRecorder::onStop()
|
||||
{
|
||||
if (!m_samples.empty())
|
||||
m_buffer.loadFromSamples(&m_samples[0], m_samples.size(), getChannelCount(), getSampleRate());
|
||||
m_buffer.loadFromSamples(m_samples.data(), m_samples.size(), getChannelCount(), getSampleRate());
|
||||
}
|
||||
|
||||
|
||||
|
@ -113,7 +113,7 @@ void SoundFileWriterFlac::write(const Int16* samples, Uint64 count)
|
||||
m_samples32.assign(samples, samples + frames * m_channelCount);
|
||||
|
||||
// Write them to the FLAC stream
|
||||
FLAC__stream_encoder_process_interleaved(m_encoder, &m_samples32[0], frames);
|
||||
FLAC__stream_encoder_process_interleaved(m_encoder, m_samples32.data(), frames);
|
||||
|
||||
// Next chunk
|
||||
count -= m_samples32.size();
|
||||
|
@ -301,10 +301,10 @@ void SoundRecorder::processCapturedSamples()
|
||||
{
|
||||
// Get the recorded samples
|
||||
m_samples.resize(static_cast<unsigned int>(samplesAvailable) * getChannelCount());
|
||||
alcCaptureSamples(captureDevice, &m_samples[0], samplesAvailable);
|
||||
alcCaptureSamples(captureDevice, m_samples.data(), samplesAvailable);
|
||||
|
||||
// Forward them to the derived class
|
||||
if (!onProcessSamples(&m_samples[0], m_samples.size()))
|
||||
if (!onProcessSamples(m_samples.data(), m_samples.size()))
|
||||
{
|
||||
// The user wants to stop the capture
|
||||
m_isCapturing = false;
|
||||
|
@ -672,7 +672,7 @@ Glyph Font::loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, f
|
||||
// Resize the pixel buffer to the new size and fill it with transparent white pixels
|
||||
m_pixelBuffer.resize(width * height * 4);
|
||||
|
||||
Uint8* current = &m_pixelBuffer[0];
|
||||
Uint8* current = m_pixelBuffer.data();
|
||||
Uint8* end = current + width * height * 4;
|
||||
|
||||
while (current != end)
|
||||
@ -719,7 +719,7 @@ Glyph Font::loadGlyph(Uint32 codePoint, unsigned int characterSize, bool bold, f
|
||||
unsigned int y = static_cast<unsigned int>(glyph.textureRect.top) - padding;
|
||||
unsigned int w = static_cast<unsigned int>(glyph.textureRect.width) + 2 * padding;
|
||||
unsigned int h = static_cast<unsigned int>(glyph.textureRect.height) + 2 * padding;
|
||||
page.texture.update(&m_pixelBuffer[0], w, h, x, y);
|
||||
page.texture.update(m_pixelBuffer.data(), w, h, x, y);
|
||||
}
|
||||
|
||||
// Delete the FT glyph
|
||||
|
@ -61,7 +61,7 @@ void Image::create(unsigned int width, unsigned int height, const Color& color)
|
||||
std::vector<Uint8> newPixels(width * height * 4);
|
||||
|
||||
// Fill it with the specified color
|
||||
Uint8* ptr = &newPixels[0];
|
||||
Uint8* ptr = newPixels.data();
|
||||
Uint8* end = ptr + newPixels.size();
|
||||
while (ptr < end)
|
||||
{
|
||||
@ -174,7 +174,7 @@ void Image::createMaskFromColor(const Color& color, Uint8 alpha)
|
||||
if (!m_pixels.empty())
|
||||
{
|
||||
// Replace the alpha of the pixels that match the transparent color
|
||||
Uint8* ptr = &m_pixels[0];
|
||||
Uint8* ptr = m_pixels.data();
|
||||
Uint8* end = ptr + m_pixels.size();
|
||||
while (ptr < end)
|
||||
{
|
||||
@ -225,8 +225,8 @@ void Image::copy(const Image& source, unsigned int destX, unsigned int destY, co
|
||||
unsigned int rows = height;
|
||||
int srcStride = static_cast<int>(source.m_size.x) * 4;
|
||||
int dstStride = static_cast<int>(m_size.x) * 4;
|
||||
const Uint8* srcPixels = &source.m_pixels[0] + (static_cast<unsigned int>(srcRect.left) + static_cast<unsigned int>(srcRect.top) * source.m_size.x) * 4;
|
||||
Uint8* dstPixels = &m_pixels[0] + (destX + destY * m_size.x) * 4;
|
||||
const Uint8* srcPixels = source.m_pixels.data() + (static_cast<unsigned int>(srcRect.left) + static_cast<unsigned int>(srcRect.top) * source.m_size.x) * 4;
|
||||
Uint8* dstPixels = m_pixels.data() + (destX + destY * m_size.x) * 4;
|
||||
|
||||
// Copy the pixels
|
||||
if (applyAlpha)
|
||||
@ -289,7 +289,7 @@ const Uint8* Image::getPixelsPtr() const
|
||||
{
|
||||
if (!m_pixels.empty())
|
||||
{
|
||||
return &m_pixels[0];
|
||||
return m_pixels.data();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ bool ImageLoader::loadImageFromFile(const std::string& filename, std::vector<Uin
|
||||
{
|
||||
// Copy the loaded pixels to the pixel buffer
|
||||
pixels.resize(static_cast<std::size_t>(width * height * 4));
|
||||
memcpy(&pixels[0], ptr, pixels.size());
|
||||
memcpy(pixels.data(), ptr, pixels.size());
|
||||
}
|
||||
|
||||
// Free the loaded pixels (they are now in our own pixel buffer)
|
||||
@ -167,7 +167,7 @@ bool ImageLoader::loadImageFromMemory(const void* data, std::size_t dataSize, st
|
||||
{
|
||||
// Copy the loaded pixels to the pixel buffer
|
||||
pixels.resize(static_cast<std::size_t>(width * height * 4));
|
||||
memcpy(&pixels[0], ptr, pixels.size());
|
||||
memcpy(pixels.data(), ptr, pixels.size());
|
||||
}
|
||||
|
||||
// Free the loaded pixels (they are now in our own pixel buffer)
|
||||
@ -222,7 +222,7 @@ bool ImageLoader::loadImageFromStream(InputStream& stream, std::vector<Uint8>& p
|
||||
{
|
||||
// Copy the loaded pixels to the pixel buffer
|
||||
pixels.resize(static_cast<std::size_t>(width * height * 4));
|
||||
memcpy(&pixels[0], ptr, pixels.size());
|
||||
memcpy(pixels.data(), ptr, pixels.size());
|
||||
}
|
||||
|
||||
// Free the loaded pixels (they are now in our own pixel buffer)
|
||||
@ -256,25 +256,25 @@ bool ImageLoader::saveImageToFile(const std::string& filename, const std::vector
|
||||
if (extension == "bmp")
|
||||
{
|
||||
// BMP format
|
||||
if (stbi_write_bmp(filename.c_str(), convertedSize.x, convertedSize.y, 4, &pixels[0]))
|
||||
if (stbi_write_bmp(filename.c_str(), convertedSize.x, convertedSize.y, 4, pixels.data()))
|
||||
return true;
|
||||
}
|
||||
else if (extension == "tga")
|
||||
{
|
||||
// TGA format
|
||||
if (stbi_write_tga(filename.c_str(), convertedSize.x, convertedSize.y, 4, &pixels[0]))
|
||||
if (stbi_write_tga(filename.c_str(), convertedSize.x, convertedSize.y, 4, pixels.data()))
|
||||
return true;
|
||||
}
|
||||
else if (extension == "png")
|
||||
{
|
||||
// PNG format
|
||||
if (stbi_write_png(filename.c_str(), convertedSize.x, convertedSize.y, 4, &pixels[0], 0))
|
||||
if (stbi_write_png(filename.c_str(), convertedSize.x, convertedSize.y, 4, pixels.data(), 0))
|
||||
return true;
|
||||
}
|
||||
else if (extension == "jpg" || extension == "jpeg")
|
||||
{
|
||||
// JPG format
|
||||
if (stbi_write_jpg(filename.c_str(), convertedSize.x, convertedSize.y, 4, &pixels[0], 90))
|
||||
if (stbi_write_jpg(filename.c_str(), convertedSize.x, convertedSize.y, 4, pixels.data(), 90))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -297,25 +297,25 @@ bool ImageLoader::saveImageToMemory(const std::string& format, std::vector<sf::U
|
||||
if (specified == "bmp")
|
||||
{
|
||||
// BMP format
|
||||
if (stbi_write_bmp_to_func(&bufferFromCallback, &output, convertedSize.x, convertedSize.y, 4, &pixels[0]))
|
||||
if (stbi_write_bmp_to_func(&bufferFromCallback, &output, convertedSize.x, convertedSize.y, 4, pixels.data()))
|
||||
return true;
|
||||
}
|
||||
else if (specified == "tga")
|
||||
{
|
||||
// TGA format
|
||||
if (stbi_write_tga_to_func(&bufferFromCallback, &output, convertedSize.x, convertedSize.y, 4, &pixels[0]))
|
||||
if (stbi_write_tga_to_func(&bufferFromCallback, &output, convertedSize.x, convertedSize.y, 4, pixels.data()))
|
||||
return true;
|
||||
}
|
||||
else if (specified == "png")
|
||||
{
|
||||
// PNG format
|
||||
if (stbi_write_png_to_func(&bufferFromCallback, &output, convertedSize.x, convertedSize.y, 4, &pixels[0], 0))
|
||||
if (stbi_write_png_to_func(&bufferFromCallback, &output, convertedSize.x, convertedSize.y, 4, pixels.data(), 0))
|
||||
return true;
|
||||
}
|
||||
else if (specified == "jpg" || specified == "jpeg")
|
||||
{
|
||||
// JPG format
|
||||
if (stbi_write_jpg_to_func(&bufferFromCallback, &output, convertedSize.x, convertedSize.y, 4, &pixels[0], 90))
|
||||
if (stbi_write_jpg_to_func(&bufferFromCallback, &output, convertedSize.x, convertedSize.y, 4, pixels.data(), 90))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ namespace
|
||||
{
|
||||
file.seekg(0, std::ios_base::beg);
|
||||
buffer.resize(static_cast<std::size_t>(size));
|
||||
file.read(&buffer[0], static_cast<std::streamsize>(size));
|
||||
file.read(buffer.data(), static_cast<std::streamsize>(size));
|
||||
}
|
||||
buffer.push_back('\0');
|
||||
return true;
|
||||
@ -105,7 +105,7 @@ namespace
|
||||
{
|
||||
buffer.resize(static_cast<std::size_t>(size));
|
||||
stream.seek(0);
|
||||
sf::Int64 read = stream.read(&buffer[0], size);
|
||||
sf::Int64 read = stream.read(buffer.data(), size);
|
||||
success = (read == size);
|
||||
}
|
||||
buffer.push_back('\0');
|
||||
@ -247,11 +247,11 @@ bool Shader::loadFromFile(const std::string& filename, Type type)
|
||||
|
||||
// Compile the shader program
|
||||
if (type == Vertex)
|
||||
return compile(&shader[0], nullptr, nullptr);
|
||||
return compile(shader.data(), nullptr, nullptr);
|
||||
else if (type == Geometry)
|
||||
return compile(nullptr, &shader[0], nullptr);
|
||||
return compile(nullptr, shader.data(), nullptr);
|
||||
else
|
||||
return compile(nullptr, nullptr, &shader[0]);
|
||||
return compile(nullptr, nullptr, shader.data());
|
||||
}
|
||||
|
||||
|
||||
@ -275,7 +275,7 @@ bool Shader::loadFromFile(const std::string& vertexShaderFilename, const std::st
|
||||
}
|
||||
|
||||
// Compile the shader program
|
||||
return compile(&vertexShader[0], nullptr, &fragmentShader[0]);
|
||||
return compile(vertexShader.data(), nullptr, fragmentShader.data());
|
||||
}
|
||||
|
||||
|
||||
@ -307,7 +307,7 @@ bool Shader::loadFromFile(const std::string& vertexShaderFilename, const std::st
|
||||
}
|
||||
|
||||
// Compile the shader program
|
||||
return compile(&vertexShader[0], &geometryShader[0], &fragmentShader[0]);
|
||||
return compile(vertexShader.data(), geometryShader.data(), fragmentShader.data());
|
||||
}
|
||||
|
||||
|
||||
@ -353,11 +353,11 @@ bool Shader::loadFromStream(InputStream& stream, Type type)
|
||||
|
||||
// Compile the shader program
|
||||
if (type == Vertex)
|
||||
return compile(&shader[0], nullptr, nullptr);
|
||||
return compile(shader.data(), nullptr, nullptr);
|
||||
else if (type == Geometry)
|
||||
return compile(nullptr, &shader[0], nullptr);
|
||||
return compile(nullptr, shader.data(), nullptr);
|
||||
else
|
||||
return compile(nullptr, nullptr, &shader[0]);
|
||||
return compile(nullptr, nullptr, shader.data());
|
||||
}
|
||||
|
||||
|
||||
@ -381,7 +381,7 @@ bool Shader::loadFromStream(InputStream& vertexShaderStream, InputStream& fragme
|
||||
}
|
||||
|
||||
// Compile the shader program
|
||||
return compile(&vertexShader[0], nullptr, &fragmentShader[0]);
|
||||
return compile(vertexShader.data(), nullptr, fragmentShader.data());
|
||||
}
|
||||
|
||||
|
||||
@ -413,7 +413,7 @@ bool Shader::loadFromStream(InputStream& vertexShaderStream, InputStream& geomet
|
||||
}
|
||||
|
||||
// Compile the shader program
|
||||
return compile(&vertexShader[0], &geometryShader[0], &fragmentShader[0]);
|
||||
return compile(vertexShader.data(), geometryShader.data(), fragmentShader.data());
|
||||
}
|
||||
|
||||
|
||||
@ -598,7 +598,7 @@ void Shader::setUniformArray(const std::string& name, const Glsl::Vec2* vectorAr
|
||||
|
||||
UniformBinder binder(*this, name);
|
||||
if (binder.location != -1)
|
||||
glCheck(GLEXT_glUniform2fv(binder.location, static_cast<GLsizei>(length), &contiguous[0]));
|
||||
glCheck(GLEXT_glUniform2fv(binder.location, static_cast<GLsizei>(length), contiguous.data()));
|
||||
}
|
||||
|
||||
|
||||
@ -609,7 +609,7 @@ void Shader::setUniformArray(const std::string& name, const Glsl::Vec3* vectorAr
|
||||
|
||||
UniformBinder binder(*this, name);
|
||||
if (binder.location != -1)
|
||||
glCheck(GLEXT_glUniform3fv(binder.location, static_cast<GLsizei>(length), &contiguous[0]));
|
||||
glCheck(GLEXT_glUniform3fv(binder.location, static_cast<GLsizei>(length), contiguous.data()));
|
||||
}
|
||||
|
||||
|
||||
@ -620,7 +620,7 @@ void Shader::setUniformArray(const std::string& name, const Glsl::Vec4* vectorAr
|
||||
|
||||
UniformBinder binder(*this, name);
|
||||
if (binder.location != -1)
|
||||
glCheck(GLEXT_glUniform4fv(binder.location, static_cast<GLsizei>(length), &contiguous[0]));
|
||||
glCheck(GLEXT_glUniform4fv(binder.location, static_cast<GLsizei>(length), contiguous.data()));
|
||||
}
|
||||
|
||||
|
||||
@ -635,7 +635,7 @@ void Shader::setUniformArray(const std::string& name, const Glsl::Mat3* matrixAr
|
||||
|
||||
UniformBinder binder(*this, name);
|
||||
if (binder.location != -1)
|
||||
glCheck(GLEXT_glUniformMatrix3fv(binder.location, static_cast<GLsizei>(length), GL_FALSE, &contiguous[0]));
|
||||
glCheck(GLEXT_glUniformMatrix3fv(binder.location, static_cast<GLsizei>(length), GL_FALSE, contiguous.data()));
|
||||
}
|
||||
|
||||
|
||||
@ -650,7 +650,7 @@ void Shader::setUniformArray(const std::string& name, const Glsl::Mat4* matrixAr
|
||||
|
||||
UniformBinder binder(*this, name);
|
||||
if (binder.location != -1)
|
||||
glCheck(GLEXT_glUniformMatrix4fv(binder.location, static_cast<GLsizei>(length), GL_FALSE, &contiguous[0]));
|
||||
glCheck(GLEXT_glUniformMatrix4fv(binder.location, static_cast<GLsizei>(length), GL_FALSE, contiguous.data()));
|
||||
}
|
||||
|
||||
|
||||
|
@ -346,7 +346,7 @@ Image Texture::copyToImage() const
|
||||
|
||||
glCheck(GLEXT_glBindFramebuffer(GLEXT_GL_FRAMEBUFFER, frameBuffer));
|
||||
glCheck(GLEXT_glFramebufferTexture2D(GLEXT_GL_FRAMEBUFFER, GLEXT_GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture, 0));
|
||||
glCheck(glReadPixels(0, 0, m_size.x, m_size.y, GL_RGBA, GL_UNSIGNED_BYTE, &pixels[0]));
|
||||
glCheck(glReadPixels(0, 0, m_size.x, m_size.y, GL_RGBA, GL_UNSIGNED_BYTE, pixels.data()));
|
||||
glCheck(GLEXT_glDeleteFramebuffers(1, &frameBuffer));
|
||||
|
||||
glCheck(GLEXT_glBindFramebuffer(GLEXT_GL_FRAMEBUFFER, previousFrameBuffer));
|
||||
@ -358,7 +358,7 @@ Image Texture::copyToImage() const
|
||||
{
|
||||
// Texture is not padded nor flipped, we can use a direct copy
|
||||
glCheck(glBindTexture(GL_TEXTURE_2D, m_texture));
|
||||
glCheck(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, &pixels[0]));
|
||||
glCheck(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels.data()));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -367,11 +367,11 @@ Image Texture::copyToImage() const
|
||||
// All the pixels will first be copied to a temporary array
|
||||
std::vector<Uint8> allPixels(m_actualSize.x * m_actualSize.y * 4);
|
||||
glCheck(glBindTexture(GL_TEXTURE_2D, m_texture));
|
||||
glCheck(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, &allPixels[0]));
|
||||
glCheck(glGetTexImage(GL_TEXTURE_2D, 0, GL_RGBA, GL_UNSIGNED_BYTE, allPixels.data()));
|
||||
|
||||
// Then we copy the useful pixels from the temporary array to the final one
|
||||
const Uint8* src = &allPixels[0];
|
||||
Uint8* dst = &pixels[0];
|
||||
const Uint8* src = allPixels.data();
|
||||
Uint8* dst = pixels.data();
|
||||
unsigned int srcPitch = m_actualSize.x * 4;
|
||||
unsigned int dstPitch = m_size.x * 4;
|
||||
|
||||
@ -394,7 +394,7 @@ Image Texture::copyToImage() const
|
||||
|
||||
// Create the image
|
||||
Image image;
|
||||
image.create(m_size.x, m_size.y, &pixels[0]);
|
||||
image.create(m_size.x, m_size.y, pixels.data());
|
||||
|
||||
return image;
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ FloatRect VertexArray::getBounds() const
|
||||
void VertexArray::draw(RenderTarget& target, RenderStates states) const
|
||||
{
|
||||
if (!m_vertices.empty())
|
||||
target.draw(&m_vertices[0], m_vertices.size(), m_primitiveType, states);
|
||||
target.draw(m_vertices.data(), m_vertices.size(), m_primitiveType, states);
|
||||
}
|
||||
|
||||
} // namespace sf
|
||||
|
@ -82,7 +82,7 @@ void Packet::clear()
|
||||
////////////////////////////////////////////////////////////
|
||||
const void* Packet::getData() const
|
||||
{
|
||||
return !m_data.empty() ? &m_data[0] : nullptr;
|
||||
return !m_data.empty() ? m_data.data() : nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -328,10 +328,10 @@ Socket::Status TcpSocket::send(Packet& packet)
|
||||
// Copy the packet size and data into the block to send
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wnull-dereference" // False positive.
|
||||
std::memcpy(&blockToSend[0], &packetSize, sizeof(packetSize));
|
||||
std::memcpy(blockToSend.data(), &packetSize, sizeof(packetSize));
|
||||
#pragma GCC diagnostic pop
|
||||
if (size > 0)
|
||||
std::memcpy(&blockToSend[0] + sizeof(packetSize), data, size);
|
||||
std::memcpy(blockToSend.data() + sizeof(packetSize), data, size);
|
||||
|
||||
// These warnings are ignored here for portability, as even on Windows the
|
||||
// signature of `send` might change depending on whether Win32 or MinGW is
|
||||
@ -342,7 +342,7 @@ Socket::Status TcpSocket::send(Packet& packet)
|
||||
#pragma GCC diagnostic ignored "-Wsign-conversion"
|
||||
// Send the data block
|
||||
std::size_t sent;
|
||||
Status status = send(&blockToSend[0] + packet.m_sendPos, static_cast<priv::SocketImpl::Size>(blockToSend.size() - packet.m_sendPos), sent);
|
||||
Status status = send(blockToSend.data() + packet.m_sendPos, static_cast<priv::SocketImpl::Size>(blockToSend.size() - packet.m_sendPos), sent);
|
||||
#pragma GCC diagnostic pop
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@ -406,14 +406,14 @@ Socket::Status TcpSocket::receive(Packet& packet)
|
||||
if (received > 0)
|
||||
{
|
||||
m_pendingPacket.Data.resize(m_pendingPacket.Data.size() + received);
|
||||
char* begin = &m_pendingPacket.Data[0] + m_pendingPacket.Data.size() - received;
|
||||
char* begin = m_pendingPacket.Data.data() + m_pendingPacket.Data.size() - received;
|
||||
std::memcpy(begin, buffer, received);
|
||||
}
|
||||
}
|
||||
|
||||
// We have received all the packet data: we can copy it to the user packet
|
||||
if (!m_pendingPacket.Data.empty())
|
||||
packet.onReceive(&m_pendingPacket.Data[0], m_pendingPacket.Data.size());
|
||||
packet.onReceive(m_pendingPacket.Data.data(), m_pendingPacket.Data.size());
|
||||
|
||||
// Clear the pending packet data
|
||||
m_pendingPacket = PendingPacket();
|
||||
|
@ -192,12 +192,12 @@ Socket::Status UdpSocket::receive(Packet& packet, IpAddress& remoteAddress, unsi
|
||||
|
||||
// Receive the datagram
|
||||
std::size_t received = 0;
|
||||
Status status = receive(&m_buffer[0], m_buffer.size(), received, remoteAddress, remotePort);
|
||||
Status status = receive(m_buffer.data(), m_buffer.size(), received, remoteAddress, remotePort);
|
||||
|
||||
// If we received valid data, we can copy it to the user packet
|
||||
packet.clear();
|
||||
if ((status == Done) && (received > 0))
|
||||
packet.onReceive(&m_buffer[0], received);
|
||||
packet.onReceive(m_buffer.data(), received);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ Joystick::Identification JoystickImpl::getIdentification() const
|
||||
////////////////////////////////////////////////////////////
|
||||
JoystickState JoystickImpl::JoystickImpl::update()
|
||||
{
|
||||
while (read(m_file, &m_buffer[0], m_length) == m_length)
|
||||
while (read(m_file, m_buffer.data(), m_length) == m_length)
|
||||
{
|
||||
hid_data_t data = hid_start_parse(m_desc, 1 << hid_input, m_id);
|
||||
|
||||
@ -311,11 +311,11 @@ JoystickState JoystickImpl::JoystickImpl::update()
|
||||
|
||||
if (usage == HUP_BUTTON)
|
||||
{
|
||||
m_state.buttons[buttonIndex++] = hid_get_data(&m_buffer[0], &item);
|
||||
m_state.buttons[buttonIndex++] = hid_get_data(m_buffer.data(), &item);
|
||||
}
|
||||
else if (usage == HUP_GENERIC_DESKTOP)
|
||||
{
|
||||
int value = hid_get_data(&m_buffer[0], &item);
|
||||
int value = hid_get_data(m_buffer.data(), &item);
|
||||
int axis = usageToAxis(usage);
|
||||
|
||||
if (usage == HUG_HAT_SWITCH)
|
||||
|
@ -297,7 +297,7 @@ Joystick::Identification JoystickImpl::getIdentification() const
|
||||
////////////////////////////////////////////////////////////
|
||||
JoystickState JoystickImpl::JoystickImpl::update()
|
||||
{
|
||||
while (read(m_file, &m_buffer[0], m_length) == m_length)
|
||||
while (read(m_file, m_buffer.data(), m_length) == m_length)
|
||||
{
|
||||
hid_data_t data = hid_start_parse(m_desc, 1 << hid_input, m_id);
|
||||
|
||||
@ -316,11 +316,11 @@ JoystickState JoystickImpl::JoystickImpl::update()
|
||||
|
||||
if (usage == HUP_BUTTON)
|
||||
{
|
||||
m_state.buttons[buttonIndex++] = hid_get_data(&m_buffer[0], &item);
|
||||
m_state.buttons[buttonIndex++] = hid_get_data(m_buffer.data(), &item);
|
||||
}
|
||||
else if (usage == HUP_GENERIC_DESKTOP)
|
||||
{
|
||||
int value = hid_get_data(&m_buffer[0], &item);
|
||||
int value = hid_get_data(m_buffer.data(), &item);
|
||||
int axis = usageToAxis(usage);
|
||||
|
||||
if (usage == HUG_HAT_SWITCH)
|
||||
|
@ -46,8 +46,8 @@ namespace
|
||||
CFIndex length = CFStringGetLength(cfString);
|
||||
std::vector<char> str(length);
|
||||
CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8);
|
||||
CFStringGetCString(cfString, &str[0], maxSize, kCFStringEncodingUTF8);
|
||||
return &str[0];
|
||||
CFStringGetCString(cfString, str.data(), maxSize, kCFStringEncodingUTF8);
|
||||
return str.data();
|
||||
}
|
||||
|
||||
// Get HID device property key as a string
|
||||
|
@ -263,7 +263,7 @@ void SFContext::createContext(SFContext* shared,
|
||||
m_settings.sRgbCapable = true;
|
||||
|
||||
// Create the pixel format.
|
||||
NSOpenGLPixelFormat* pixFmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:&attrs[0]];
|
||||
NSOpenGLPixelFormat* pixFmt = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs.data()];
|
||||
|
||||
if (pixFmt == nil)
|
||||
{
|
||||
|
@ -306,7 +306,7 @@ void ClipboardImpl::processEvent(XEvent& windowEvent)
|
||||
XA_ATOM,
|
||||
32,
|
||||
PropModeReplace,
|
||||
reinterpret_cast<unsigned char*>(&targets[0]),
|
||||
reinterpret_cast<unsigned char*>(targets.data()),
|
||||
static_cast<int>(targets.size())
|
||||
);
|
||||
|
||||
|
@ -131,9 +131,9 @@ bool CursorImpl::loadFromPixelsMonochrome(const Uint8* pixels, Vector2u size, Ve
|
||||
}
|
||||
|
||||
Pixmap maskPixmap = XCreateBitmapFromData(m_display, XDefaultRootWindow(m_display),
|
||||
reinterpret_cast<char*>(&mask[0]), size.x, size.y);
|
||||
reinterpret_cast<char*>(mask.data()), size.x, size.y);
|
||||
Pixmap dataPixmap = XCreateBitmapFromData(m_display, XDefaultRootWindow(m_display),
|
||||
reinterpret_cast<char*>(&data[0]), size.x, size.y);
|
||||
reinterpret_cast<char*>(data.data()), size.x, size.y);
|
||||
|
||||
// Define the foreground color as white and the background as black.
|
||||
XColor fg, bg;
|
||||
|
@ -726,7 +726,7 @@ void GlxContext::createContext(GlxContext* shared)
|
||||
}
|
||||
|
||||
// Create the context
|
||||
m_context = glXCreateContextAttribsARB(m_display, *config, toShare, true, &attributes[0]);
|
||||
m_context = glXCreateContextAttribsARB(m_display, *config, toShare, true, attributes.data());
|
||||
|
||||
if (!m_context)
|
||||
{
|
||||
|
@ -137,7 +137,7 @@ bool VulkanImplX11::isAvailable(bool requireGraphics)
|
||||
|
||||
extensionProperties.resize(extensionCount);
|
||||
|
||||
wrapper.vkEnumerateInstanceExtensionProperties(0, &extensionCount, &extensionProperties[0]);
|
||||
wrapper.vkEnumerateInstanceExtensionProperties(0, &extensionCount, extensionProperties.data());
|
||||
|
||||
// Check if the necessary extensions are available
|
||||
bool has_VK_KHR_surface = false;
|
||||
|
@ -131,7 +131,7 @@ namespace
|
||||
buffer[offset] = 0;
|
||||
|
||||
// Remove the path to keep the executable name only
|
||||
return basename(&buffer[0]);
|
||||
return basename(buffer.data());
|
||||
}
|
||||
|
||||
// Default fallback name
|
||||
@ -732,7 +732,7 @@ m_lastInputTime (0)
|
||||
std::string executableName = findExecutableName();
|
||||
std::vector<char> windowInstance(executableName.size() + 1, 0);
|
||||
std::copy(executableName.begin(), executableName.end(), windowInstance.begin());
|
||||
hint->res_name = &windowInstance[0];
|
||||
hint->res_name = windowInstance.data();
|
||||
|
||||
// The class name identifies a class of windows that
|
||||
// "are of the same type". We simply use the initial window name as
|
||||
@ -740,7 +740,7 @@ m_lastInputTime (0)
|
||||
std::string ansiTitle = title.toAnsiString();
|
||||
std::vector<char> windowClass(ansiTitle.size() + 1, 0);
|
||||
std::copy(ansiTitle.begin(), ansiTitle.end(), windowClass.begin());
|
||||
hint->res_class = &windowClass[0];
|
||||
hint->res_class = windowClass.data();
|
||||
|
||||
XSetClassHint(m_display, m_window, hint);
|
||||
|
||||
@ -1051,7 +1051,7 @@ void WindowImplX11::setIcon(unsigned int width, unsigned int height, const Uint8
|
||||
}
|
||||
}
|
||||
}
|
||||
m_iconMaskPixmap = XCreatePixmapFromBitmapData(m_display, m_window, reinterpret_cast<char*>(&maskPixels[0]), width, height, 1, 0, 1);
|
||||
m_iconMaskPixmap = XCreatePixmapFromBitmapData(m_display, m_window, reinterpret_cast<char*>(maskPixels.data()), width, height, 1, 0, 1);
|
||||
|
||||
// Send our new icon to the window through the WMHints
|
||||
XWMHints* hints = XAllocWMHints();
|
||||
@ -1064,7 +1064,7 @@ void WindowImplX11::setIcon(unsigned int width, unsigned int height, const Uint8
|
||||
// ICCCM wants BGRA pixels: swap red and blue channels
|
||||
// ICCCM also wants the first 2 unsigned 32-bit values to be width and height
|
||||
std::vector<unsigned long> icccmIconPixels(2 + width * height, 0);
|
||||
unsigned long* ptr = &icccmIconPixels[0];
|
||||
unsigned long* ptr = icccmIconPixels.data();
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wnull-dereference" // False positive.
|
||||
@ -1088,7 +1088,7 @@ void WindowImplX11::setIcon(unsigned int width, unsigned int height, const Uint8
|
||||
XA_CARDINAL,
|
||||
32,
|
||||
PropModeReplace,
|
||||
reinterpret_cast<const unsigned char*>(&icccmIconPixels[0]),
|
||||
reinterpret_cast<const unsigned char*>(icccmIconPixels.data()),
|
||||
static_cast<int>(2 + width * height));
|
||||
|
||||
XFlush(m_display);
|
||||
@ -1591,7 +1591,7 @@ void WindowImplX11::setProtocols()
|
||||
XA_ATOM,
|
||||
32,
|
||||
PropModeReplace,
|
||||
reinterpret_cast<const unsigned char*>(&atoms[0]),
|
||||
reinterpret_cast<const unsigned char*>(atoms.data()),
|
||||
static_cast<int>(atoms.size()));
|
||||
}
|
||||
else
|
||||
|
@ -139,7 +139,7 @@ bool VulkanImplWin32::isAvailable(bool requireGraphics)
|
||||
|
||||
extensionProperties.resize(extensionCount);
|
||||
|
||||
wrapper.vkEnumerateInstanceExtensionProperties(0, &extensionCount, &extensionProperties[0]);
|
||||
wrapper.vkEnumerateInstanceExtensionProperties(0, &extensionCount, extensionProperties.data());
|
||||
|
||||
// Check if the necessary extensions are available
|
||||
bool has_VK_KHR_surface = false;
|
||||
|
@ -664,7 +664,7 @@ void WglContext::createContext(WglContext* shared)
|
||||
}
|
||||
|
||||
// Create the context
|
||||
m_context = wglCreateContextAttribsARB(m_deviceContext, sharedContext, &attributes[0]);
|
||||
m_context = wglCreateContextAttribsARB(m_deviceContext, sharedContext, attributes.data());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -376,7 +376,7 @@ void WindowImplWin32::setIcon(unsigned int width, unsigned int height, const Uin
|
||||
}
|
||||
|
||||
// Create the icon from the pixel array
|
||||
m_icon = CreateIcon(GetModuleHandleW(nullptr), static_cast<int>(width), static_cast<int>(height), 1, 32, nullptr, &iconPixels[0]);
|
||||
m_icon = CreateIcon(GetModuleHandleW(nullptr), static_cast<int>(width), static_cast<int>(height), 1, 32, nullptr, iconPixels.data());
|
||||
|
||||
// Set it as both big and small icon of the window
|
||||
if (m_icon)
|
||||
|
Loading…
Reference in New Issue
Block a user