jascam / AnotherMigrateTest

0 stars 0 forks source link

GDI Null reference exception when GetBBox called on Text element #51

Open jascam opened 7 years ago

jascam commented 7 years ago

In the GdiGraohicsRender this code; private SvgRectF GetElementBounds(SvgTransformableElement element, float margin) { SvgRenderingHint hint = element.RenderingHint; if (hint == SvgRenderingHint.Shape || hint == SvgRenderingHint.Text) { GraphicsPath gp = GdiRendering.CreatePath(element); ISvgMatrix svgMatrix = element.GetScreenCTM();

            Matrix matrix = new Matrix((float)svgMatrix.A, (float)svgMatrix.B, (float)svgMatrix.C,
                  (float)svgMatrix.D, (float)svgMatrix.E, (float)svgMatrix.F);
            SvgRectF bounds = SvgConverter.ToRect(gp.GetBounds(matrix));
            bounds = SvgRectF.Inflate(bounds, margin, margin);

            return bounds;
        }

is called when GetBBox is called on a Text element. GdiRendering.CreatePath returns null for a text element which then means the gp.GetBounds(matrix) blows up with a null reference exception.

This work item was migrated from CodePlex

CodePlex work item ID: '1751' Vote count: '1'