Add support for pre-decoded image loading

- OnLoadFromDecodedData method for async decoded images
- Bypasses redundant decoding when data comes from worker thread
- Integrates with FileLoaderThreadPool pipeline
This commit is contained in:
savis
2026-01-03 20:37:52 +01:00
parent 3f0f3c792d
commit f702b4953d
2 changed files with 22 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
#include "StdAfx.h"
#include "GrpImage.h"
#include "DecodedImageData.h"
CGraphicImage::CGraphicImage(const char * c_szFileName, DWORD dwFilter) :
CResource(c_szFileName),
@@ -79,6 +80,23 @@ bool CGraphicImage::OnLoad(int iSize, const void * c_pvBuf)
return true;
}
bool CGraphicImage::OnLoadFromDecodedData(const TDecodedImageData& decodedImage)
{
if (!decodedImage.IsValid())
return false;
m_imageTexture.SetFileName(CResource::GetFileName());
if (!m_imageTexture.CreateFromDecodedData(decodedImage, D3DFMT_UNKNOWN, m_dwFilter))
return false;
m_rect.left = 0;
m_rect.top = 0;
m_rect.right = m_imageTexture.GetWidth();
m_rect.bottom = m_imageTexture.GetHeight();
return true;
}
void CGraphicImage::OnClear()
{
// Tracef("Image Destroy : %s\n", m_pszFileName);

View File

@@ -5,6 +5,8 @@
#include "Resource.h"
#include "GrpImageTexture.h"
struct TDecodedImageData;
class CGraphicImage : public CResource
{
public:
@@ -28,6 +30,8 @@ class CGraphicImage : public CResource
const CGraphicTexture & GetTextureReference() const;
CGraphicTexture * GetTexturePointer();
bool OnLoadFromDecodedData(const TDecodedImageData& decodedImage);
protected:
bool OnLoad(int iSize, const void * c_pvBuf);