source/Graphics: do not prefix standard c functions with "std::", also include the right files.
This commit is contained in:
parent
ba11d5002b
commit
f3a3a6aa4d
2 changed files with 16 additions and 14 deletions
|
|
@ -1,7 +1,8 @@
|
|||
|
||||
#include "ImageLoader.h"
|
||||
#include <cstring>
|
||||
#include <Spectre/System/Log.h>
|
||||
#include <Spectre/Graphics/Image.h>
|
||||
#include "ImageLoader.h"
|
||||
|
||||
static ImageLoader _loader;
|
||||
|
||||
|
|
@ -93,7 +94,7 @@ unsigned int Image::getBpp() const
|
|||
case PixelFormat::PF_RGBA : return 32;
|
||||
case PixelFormat::PF_RGB : return 24;
|
||||
case PixelFormat::PF_Alpha : return 8;
|
||||
case PixelFormat::PF_Unknown :
|
||||
case PixelFormat::PF_Unknown :
|
||||
default : break;
|
||||
}
|
||||
return 0;
|
||||
|
|
@ -154,7 +155,7 @@ Color Image::getPixel(unsigned x, unsigned y) const
|
|||
{
|
||||
Color c;
|
||||
const unsigned char *base = m_pixels.data() + ((getBpp() / 8) * ((y * m_size.x) + x));
|
||||
|
||||
|
||||
// RGB / RGBA formats.
|
||||
if (m_format == PixelFormat::PF_RGB || m_format == PixelFormat::PF_RGBA) {
|
||||
c.r = base[0];
|
||||
|
|
@ -165,7 +166,7 @@ Color Image::getPixel(unsigned x, unsigned y) const
|
|||
} else {
|
||||
c.a = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Alpha, single channel format.
|
||||
else if (m_format == PixelFormat::PF_Alpha) {
|
||||
c = Color(0, 0, 0, base[0]);
|
||||
|
|
@ -191,12 +192,12 @@ void Image::flipY()
|
|||
}
|
||||
}
|
||||
|
||||
void Image::setPixels(const void *pixels)
|
||||
void Image::setPixels(const void *pixels)
|
||||
{
|
||||
unsigned int size = m_size.y * getStride();
|
||||
|
||||
m_pixels.resize(size);
|
||||
std::memcpy(&m_pixels[0], pixels, m_pixels.size());
|
||||
memcpy(&m_pixels[0], pixels, m_pixels.size());
|
||||
}
|
||||
|
||||
const unsigned char* Image::getPixels() const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue