- extension/src/{port,platform,codepage} -> src/; native_render -> src/host
(+ dxt, shaders/); libgr2 -> src/gr2; extension/third_party -> third_party
- extension/tests -> tests/port, libgr2/tests -> tests/gr2
- android-native -> android (build.sh, push-client.sh moved in)
- script -> scripts; tools/40250 -> tools/server; oracle -> tools/granny-oracle;
perf tools -> tools/perf
- all build trees under build/ (native, release, android, port-gate)
- xrender:: CMake aliases -> mt::; port-map ledger impl paths rewritten
No code changes. ctest 15/15, port_gate macos+android PASS, port_map check 0 errors.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
168 lines
4.3 KiB
C++
168 lines
4.3 KiB
C++
// Platform skeleton for EterLib/GrpImageInstance.h (40250 EterLib/GrpImageInstance.cpp), generated by platform_stub.py.
|
|
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
|
#include "EterLib/StdAfx.h"
|
|
#include "EterLib/GrpImageInstance.h"
|
|
|
|
#include "../PlatformStub.h"
|
|
#include "UIRenderCommands.h"
|
|
#include "EterBase/CRC32.h"
|
|
|
|
auto CGraphicImageInstance::Type() -> DWORD
|
|
{
|
|
static DWORD type = GetCRC32("CGraphicImageInstance", sizeof("CGraphicImageInstance") - 1);
|
|
return type;
|
|
}
|
|
|
|
auto CGraphicImageInstance::IsType(DWORD type) -> BOOL
|
|
{
|
|
return OnIsType(type);
|
|
}
|
|
|
|
CGraphicImageInstance::CGraphicImageInstance()
|
|
{
|
|
m_DiffuseColor = D3DXCOLOR(1, 1, 1, 1);
|
|
m_v2Position = D3DXVECTOR2(0, 0);
|
|
}
|
|
|
|
CGraphicImageInstance::~CGraphicImageInstance()
|
|
{
|
|
Destroy();
|
|
}
|
|
|
|
// 40250 Destroy(): drop the image reference, then Initialize() (white, at the origin).
|
|
auto CGraphicImageInstance::Destroy() -> void
|
|
{
|
|
m_roImage.Clear();
|
|
m_DiffuseColor = D3DXCOLOR(1, 1, 1, 1);
|
|
m_v2Position = D3DXVECTOR2(0, 0);
|
|
}
|
|
|
|
auto CGraphicImageInstance::Render() -> void
|
|
{
|
|
if (!IsEmpty()) OnRender();
|
|
}
|
|
|
|
auto CGraphicImageInstance::SetDiffuseColor(float r, float g, float b, float a) -> void
|
|
{
|
|
m_DiffuseColor = D3DXCOLOR(r, g, b, a);
|
|
}
|
|
|
|
auto CGraphicImageInstance::SetPosition(float x, float y) -> void
|
|
{
|
|
m_v2Position = D3DXVECTOR2(x, y);
|
|
}
|
|
|
|
auto CGraphicImageInstance::SetImagePointer(CGraphicImage *image) -> void
|
|
{
|
|
m_roImage.SetPointer(image);
|
|
OnSetImagePointer();
|
|
}
|
|
|
|
auto CGraphicImageInstance::ReloadImagePointer(CGraphicImage *) -> void
|
|
{
|
|
MT_PLATFORM_STUB();
|
|
}
|
|
|
|
auto CGraphicImageInstance::IsEmpty() const -> bool
|
|
{
|
|
return m_roImage.IsNull() || m_roImage->IsEmpty();
|
|
}
|
|
|
|
auto CGraphicImageInstance::GetWidth() -> int
|
|
{
|
|
return IsEmpty() ? 0 : m_roImage->GetWidth();
|
|
}
|
|
|
|
auto CGraphicImageInstance::GetHeight() -> int
|
|
{
|
|
return IsEmpty() ? 0 : m_roImage->GetHeight();
|
|
}
|
|
|
|
auto CGraphicImageInstance::GetTexturePointer() -> CGraphicTexture *
|
|
{
|
|
CGraphicImage* pkImage = m_roImage.GetPointer();
|
|
return pkImage ? pkImage->GetTexturePointer() : NULL;
|
|
}
|
|
|
|
auto CGraphicImageInstance::GetTextureReference() const -> const CGraphicTexture &
|
|
{
|
|
return m_roImage->GetTextureReference();
|
|
}
|
|
|
|
auto CGraphicImageInstance::GetGraphicImagePointer() -> CGraphicImage *
|
|
{
|
|
return m_roImage.GetPointer();
|
|
}
|
|
|
|
auto CGraphicImageInstance::operator==(const CGraphicImageInstance &) const -> bool
|
|
{
|
|
MT_PLATFORM_STUB();
|
|
return mt_platform_stub_return<bool>();
|
|
}
|
|
|
|
auto CGraphicImageInstance::Initialize() -> void
|
|
{
|
|
MT_PLATFORM_STUB();
|
|
}
|
|
|
|
// 40250 GrpImageInstance.cpp:44-96: the image's rect inside its texture (a .sub shares its parent's)
|
|
// becomes the texture coordinates of one quad.
|
|
auto CGraphicImageInstance::OnRender() -> void
|
|
{
|
|
CGraphicImage * pImage = m_roImage.GetPointer();
|
|
CGraphicTexture * pTexture = pImage->GetTexturePointer();
|
|
if (pTexture->GetWidth() <= 0 || pTexture->GetHeight() <= 0)
|
|
return;
|
|
|
|
float fimgWidth = pImage->GetWidth();
|
|
float fimgHeight = pImage->GetHeight();
|
|
|
|
const RECT& c_rRect = pImage->GetRectReference();
|
|
float texReverseWidth = 1.0f / float(pTexture->GetWidth());
|
|
float texReverseHeight = 1.0f / float(pTexture->GetHeight());
|
|
float su = c_rRect.left * texReverseWidth;
|
|
float sv = c_rRect.top * texReverseHeight;
|
|
float eu = (c_rRect.left + (c_rRect.right-c_rRect.left)) * texReverseWidth;
|
|
float ev = (c_rRect.top + (c_rRect.bottom-c_rRect.top)) * texReverseHeight;
|
|
|
|
const float x[4] = {m_v2Position.x-0.5f, m_v2Position.x + fimgWidth-0.5f,
|
|
m_v2Position.x-0.5f, m_v2Position.x + fimgWidth-0.5f};
|
|
const float y[4] = {m_v2Position.y-0.5f, m_v2Position.y-0.5f,
|
|
m_v2Position.y + fimgHeight-0.5f, m_v2Position.y + fimgHeight-0.5f};
|
|
UIRenderAddImage(pTexture, x, y, su, sv, eu, ev, UIRenderColor(m_DiffuseColor));
|
|
}
|
|
|
|
auto CGraphicImageInstance::OnSetImagePointer() -> void
|
|
{
|
|
MT_PLATFORM_STUB();
|
|
}
|
|
|
|
auto CGraphicImageInstance::OnIsType(DWORD type) -> BOOL
|
|
{
|
|
return type == Type();
|
|
}
|
|
|
|
auto CGraphicImageInstance::CreateSystem(UINT) -> void
|
|
{
|
|
MT_PLATFORM_STUB();
|
|
}
|
|
|
|
auto CGraphicImageInstance::DestroySystem() -> void
|
|
{
|
|
MT_PLATFORM_STUB();
|
|
}
|
|
|
|
auto CGraphicImageInstance::New() -> CGraphicImageInstance *
|
|
{
|
|
return new CGraphicImageInstance();
|
|
}
|
|
|
|
auto CGraphicImageInstance::Delete(CGraphicImageInstance *instance) -> void
|
|
{
|
|
if (!instance) return;
|
|
instance->Destroy();
|
|
delete instance;
|
|
}
|
|
|
|
decltype(CGraphicImageInstance::ms_kPool) CGraphicImageInstance::ms_kPool{};
|