mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-05-31 06:53:03 +00:00
Remove Win32 byte types from memory texture loaders
This commit is contained in:
parent
fca297538b
commit
6026f078ac
|
|
@ -193,8 +193,8 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool fi
|
|||
{
|
||||
HRESULT hr;
|
||||
std::wstring filePath = File;
|
||||
BYTE *pbData = NULL;
|
||||
DWORD dwBytes = 0;
|
||||
std::uint8_t *pbData = NULL;
|
||||
std::uint32_t dataBytes = 0;
|
||||
|
||||
for( int l = 0 ; l < 10; l++ )
|
||||
{
|
||||
|
|
@ -229,8 +229,8 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool fi
|
|||
}
|
||||
|
||||
DLCFile *dlcFile = dlcPack->getFile(DLCManager::e_DLCType_All, name);
|
||||
pbData = dlcFile->getData(dwBytes);
|
||||
if(pbData == NULL || dwBytes == 0)
|
||||
pbData = dlcFile->getData(dataBytes);
|
||||
if(pbData == NULL || dataBytes == 0)
|
||||
{
|
||||
// 4J - If we haven't loaded the non-mipmap version then exit the game
|
||||
if( l == 0 )
|
||||
|
|
@ -242,7 +242,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool fi
|
|||
|
||||
D3DXIMAGE_INFO ImageInfo;
|
||||
ZeroMemory(&ImageInfo,sizeof(D3DXIMAGE_INFO));
|
||||
hr=RenderManager.LoadTextureData(pbData,dwBytes,&ImageInfo,&data[l]);
|
||||
hr=RenderManager.LoadTextureData(pbData,dataBytes,&ImageInfo,&data[l]);
|
||||
|
||||
|
||||
if(hr!=ERROR_SUCCESS)
|
||||
|
|
@ -264,7 +264,7 @@ BufferedImage::BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool fi
|
|||
}
|
||||
|
||||
|
||||
BufferedImage::BufferedImage(BYTE *pbData, DWORD dwBytes)
|
||||
BufferedImage::BufferedImage(std::uint8_t *pbData, std::uint32_t dataBytes)
|
||||
{
|
||||
int iCurrentByte=0;
|
||||
for( int l = 0 ; l < 10; l++ )
|
||||
|
|
@ -274,7 +274,7 @@ BufferedImage::BufferedImage(BYTE *pbData, DWORD dwBytes)
|
|||
|
||||
D3DXIMAGE_INFO ImageInfo;
|
||||
ZeroMemory(&ImageInfo,sizeof(D3DXIMAGE_INFO));
|
||||
HRESULT hr=RenderManager.LoadTextureData(pbData,dwBytes,&ImageInfo,&data[0]);
|
||||
HRESULT hr=RenderManager.LoadTextureData(pbData,dataBytes,&ImageInfo,&data[0]);
|
||||
|
||||
if(hr==ERROR_SUCCESS)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <cstdint>
|
||||
|
||||
|
||||
class Graphics;
|
||||
|
|
@ -17,7 +18,7 @@ public:
|
|||
BufferedImage(int width,int height,int type);
|
||||
BufferedImage(const std::wstring& File, bool filenameHasExtension = false, bool bTitleUpdateTexture=false, const std::wstring &drive =L""); // 4J added
|
||||
BufferedImage(DLCPack *dlcPack, const std::wstring& File, bool filenameHasExtension = false ); // 4J Added
|
||||
BufferedImage(BYTE *pbData, DWORD dwBytes); // 4J added
|
||||
BufferedImage(std::uint8_t *pbData, std::uint32_t dataBytes); // 4J added
|
||||
~BufferedImage();
|
||||
|
||||
int getWidth();
|
||||
|
|
@ -30,4 +31,4 @@ public:
|
|||
BufferedImage *getSubimage(int x, int y, int w, int h);
|
||||
|
||||
void preMultiplyAlpha();
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#include "../Platform/stdafx.h"
|
||||
#include "MemTexture.h"
|
||||
|
||||
MemTexture::MemTexture(const std::wstring& _url, PBYTE pbData,DWORD dwBytes, MemTextureProcessor *processor)
|
||||
MemTexture::MemTexture(const std::wstring& _url, std::uint8_t *pbData, std::uint32_t dataBytes, MemTextureProcessor *processor)
|
||||
{
|
||||
// 4J - added
|
||||
count = 1;
|
||||
|
|
@ -14,7 +14,7 @@ MemTexture::MemTexture(const std::wstring& _url, PBYTE pbData,DWORD dwBytes, Mem
|
|||
// load the texture, and process it
|
||||
//loadedImage=Textures::getTexture()
|
||||
// 4J - remember to add deletes in here for any created BufferedImages when implemented
|
||||
loadedImage = new BufferedImage(pbData,dwBytes);
|
||||
loadedImage = new BufferedImage(pbData,dataBytes);
|
||||
if(processor==NULL)
|
||||
{
|
||||
|
||||
|
|
@ -30,4 +30,4 @@ MemTexture::MemTexture(const std::wstring& _url, PBYTE pbData,DWORD dwBytes, Mem
|
|||
MemTexture::~MemTexture()
|
||||
{
|
||||
delete loadedImage;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
#pragma once
|
||||
#include <cstdint>
|
||||
class BufferedImage;
|
||||
class MemTextureProcessor;
|
||||
|
||||
|
|
@ -12,6 +13,6 @@ public:
|
|||
int ticksSinceLastUse;
|
||||
static const int UNUSED_TICKS_TO_FREE = 20;
|
||||
|
||||
MemTexture(const std::wstring& _name, PBYTE pbData, DWORD dwBytes, MemTextureProcessor *processor);
|
||||
MemTexture(const std::wstring& _name, std::uint8_t *pbData, std::uint32_t dataBytes, MemTextureProcessor *processor);
|
||||
~MemTexture();
|
||||
};
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue