mirror of
https://github.com/ONLYOFFICE/core.git
synced 2026-02-10 18:05:41 +08:00
Merge branch 'feature/svg_pull' into feature/svg
This commit is contained in:
@ -170,6 +170,64 @@ namespace agg
|
||||
}
|
||||
};
|
||||
|
||||
//=============================================================blender_rgba_src_over
|
||||
template<class ColorT, class Order> struct blender_rgba_unpre
|
||||
{
|
||||
typedef ColorT color_type;
|
||||
typedef Order order_type;
|
||||
typedef typename color_type::value_type value_type;
|
||||
typedef typename color_type::calc_type calc_type;
|
||||
enum base_scale_e
|
||||
{
|
||||
base_shift = color_type::base_shift,
|
||||
base_mask = color_type::base_mask
|
||||
};
|
||||
|
||||
//--------------------------------------------------------------------
|
||||
static AGG_INLINE void blend_pix(value_type* p,
|
||||
unsigned cr, unsigned cg, unsigned cb,
|
||||
unsigned alpha,
|
||||
unsigned cover=0)
|
||||
{
|
||||
if (0 == alpha)
|
||||
return;
|
||||
|
||||
calc_type r = p[Order::R];
|
||||
calc_type g = p[Order::G];
|
||||
calc_type b = p[Order::B];
|
||||
calc_type a = p[Order::A];
|
||||
|
||||
if (a == base_mask)
|
||||
{
|
||||
p[Order::R] = (value_type)(((cr - r) * alpha + (r << base_shift)) >> base_shift);
|
||||
p[Order::G] = (value_type)(((cg - g) * alpha + (g << base_shift)) >> base_shift);
|
||||
p[Order::B] = (value_type)(((cb - b) * alpha + (b << base_shift)) >> base_shift);
|
||||
p[Order::A] = (value_type)((alpha + a) - ((alpha * a + base_mask) >> base_shift));
|
||||
return;
|
||||
}
|
||||
|
||||
p[Order::A] = (value_type)((alpha + a) - ((alpha * a + base_mask) >> base_shift));
|
||||
p[Order::R] = (value_type)((alpha * cr + a * r - ((a * r * alpha + base_mask) >> base_shift)) / p[Order::A]);
|
||||
p[Order::G] = (value_type)((alpha * cg + a * g - ((a * g * alpha + base_mask) >> base_shift)) / p[Order::A]);
|
||||
p[Order::B] = (value_type)((alpha * cb + a * b - ((a * b * alpha + base_mask) >> base_shift)) / p[Order::A]);
|
||||
}
|
||||
|
||||
static AGG_INLINE void blend_pix_subpix(value_type* p,
|
||||
unsigned cr, unsigned cg, unsigned cb,
|
||||
unsigned* covers,
|
||||
unsigned cover=0)
|
||||
{
|
||||
calc_type r = p[Order::R];
|
||||
calc_type g = p[Order::G];
|
||||
calc_type b = p[Order::B];
|
||||
//calc_type a = p[Order::A];
|
||||
p[Order::R] = (value_type)(((cr - r) * covers[Order::R] + (r << base_shift)) >> base_shift);
|
||||
p[Order::G] = (value_type)(((cg - g) * covers[Order::G] + (g << base_shift)) >> base_shift);
|
||||
p[Order::B] = (value_type)(((cb - b) * covers[Order::B] + (b << base_shift)) >> base_shift);
|
||||
//p[Order::A] = (value_type)((alpha + a) - ((alpha * a + base_mask) >> base_shift));
|
||||
}
|
||||
};
|
||||
|
||||
//=========================================================blender_rgba_pre
|
||||
template<class ColorT, class Order> struct blender_rgba_pre
|
||||
{
|
||||
|
||||
@ -226,7 +226,6 @@ namespace agg
|
||||
double _y = y;
|
||||
m_trans.transform(&_x, &_y);
|
||||
double t = calculate_param(_x, _y);
|
||||
int a = 0;
|
||||
int index = int( t * MaxColorIndex + 0.5 );
|
||||
if( !m_valid_table[index] )
|
||||
CalcColor( index );
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -11,10 +11,11 @@ namespace agg
|
||||
namespace svg
|
||||
{
|
||||
//---------------------------------------------------------------------------
|
||||
template<class Blender=agg::blender_rgba<color_type, component_order>>
|
||||
class frame_buffer_rgba
|
||||
{
|
||||
public:
|
||||
typedef agg::blender_rgba<color_type, component_order> blender_type;
|
||||
typedef Blender blender_type;
|
||||
typedef agg::pixfmt_alpha_blend_rgba<blender_type, agg::rendering_buffer, pixel_type> pixfmt_type;
|
||||
typedef agg::renderer_base<pixfmt_type> renderer_base_type;
|
||||
typedef agg::renderer_scanline_aa_solid<renderer_base_type> renderer_solid_type;
|
||||
|
||||
Reference in New Issue
Block a user