diff options
| author | Jasper van de Gronde <jasper.vandegronde@gmail.com> | 2012-12-06 20:01:07 +0000 |
|---|---|---|
| committer | Jasper van de Gronde <th.v.d.gronde@hccnet.nl> | 2012-12-06 20:01:07 +0000 |
| commit | 2454948ceada44bb6e90d1470d04e0b01695ca99 (patch) | |
| tree | 08746860a77118459069550c6057becfc9b659c0 /src | |
| parent | Check that server is gradient before calling getVector(). (diff) | |
| download | inkscape-2454948ceada44bb6e90d1470d04e0b01695ca99.tar.gz inkscape-2454948ceada44bb6e90d1470d04e0b01695ca99.zip | |
Fix for bug #790192, the unclipped alpha component was used for clipping the colour components.
(bzr r11935)
Diffstat (limited to 'src')
| -rw-r--r-- | src/display/nr-filter-gaussian.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/display/nr-filter-gaussian.cpp b/src/display/nr-filter-gaussian.cpp index 390021712..6ef321992 100644 --- a/src/display/nr-filter-gaussian.cpp +++ b/src/display/nr-filter-gaussian.cpp @@ -102,15 +102,16 @@ static inline Tt clip_round_cast(Ts const v) { Ts const minval = std::numeric_limits<Tt>::min(); Ts const maxval = std::numeric_limits<Tt>::max(); Tt const minval_rounded = std::numeric_limits<Tt>::min(); - Ts const maxval_rounded = std::numeric_limits<Tt>::max(); + Tt const maxval_rounded = std::numeric_limits<Tt>::max(); if ( v < minval ) return minval_rounded; if ( v > maxval ) return maxval_rounded; return round_cast<Tt>(v); } template<typename Tt, typename Ts> -static inline Tt clip_round_cast_varmax(Ts const v, Ts const maxval, Tt const maxval_rounded) { +static inline Tt clip_round_cast_varmax(Ts const v, Tt const maxval_rounded) { Ts const minval = std::numeric_limits<Tt>::min(); + Tt const maxval = maxval_rounded; Tt const minval_rounded = std::numeric_limits<Tt>::min(); if ( v < minval ) return minval_rounded; if ( v > maxval ) return maxval_rounded; @@ -339,7 +340,7 @@ filter2D_IIR(PT *const dest, int const dstr1, int const dstr2, dstimg -= dstr1; if ( PREMULTIPLIED_ALPHA ) { dstimg[alpha_PC] = clip_round_cast<PT>(v[0][alpha_PC]); - PREMUL_ALPHA_LOOP dstimg[c] = clip_round_cast_varmax<PT>(v[0][c], v[0][alpha_PC], dstimg[alpha_PC]); + PREMUL_ALPHA_LOOP dstimg[c] = clip_round_cast_varmax<PT>(v[0][c], dstimg[alpha_PC]); } else { for(unsigned int c=0; c<PC; c++) dstimg[c] = clip_round_cast<PT>(v[0][c]); } @@ -354,7 +355,7 @@ filter2D_IIR(PT *const dest, int const dstr1, int const dstr2, dstimg -= dstr1; if ( PREMULTIPLIED_ALPHA ) { dstimg[alpha_PC] = clip_round_cast<PT>(v[0][alpha_PC]); - PREMUL_ALPHA_LOOP dstimg[c] = clip_round_cast_varmax<PT>(v[0][c], v[0][alpha_PC], dstimg[alpha_PC]); + PREMUL_ALPHA_LOOP dstimg[c] = clip_round_cast_varmax<PT>(v[0][c], dstimg[alpha_PC]); } else { for(unsigned int c=0; c<PC; c++) dstimg[c] = clip_round_cast<PT>(v[0][c]); } |
