diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/internal/pdf.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/extension/internal/pdf.cpp b/src/extension/internal/pdf.cpp index 50e98d00c..bd65cd318 100644 --- a/src/extension/internal/pdf.cpp +++ b/src/extension/internal/pdf.cpp @@ -685,6 +685,13 @@ PrintPDF::print_fill_alpha(SVGOStringStream &os, SPStyle const *const style, NRR NR::Point c (rg->cx.computed, rg->cy.computed);
NR::Point f (rg->fx.computed, rg->fy.computed);
double r = rg->r.computed;
+
+ NR::Coord const df = hypot(f[NR::X] - c[NR::X], f[NR::Y] - c[NR::Y]);
+ if (df >= r) {
+ f[NR::X] = c[NR::X] + (f[NR::X] - c[NR::X] ) * r / (float) df;
+ f[NR::Y] = c[NR::Y] + (f[NR::Y] - c[NR::Y] ) * r / (float) df;
+ }
+
if (pbox && SP_GRADIENT(rg)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
// convert to userspace
NR::Matrix bbox2user(pbox->x1 - pbox->x0, 0, 0, pbox->y1 - pbox->y0, pbox->x0, pbox->y0);
@@ -877,6 +884,13 @@ PrintPDF::print_fill_style(SVGOStringStream &os, SPStyle const *const style, NRR NR::Point c (rg->cx.computed, rg->cy.computed);
NR::Point f (rg->fx.computed, rg->fy.computed);
double r = rg->r.computed;
+
+ NR::Coord const df = hypot(f[NR::X] - c[NR::X], f[NR::Y] - c[NR::Y]);
+ if (df >= r) {
+ f[NR::X] = c[NR::X] + (f[NR::X] - c[NR::X] ) * r / (float) df;
+ f[NR::Y] = c[NR::Y] + (f[NR::Y] - c[NR::Y] ) * r / (float) df;
+ }
+
if (pbox && SP_GRADIENT(rg)->units == SP_GRADIENT_UNITS_OBJECTBOUNDINGBOX) {
// convert to userspace
NR::Matrix bbox2user(pbox->x1 - pbox->x0, 0, 0, pbox->y1 - pbox->y0, pbox->x0, pbox->y0);
|
