Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quartz improvements #9

Merged
merged 7 commits into from
Dec 6, 2013
Merged

Quartz improvements #9

merged 7 commits into from
Dec 6, 2013

Conversation

pixelglow
Copy link
Contributor

This pull request bundles together a number of improvements to the Quartz (Mac OS X and iOS) renderer.

  • More bitmaps formats for both Mac OS X and iOS.
  • Text layout is more consistent with pango layout, and adapts better to fonts with strange dimensions e.g. Zapfino.
  • Text rendering on modern iOS now uses CoreText, just like Mac OS X.
  • Support for multicolored fonts such as emoji.
  • General code quality improvements.

* Function is safer: non-existent format won't crash

* Function is better encapsulated: strings not exposed in header
* Text attribute takes foreground color from context and allows one call to draw entire line, rather than having to draw each glyph run.

* We can now draw multicolored fonts such as emoji.
* Move iOS flip context code from quartzgen_textpara to -[GVTextLayout drawInContext:], since this is specific to GVTextLayout and not iOS rendering. This will eventually allow iOS and Mac OS X to share the same CoreText-based rendering.
* On iOS, temp scratch files were memory mapped for all bitmap formats but only cleaned up for FORMAT_CGIMAGE. This fixes that and cleans up the surrounding code flow.

* Don't use job external context to determine whether to render FORMAT_CGIMAGE. The format + job context is sufficient for rendition.

* This also fixes export PDF warnings: bitmap context functions had been called on PDF context.
* quartz_size_layout now respects font leading, even if it is zero

* quartz_textlayout now correctly sets yoffset_centerline, consistent with pango layout
* Support was already present on Mac OS X, so we only need to judiciously re-enable for iOS.

* iOS 2.0 and later now uses Image I/O for more bitmap formats.

* iOS 3.2 or later now uses CoreText for better text layout and rendering.
ellson added a commit that referenced this pull request Dec 6, 2013
@ellson ellson merged commit 007c5d8 into ellson:master Dec 6, 2013
@ellson
Copy link
Owner

ellson commented Dec 6, 2013

Glen,

I have merged your patch requests #4...#9. Thank you very much.
These should be in tonight's build.

I couldn't find any requests #1, #2, #3 ? Did I lose them?

John

@pixelglow
Copy link
Contributor Author

@ellson, github numbers issues sequentially and pull requests are then a subset of the issues. So #1, #2, #3 are issues, not pull requests.

@pixelglow pixelglow deleted the improve_quartz branch December 9, 2013 01:38
pipcet pushed a commit to pipcet/graphviz that referenced this pull request Jan 18, 2021
Address Sanitizer detected a few instances of the following:

  Direct leak of 168 byte(s) in 7 object(s) allocated from:
    #0 0x7f4bc2724330 in __interceptor_malloc (/lib/x86_64-linux-gnu/libasan.so.5+0xe9330)
    ellson#1 0x7f4bc24b1ea3 in vec_new /tmp/tmp.m68Z0dFAYs/graphviz/lib/common/routespl.c:918
    ellson#2 0x7f4bc24b291a in find_all_cycles /tmp/tmp.m68Z0dFAYs/graphviz/lib/common/routespl.c:1073
    ellson#3 0x7f4bc24b2b64 in get_cycle_centroid /tmp/tmp.m68Z0dFAYs/graphviz/lib/common/routespl.c:1121
    ellson#4 0x7f4bc24b3c5c in makeStraightEdges /tmp/tmp.m68Z0dFAYs/graphviz/lib/common/routespl.c:1233
    ellson#5 0x7f4bc24b35f8 in makeStraightEdge /tmp/tmp.m68Z0dFAYs/graphviz/lib/common/routespl.c:1203
    ellson#6 0x7f4bbdf28b52 in _spline_edges /tmp/tmp.m68Z0dFAYs/graphviz/lib/neatogen/neatosplines.c:659
    ellson#7 0x7f4bbdf29240 in splineEdges /tmp/tmp.m68Z0dFAYs/graphviz/lib/neatogen/neatosplines.c:736
    ellson#8 0x7f4bbdf29310 in spline_edges1 /tmp/tmp.m68Z0dFAYs/graphviz/lib/neatogen/neatosplines.c:749
    ellson#9 0x7f4bbdf293be in spline_edges0 /tmp/tmp.m68Z0dFAYs/graphviz/lib/neatogen/neatosplines.c:779
    ellson#10 0x7f4bbdf29bcb in spline_edges /tmp/tmp.m68Z0dFAYs/graphviz/lib/neatogen/neatosplines.c:817
    ellson#11 0x7f4bbdf14ea6 in neato_layout /tmp/tmp.m68Z0dFAYs/graphviz/lib/neatogen/neatoinit.c:1489
    ellson#12 0x7f4bc242b6fc in gvLayoutJobs /tmp/tmp.m68Z0dFAYs/graphviz/lib/gvc/gvlayout.c:85
    ellson#13 0x559fcd474960 in main /tmp/tmp.m68Z0dFAYs/graphviz/cmd/dot/dot.c:132
    ellson#14 0x7f4bc21d709a in __libc_start_main ../csu/libc-start.c:308

find_all_cycles() was calling vec_delete() on the temporary vector it allocated,
but it did not take into account that the nested vectors were not freed by
vec_delete(). This change moves the open coded clean up logic from
get_cycle_centroid() into vec_delete() to fix this and make it less likely that
this is missed in future.

This was initially encountered while investigating #1554.
pipcet pushed a commit to pipcet/graphviz that referenced this pull request Jan 25, 2021
make_label() internally strdups its input, so this extra allocation was simply
being lost. This was observable using an ASan-instrumented build and the command
`dot -Tsvg -o /dev/null ./rtest/share/alf.gv`:

  Direct leak of 121 byte(s) in 12 object(s) allocated from:
    #0 0x7fd2541bf810 in strdup (/lib/x86_64-linux-gnu/libasan.so.5+0x3a810)
    ellson#1 0x7fd25404a955 in parse_reclbl /tmp/tmp.bXYbsH93VJ/graphviz/lib/common/shapes.c:3314
    ellson#2 0x7fd25404a5eb in parse_reclbl /tmp/tmp.bXYbsH93VJ/graphviz/lib/common/shapes.c:3292
    ellson#3 0x7fd25404ca5f in record_init /tmp/tmp.bXYbsH93VJ/graphviz/lib/common/shapes.c:3556
    ellson#4 0x7fd25405966a in common_init_node /tmp/tmp.bXYbsH93VJ/graphviz/lib/common/utils.c:658
    ellson#5 0x7fd24fc78a01 in dot_init_node /tmp/tmp.bXYbsH93VJ/graphviz/lib/dotgen/dotinit.c:40
    ellson#6 0x7fd24fc79522 in dot_init_node_edge /tmp/tmp.bXYbsH93VJ/graphviz/lib/dotgen/dotinit.c:81
    ellson#7 0x7fd24fc7ad61 in dotLayout /tmp/tmp.bXYbsH93VJ/graphviz/lib/dotgen/dotinit.c:295
    ellson#8 0x7fd24fc7c4b9 in doDot /tmp/tmp.bXYbsH93VJ/graphviz/lib/dotgen/dotinit.c:450
    ellson#9 0x7fd24fc7ca94 in dot_layout /tmp/tmp.bXYbsH93VJ/graphviz/lib/dotgen/dotinit.c:496
    ellson#10 0x7fd253f7673d in gvLayoutJobs /tmp/tmp.bXYbsH93VJ/graphviz/lib/gvc/gvlayout.c:85
    ellson#11 0x55a9961b3960 in main /tmp/tmp.bXYbsH93VJ/graphviz/cmd/dot/dot.c:132
    ellson#12 0x7fd253d2309a in __libc_start_main ../csu/libc-start.c:308

  Direct leak of 118 byte(s) in 19 object(s) allocated from:
    #0 0x7fd2541bf810 in strdup (/lib/x86_64-linux-gnu/libasan.so.5+0x3a810)
    ellson#1 0x7fd25404a955 in parse_reclbl /tmp/tmp.bXYbsH93VJ/graphviz/lib/common/shapes.c:3314
    ellson#2 0x7fd25404ca5f in record_init /tmp/tmp.bXYbsH93VJ/graphviz/lib/common/shapes.c:3556
    ellson#3 0x7fd25405966a in common_init_node /tmp/tmp.bXYbsH93VJ/graphviz/lib/common/utils.c:658
    ellson#4 0x7fd24fc78a01 in dot_init_node /tmp/tmp.bXYbsH93VJ/graphviz/lib/dotgen/dotinit.c:40
    ellson#5 0x7fd24fc79522 in dot_init_node_edge /tmp/tmp.bXYbsH93VJ/graphviz/lib/dotgen/dotinit.c:81
    ellson#6 0x7fd24fc7ad61 in dotLayout /tmp/tmp.bXYbsH93VJ/graphviz/lib/dotgen/dotinit.c:295
    ellson#7 0x7fd24fc7c4b9 in doDot /tmp/tmp.bXYbsH93VJ/graphviz/lib/dotgen/dotinit.c:450
    ellson#8 0x7fd24fc7ca94 in dot_layout /tmp/tmp.bXYbsH93VJ/graphviz/lib/dotgen/dotinit.c:496
    ellson#9 0x7fd253f7673d in gvLayoutJobs /tmp/tmp.bXYbsH93VJ/graphviz/lib/gvc/gvlayout.c:85
    ellson#10 0x55a9961b3960 in main /tmp/tmp.bXYbsH93VJ/graphviz/cmd/dot/dot.c:132
    ellson#11 0x7fd253d2309a in __libc_start_main ../csu/libc-start.c:308
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants