mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-07-12 12:33:40 +00:00
Fixed colour calculation. Stopped displaying .svn directories.
This was SVN commit r2199.
This commit is contained in:
@@ -26,3 +26,13 @@ void ColourTesterFileCtrl::OnSelChanged(wxTreeEvent& event)
|
||||
m_ImageCtrl->SetImageFile(GetFullPath(event.GetItem()));
|
||||
}
|
||||
}
|
||||
|
||||
bool ColourTesterFileCtrl::OnAddDirectory(VdtcTreeItemBase &item, const wxFileName &WXUNUSED(name))
|
||||
{
|
||||
// Ignore .svn directories
|
||||
if (item.GetName() == _T(".svn"))
|
||||
return false;
|
||||
|
||||
// Accept everything else
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ class ColourTesterFileCtrl : public wxVirtualDirTreeCtrl
|
||||
public:
|
||||
ColourTesterFileCtrl(wxWindow* parent, const wxSize& size, ColourTesterImageCtrl* imgctrl);
|
||||
|
||||
virtual bool OnAddDirectory(VdtcTreeItemBase &item, const wxFileName &name);
|
||||
|
||||
private:
|
||||
void OnSelChanged(wxTreeEvent& event);
|
||||
|
||||
|
||||
@@ -96,12 +96,12 @@ void ColourTesterImageCtrl::CalculateImage()
|
||||
p0 < data+info.Width*info.Height*4;
|
||||
p0 += 4, p1 += 3)
|
||||
{
|
||||
// Interpolate between texture and colour, so
|
||||
// new = old*alpha + colour*(1-alpha)
|
||||
// Interpolate between texture and texture*colour, so
|
||||
// new = old*alpha + old*colour*(1-alpha)
|
||||
float alpha = p0[3]/255.f;
|
||||
p1[0] = p0[0] * alpha + m_Colour[0]*(1.f-alpha);
|
||||
p1[1] = p0[1] * alpha + m_Colour[1]*(1.f-alpha);
|
||||
p1[2] = p0[2] * alpha + m_Colour[2]*(1.f-alpha);
|
||||
p1[0] = p0[0]*alpha + p0[0]*m_Colour[0]*(1.f-alpha)/255.f;
|
||||
p1[1] = p0[1]*alpha + p0[1]*m_Colour[1]*(1.f-alpha)/255.f;
|
||||
p1[2] = p0[2]*alpha + p0[2]*m_Colour[2]*(1.f-alpha)/255.f;
|
||||
}
|
||||
|
||||
m_FinalImage.SetData(newData, info.Width, info.Height);
|
||||
|
||||
Reference in New Issue
Block a user