mirror of https://github.com/OpenRCT2/OpenRCT2.git
Clean up CmdlineSprite.cpp
This commit is contained in:
parent
51872f9741
commit
08b0268b0f
|
@ -13,10 +13,8 @@
|
||||||
|
|
||||||
#include "OpenRCT2.h"
|
#include "OpenRCT2.h"
|
||||||
#include "core/Imaging.h"
|
#include "core/Imaging.h"
|
||||||
#include "core/String.hpp"
|
|
||||||
#include "drawing/Drawing.h"
|
#include "drawing/Drawing.h"
|
||||||
#include "drawing/ImageImporter.h"
|
#include "drawing/ImageImporter.h"
|
||||||
#include "localisation/Language.h"
|
|
||||||
#include "platform/platform.h"
|
#include "platform/platform.h"
|
||||||
#include "util/Util.h"
|
#include "util/Util.h"
|
||||||
|
|
||||||
|
@ -24,6 +22,10 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <jansson.h>
|
#include <jansson.h>
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
# include "core/String.hpp"
|
||||||
|
#endif
|
||||||
|
|
||||||
using namespace OpenRCT2::Drawing;
|
using namespace OpenRCT2::Drawing;
|
||||||
|
|
||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
|
@ -262,18 +264,18 @@ static bool sprite_file_import(
|
||||||
|
|
||||||
if (!forceBmp)
|
if (!forceBmp)
|
||||||
{
|
{
|
||||||
flags = (ImageImporter::IMPORT_FLAGS)ImageImporter::IMPORT_FLAGS::RLE;
|
flags = ImageImporter::IMPORT_FLAGS::RLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keep_palette)
|
if (keep_palette)
|
||||||
{
|
{
|
||||||
format = IMAGE_FORMAT::PNG;
|
format = IMAGE_FORMAT::PNG;
|
||||||
flags = (ImageImporter::IMPORT_FLAGS)(flags | ImageImporter::IMPORT_FLAGS::KEEP_PALETTE);
|
flags = static_cast<ImageImporter::IMPORT_FLAGS>(flags | ImageImporter::IMPORT_FLAGS::KEEP_PALETTE);
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageImporter importer;
|
ImageImporter importer;
|
||||||
auto image = Imaging::ReadFromFile(path, format);
|
auto image = Imaging::ReadFromFile(path, format);
|
||||||
auto result = importer.Import(image, x_offset, y_offset, flags, (ImageImporter::IMPORT_MODE)mode);
|
auto result = importer.Import(image, x_offset, y_offset, flags, static_cast<ImageImporter::IMPORT_MODE>(mode));
|
||||||
|
|
||||||
*outElement = result.Element;
|
*outElement = result.Element;
|
||||||
*outBuffer = static_cast<uint8_t*>(result.Buffer);
|
*outBuffer = static_cast<uint8_t*>(result.Buffer);
|
||||||
|
|
Loading…
Reference in New Issue