Maintenance: [forced, user-approved] R1 (resubmit of 10219 on 4cf7a69f): remove invented resource contexts ActionResourceContext, Spr
Batch #10229 by ragnarok-clanker: forced by an admin (4 lower score(s), 45 changed function(s)); checked with 314 compiled unit(s), including every includer of Source/Resource/Bitmap/BitmapImage.h, Source/Resource/Bitmap/BitmapResource.h, Source/Resource/Bitmap/IJL15Runtime.h, Source/Resource/EmblemResource.h, Source/Resource/GifResource.h, Source/Resource/Models/AnimatedModelResource.h, Source/Resource/Models/GrannyModelResource.h, Source/Resource/Models/ModelResource.h, Source/Resource/Sprites/ActionResource.h, Source/Resource/Sprites/SpriteResource.h, Source/UI/Buttons/UIBmpRadioBtn.h.
This commit is contained in:
parent
3f94f3048e
commit
85414e2012
21 changed files with 104 additions and 181 deletions
|
|
@ -1,37 +1,35 @@
|
|||
#include "Client/Application/ErrorDialog.h"
|
||||
#include "File/File.h"
|
||||
#include "Render/DeviceContext/DCSurface.h"
|
||||
#include "Resource/Bitmap/BitmapResource.h"
|
||||
|
||||
#include <cstring>
|
||||
#include <windows.h>
|
||||
|
||||
// OFFSET: 0x00749580
|
||||
// FUNCTION: fn_07861
|
||||
CBitmapRes::CBitmapRes(BitmapResourceContext& context) : m_context(&context) {
|
||||
}
|
||||
|
||||
// INLINED
|
||||
CBitmapRes::~CBitmapRes() = default;
|
||||
|
||||
// OFFSET: 0x00749580
|
||||
// FUNCTION: fn_07847
|
||||
CBitmapRes* CBitmapRes::Create() {
|
||||
return new CBitmapRes(*this->m_context);
|
||||
return new CBitmapRes;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00749630
|
||||
// FUNCTION: fn_07848
|
||||
bool CBitmapRes::Load(const char* name) {
|
||||
CFile file;
|
||||
bool result = false;
|
||||
if (name && this->m_context->file.Open(name)) {
|
||||
if (this->Decode(name, this->m_context->file.Data(), this->m_context->file.Size(), false)) {
|
||||
this->m_context->file.Close();
|
||||
if (name && file.Open(name, 0, true, false)) {
|
||||
if (this->Decode(name, file.GetData(), file.GetSize(), false)) {
|
||||
file.Close();
|
||||
result = true;
|
||||
} else {
|
||||
this->m_context->file.Close();
|
||||
file.Close();
|
||||
}
|
||||
}
|
||||
|
||||
this->m_context->file.Close();
|
||||
file.Close();
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
@ -58,13 +56,13 @@ bool CBitmapRes::Decode(const char* name, const void* data, int bytes, bool icon
|
|||
}
|
||||
|
||||
if (lstrcmpiA(extension, ".jpg") == 0) {
|
||||
return this->image.DecodeJpeg(data, bytes, this->m_context->jpeg);
|
||||
return this->image.DecodeJpeg(data, bytes);
|
||||
}
|
||||
|
||||
if (lstrcmpiA(extension, ".png") == 0) {
|
||||
return this->image.DecodePng(data, bytes, name);
|
||||
}
|
||||
|
||||
ShowErrorDialog(this->m_context->renderSystem, "Unsupport fileformat!", 0);
|
||||
ShowErrorDialog(GetRenderSystemHolder()->system, "Unsupport fileformat!", 0);
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue