Purge unneccessary recursion detection.
authorTor Andersson <[email protected]>
Thu, 14 Apr 2022 19:33:05 +0000 (21:33 +0200)
committerTor Andersson <[email protected]>
Fri, 29 Apr 2022 10:25:05 +0000 (12:25 +0200)
It should be detected long before we arrive here.

source/fitz/font.c

index e228a4d9481f63c06ae39c3a9ea3a4ccff5ff68d..28c0330023516f6788b71b1c7c80c41f5ab70328 100644 (file)
@@ -1475,14 +1475,9 @@ fz_bound_t3_glyph(fz_context *ctx, fz_font *font, int gid)
 void
 fz_prepare_t3_glyph(fz_context *ctx, fz_font *font, int gid)
 {
-       fz_buffer *contents;
        fz_device *dev;
        fz_rect d1_rect;
 
-       contents = font->t3procs[gid];
-       if (!contents)
-               return;
-
        /* We've not already loaded this one! */
        assert(font->t3lists[gid] == NULL);
 
@@ -1498,14 +1493,9 @@ fz_prepare_t3_glyph(fz_context *ctx, fz_font *font, int gid)
                        FZ_DEVFLAG_MITERLIMIT_UNDEFINED |
                        FZ_DEVFLAG_LINEWIDTH_UNDEFINED;
 
-       /* Avoid cycles in glyph content streams referring to the glyph itself.
-        * Remember to restore the content stream below, regardless of exceptions
-        * or a successful run of the glyph. */
-       font->t3procs[gid] = NULL;
-
        fz_try(ctx)
        {
-               font->t3run(ctx, font->t3doc, font->t3resources, contents, dev, fz_identity, NULL, NULL);
+               font->t3run(ctx, font->t3doc, font->t3resources, font->t3procs[gid], dev, fz_identity, NULL, NULL);
                fz_close_device(ctx, dev);
                font->t3flags[gid] = dev->flags;
                d1_rect = dev->d1_rect;
@@ -1513,7 +1503,6 @@ fz_prepare_t3_glyph(fz_context *ctx, fz_font *font, int gid)
        fz_always(ctx)
        {
                fz_drop_device(ctx, dev);
-               font->t3procs[gid] = contents;
        }
        fz_catch(ctx)
                fz_rethrow(ctx);
@@ -1652,15 +1641,10 @@ void
 fz_render_t3_glyph_direct(fz_context *ctx, fz_device *dev, fz_font *font, int gid, fz_matrix trm, void *gstate, fz_default_colorspaces *def_cs)
 {
        fz_matrix ctm;
-       void *contents;
 
        if (gid < 0 || gid > 255)
                return;
 
-       contents = font->t3procs[gid];
-       if (!contents)
-               return;
-
        if (font->t3flags[gid] & FZ_DEVFLAG_MASK)
        {
                if (font->t3flags[gid] & FZ_DEVFLAG_COLOR)
@@ -1671,20 +1655,8 @@ fz_render_t3_glyph_direct(fz_context *ctx, fz_device *dev, fz_font *font, int gi
                fz_warn(ctx, "type3 glyph doesn't specify masked or colored");
        }
 
-       /* Avoid cycles in glyph content streams referring to the glyph itself.
-        * Remember to restore the content stream below, regardless of exceptions
-        * or a successful run of the glyph. */
-       font->t3procs[gid] = NULL;
-
-       fz_try(ctx)
-       {
-               ctm = fz_concat(font->t3matrix, trm);
-               font->t3run(ctx, font->t3doc, font->t3resources, contents, dev, ctm, gstate, def_cs);
-       }
-       fz_always(ctx)
-               font->t3procs[gid] = contents;
-       fz_catch(ctx)
-               fz_rethrow(ctx);
+       ctm = fz_concat(font->t3matrix, trm);
+       font->t3run(ctx, font->t3doc, font->t3resources, font->t3procs[gid], dev, ctm, gstate, def_cs);
 }
 
 fz_rect