mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-10 06:34:01 +00:00
common: promote MULTIPLY() to a common helper macro.
it's useful among the modules.
This commit is contained in:
parent
4482664740
commit
dce14a8449
3 changed files with 7 additions and 6 deletions
|
@ -307,11 +307,6 @@ static inline SwCoord HALF_STROKE(float width)
|
|||
return TO_SWCOORD(width * 0.5f);
|
||||
}
|
||||
|
||||
static inline uint8_t MULTIPLY(uint8_t c, uint8_t a)
|
||||
{
|
||||
return (((c) * (a) + 0xff) >> 8);
|
||||
}
|
||||
|
||||
static inline uint8_t A(uint32_t c)
|
||||
{
|
||||
return ((c) >> 24);
|
||||
|
|
|
@ -245,7 +245,7 @@ RenderData Paint::Impl::update(RenderMethod& renderer, const RenderTransform* pT
|
|||
RenderData rd = nullptr;
|
||||
auto newFlag = static_cast<RenderUpdateFlag>(pFlag | renderFlag);
|
||||
renderFlag = RenderUpdateFlag::None;
|
||||
opacity = ((opacity * this->opacity + 0xff) >> 8); //opacity = (opacity * this->opacity) / 255;
|
||||
opacity = MULTIPLY(opacity, this->opacity);
|
||||
|
||||
if (rTransform && pTransform) {
|
||||
RenderTransform outTransform(pTransform, rTransform);
|
||||
|
|
|
@ -316,6 +316,12 @@ static inline ColorSpace COMPOSITE_TO_COLORSPACE(RenderMethod& renderer, Composi
|
|||
}
|
||||
}
|
||||
|
||||
static inline uint8_t MULTIPLY(uint8_t c, uint8_t a)
|
||||
{
|
||||
return (((c) * (a) + 0xff) >> 8);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
#endif //_TVG_RENDER_H_
|
||||
|
|
Loading…
Add table
Reference in a new issue