Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert SVG bitmap to BGRA unpremultiplied #3829

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Client/mods/deathmatch/logic/CClientVectorGraphicDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ void CClientVectorGraphicDisplay::UpdateTexture()
if (!bitmap.valid())
return;

// convert to BGRA unpremultiplied
bitmap.convert(eColorIndex::B, eColorIndex::G, eColorIndex::R, eColorIndex::A, true);

// Lock surface
D3DLOCKED_RECT LockedRect;
if (SUCCEEDED(surface->LockRect(&LockedRect, nullptr, D3DLOCK_DISCARD)))
Expand Down
9 changes: 9 additions & 0 deletions Client/mods/deathmatch/logic/CClientVectorGraphicDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ class CClientVectorGraphicDisplay final : public CClientDisplay

void Update();

// Color indexes as per lunasvg::Bitmap
static enum eColorIndex : int
{
R = 0,
G = 1,
B = 2,
A = 3
};
Comment on lines +38 to +44
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

static has no effect here.
Enum may be private
Values can be be assigned by default here. You don't need all these = 0, = 1...
It declares R, G, B, A as valid values in CClientVectorGraphicDisplay methods. It's not critical, but bad


private:
CClientVectorGraphic* m_pVectorGraphic;

Expand Down
Loading