From 73ecee0c60e075bf5bd02e042af388986bf08a4e Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Fri, 29 Apr 2005 21:19:47 +0000 Subject: [PATCH] Fixed colour calculation. Stopped displaying .svn directories. This was SVN commit r2199. --- .../AtlasUI/ColourTester/ColourTesterFileCtrl.cpp | 10 ++++++++++ .../atlas/AtlasUI/ColourTester/ColourTesterFileCtrl.h | 2 ++ .../AtlasUI/ColourTester/ColourTesterImageCtrl.cpp | 10 +++++----- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/source/tools/atlas/AtlasUI/ColourTester/ColourTesterFileCtrl.cpp b/source/tools/atlas/AtlasUI/ColourTester/ColourTesterFileCtrl.cpp index 48ebfb3ed5..a036430357 100644 --- a/source/tools/atlas/AtlasUI/ColourTester/ColourTesterFileCtrl.cpp +++ b/source/tools/atlas/AtlasUI/ColourTester/ColourTesterFileCtrl.cpp @@ -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; +} diff --git a/source/tools/atlas/AtlasUI/ColourTester/ColourTesterFileCtrl.h b/source/tools/atlas/AtlasUI/ColourTester/ColourTesterFileCtrl.h index c5c128ed01..272e3746dd 100644 --- a/source/tools/atlas/AtlasUI/ColourTester/ColourTesterFileCtrl.h +++ b/source/tools/atlas/AtlasUI/ColourTester/ColourTesterFileCtrl.h @@ -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); diff --git a/source/tools/atlas/AtlasUI/ColourTester/ColourTesterImageCtrl.cpp b/source/tools/atlas/AtlasUI/ColourTester/ColourTesterImageCtrl.cpp index 27f4f478b9..84ac3c5460 100644 --- a/source/tools/atlas/AtlasUI/ColourTester/ColourTesterImageCtrl.cpp +++ b/source/tools/atlas/AtlasUI/ColourTester/ColourTesterImageCtrl.cpp @@ -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);