Author: Carlos Lopez <[email protected]>
Date: Mon Jul 9 20:49:08 2012 +0200
Fix CairoColor::premult_alpha() function.
---
synfig-core/src/synfig/color.h | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/synfig-core/src/synfig/color.h b/synfig-core/src/synfig/color.h
index 98b8ee2..64663d2 100644
--- a/synfig-core/src/synfig/color.h
+++ b/synfig-core/src/synfig/color.h
@@ -580,6 +580,7 @@ private:
public:
static const unsigned char ceil=255;
static const unsigned char floor=0;
+ static const unsigned char range=ceil-floor;
// Operators
public:
@@ -684,14 +685,15 @@ public:
CairoColor premult_alpha() const
{
- return CairoColor (r_*a_, g_*a_, b_*a_, a_);
+ const float a(a_/range);
+ return CairoColor (r_*a, g_*a, b_*a, a_);
}
CairoColor demult_alpha() const
{
if(a_)
{
- const float inva = 1.0f/a_;
+ const float inva = range/a_;
return CairoColor (r_*inva, g_*inva, b_*inva, a_);
}else return alpha();
}
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Synfig-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/synfig-devl