| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -37,45 +37,7 @@ | |||
| 37 | 37 | #include "_backend_agg_basic_types.h" | |
| 38 | 38 | #include "path_converters.h" | |
| 39 | 39 | #include "array.h" | |
| 40 | - | ||
| 41 | - /********************************************************************** | ||
| 42 | - WORKAROUND: This class is to workaround a bug in Agg SVN where the | ||
| 43 | - blending of RGBA32 pixels does not preserve enough precision | ||
| 44 | - */ | ||
| 45 | - | ||
| 46 | - template<class ColorT, class Order> | ||
| 47 | - struct fixed_blender_rgba_plain : agg::conv_rgba_plain<ColorT, Order> | ||
| 48 | - { | ||
| 49 | - typedef ColorT color_type; | ||
| 50 | - typedef Order order_type; | ||
| 51 | - typedef typename color_type::value_type value_type; | ||
| 52 | - typedef typename color_type::calc_type calc_type; | ||
| 53 | - typedef typename color_type::long_type long_type; | ||
| 54 | - enum base_scale_e { base_shift = color_type::base_shift }; | ||
| 55 | - | ||
| 56 | - //-------------------------------------------------------------------- | ||
| 57 | - static AGG_INLINE void blend_pix(value_type* p, | ||
| 58 | - value_type cr, value_type cg, value_type cb, value_type alpha, agg::cover_type cover) | ||
| 59 | - { | ||
| 60 | - blend_pix(p, cr, cg, cb, color_type::mult_cover(alpha, cover)); | ||
| 61 | - } | ||
| 62 | - | ||
| 63 | - //-------------------------------------------------------------------- | ||
| 64 | - static AGG_INLINE void blend_pix(value_type* p, | ||
| 65 | - value_type cr, value_type cg, value_type cb, value_type alpha) | ||
| 66 | - { | ||
| 67 | - if(alpha == 0) return; | ||
| 68 | - calc_type a = p[Order::A]; | ||
| 69 | - calc_type r = p[Order::R] * a; | ||
| 70 | - calc_type g = p[Order::G] * a; | ||
| 71 | - calc_type b = p[Order::B] * a; | ||
| 72 | - a = ((alpha + a) << base_shift) - alpha * a; | ||
| 73 | - p[Order::A] = (value_type)(a >> base_shift); | ||
| 74 | - p[Order::R] = (value_type)((((cr << base_shift) - r) * alpha + (r << base_shift)) / a); | ||
| 75 | - p[Order::G] = (value_type)((((cg << base_shift) - g) * alpha + (g << base_shift)) / a); | ||
| 76 | - p[Order::B] = (value_type)((((cb << base_shift) - b) * alpha + (b << base_shift)) / a); | ||
| 77 | - } | ||
| 78 | - }; | ||
| 40 | + #include "agg_workaround.h" | ||
| 79 | 41 | ||
| 80 | 42 | /**********************************************************************/ | |
| 81 | 43 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,9 +25,12 @@ | |||
| 25 | 25 | ||
| 26 | 26 | #include "_image.h" | |
| 27 | 27 | #include "mplutils.h" | |
| 28 | + #include "agg_workaround.h" | ||
| 28 | 29 | ||
| 29 | - typedef agg::pixfmt_rgba32_plain pixfmt; | ||
| 30 | - typedef agg::pixfmt_rgba32_pre pixfmt_pre; | ||
| 30 | + typedef fixed_blender_rgba_plain<agg::rgba8, agg::order_rgba> fixed_blender_rgba32_plain; | ||
| 31 | + typedef agg::pixfmt_alpha_blend_rgba<fixed_blender_rgba32_plain, agg::rendering_buffer> pixfmt; | ||
| 32 | + typedef fixed_blender_rgba_pre<agg::rgba8, agg::order_rgba> fixed_blender_rgba32_pre; | ||
| 33 | + typedef agg::pixfmt_alpha_blend_rgba<fixed_blender_rgba32_pre, agg::rendering_buffer> pixfmt_pre; | ||
| 31 | 34 | typedef agg::renderer_base<pixfmt> renderer_base; | |
| 32 | 35 | typedef agg::span_interpolator_linear<> interpolator_type; | |
| 33 | 36 | typedef agg::rasterizer_scanline_aa<agg::rasterizer_sl_clip_dbl> rasterizer; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments