diff --git a/es-core/src/ImageIO.cpp b/es-core/src/ImageIO.cpp index bdcc4e0d0..54710c98c 100644 --- a/es-core/src/ImageIO.cpp +++ b/es-core/src/ImageIO.cpp @@ -14,25 +14,25 @@ #include std::vector ImageIO::loadFromMemoryRGBA32(const unsigned char* data, - const size_t size, size_t & width, size_t & height) + const size_t size, size_t& width, size_t& height) { std::vector rawData; width = 0; height = 0; - FIMEMORY * fiMemory = FreeImage_OpenMemory((BYTE *)data, (DWORD)size); + FIMEMORY* fiMemory = FreeImage_OpenMemory(const_cast(data), static_cast(size)); if (fiMemory != nullptr) { // Detect the filetype from data. FREE_IMAGE_FORMAT format = FreeImage_GetFileTypeFromMemory(fiMemory); if (format != FIF_UNKNOWN && FreeImage_FIFSupportsReading(format)) { - // File type is supported. load image, - FIBITMAP * fiBitmap = FreeImage_LoadFromMemory(format, fiMemory); + // File type is supported, load image. + FIBITMAP* fiBitmap = FreeImage_LoadFromMemory(format, fiMemory); if (fiBitmap != nullptr) { - // Loaded. convert to 32bit if necessary. + // Loaded. convert to 32-bit if necessary. if (FreeImage_GetBPP(fiBitmap) != 32) { - FIBITMAP * fiConverted = FreeImage_ConvertTo32Bits(fiBitmap); + FIBITMAP* fiConverted = FreeImage_ConvertTo32Bits(fiBitmap); if (fiConverted != nullptr) { - //free original bitmap data + // Free original bitmap data. FreeImage_Unload(fiBitmap); fiBitmap = fiConverted; } @@ -42,14 +42,14 @@ std::vector ImageIO::loadFromMemoryRGBA32(const unsigned char* da height = FreeImage_GetHeight(fiBitmap); // Loop through scanlines and add all pixel data to the return vector. // This is necessary, because width*height*bpp might not be == pitch. - unsigned char * tempData = new unsigned char[width * height * 4]; + unsigned char* tempData = new unsigned char[width * height * 4]; for (size_t i = 0; i < height; i++) { - const BYTE * scanLine = FreeImage_GetScanLine(fiBitmap, - static_cast(i)); + const BYTE* scanLine = + FreeImage_GetScanLine(fiBitmap, static_cast(i)); memcpy(tempData + (i * width * 4), scanLine, width * 4); } // Convert from BGRA to RGBA. - for (size_t i = 0; i < width*height; i++) { + for (size_t i = 0; i < width * height; i++) { RGBQUAD bgra = reinterpret_cast(tempData)[i]; RGBQUAD rgba; rgba.rgbBlue = bgra.rgbRed; @@ -65,15 +65,14 @@ std::vector ImageIO::loadFromMemoryRGBA32(const unsigned char* da } } else { - LOG(LogError) << "Failed to load image from memory!"; + LOG(LogError) << "Failed to load image from memory"; } } else { LOG(LogError) << "Couldn't load image, file is missing or the file type is " << -// it's not existing or the file type " << - (format == FIF_UNKNOWN ? "unknown" : "unsupported") << "!"; + (format == FIF_UNKNOWN ? "unknown" : "unsupported"); } - // Free fiMemory again + // Free fiMemory again. FreeImage_CloseMemory(fiMemory); } return rawData; diff --git a/es-core/src/components/NinePatchComponent.cpp b/es-core/src/components/NinePatchComponent.cpp index 497f8cf32..8a8495e12 100644 --- a/es-core/src/components/NinePatchComponent.cpp +++ b/es-core/src/components/NinePatchComponent.cpp @@ -52,7 +52,7 @@ void NinePatchComponent::buildVertices() if (mVertices != nullptr) delete[] mVertices; - // Scale the corner size according to the screen resolution. + // Scale the corner size relative to the screen resolution. mTexture = TextureResource::get(mPath, false, false, true, Renderer::getScreenWidthModifier()); if (mTexture->getSize() == Vector2i::Zero()) { diff --git a/es-core/src/renderers/Renderer.cpp b/es-core/src/renderers/Renderer.cpp index d68b1f4b9..c03267710 100644 --- a/es-core/src/renderers/Renderer.cpp +++ b/es-core/src/renderers/Renderer.cpp @@ -335,7 +335,7 @@ namespace Renderer void popClipRect() { if (clipStack.empty()) { - LOG(LogError) << "Tried to popClipRect while the stack was empty!"; + LOG(LogError) << "Tried to popClipRect while the stack was empty"; return; }