Skip to content

Fix the clippath renderering so that it uses no-clip unsigned chars #1846

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

Merged
merged 2 commits into from
Mar 25, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified lib/matplotlib/tests/baseline_images/test_axes/polar_axes.pdf
Binary file not shown.
Binary file modified lib/matplotlib/tests/baseline_images/test_axes/polar_axes.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 37 additions & 32 deletions lib/matplotlib/tests/baseline_images/test_axes/polar_axes.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions lib/matplotlib/tests/test_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def test_polar_annotations():
fig = plt.figure()
ax = fig.add_subplot( 111, polar=True )
line, = ax.plot( theta, r, color='#ee8d18', lw=3 )
line, = ax.plot( (0, 0), (0, 1), color="#0000ff", lw=1)

ind = 800
thisr, thistheta = r[ind], theta[ind]
Expand Down
17 changes: 8 additions & 9 deletions src/_backend_agg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,9 +422,8 @@ RendererAgg::create_alpha_buffers()
{
if (!alphaBuffer)
{
unsigned stride(width*4);
alphaBuffer = new agg::int8u[NUMBYTES];
alphaMaskRenderingBuffer.attach(alphaBuffer, width, height, stride);
alphaBuffer = new agg::int8u[width * height];
alphaMaskRenderingBuffer.attach(alphaBuffer, width, height, width);
rendererBaseAlphaMask.attach(pixfmtAlphaMask);
rendererAlphaMask.attach(rendererBaseAlphaMask);
}
Expand Down Expand Up @@ -1120,7 +1119,7 @@ RendererAgg::draw_image(const Py::Tuple& args)
renderer_type_alpha ri(r, sa, spans);

theRasterizer.add_path(rect2);
agg::render_scanlines(theRasterizer, slineP8, ri);
agg::render_scanlines(theRasterizer, scanlineAlphaMask, ri);
}
else
{
Expand Down Expand Up @@ -1178,7 +1177,7 @@ void RendererAgg::_draw_path(path_t& path, bool has_clippath,
amask_ren_type r(pfa);
amask_aa_renderer_type ren(r);
ren.color(face.second);
agg::render_scanlines(theRasterizer, slineP8, ren);
agg::render_scanlines(theRasterizer, scanlineAlphaMask, ren);
}
else
{
Expand All @@ -1194,7 +1193,7 @@ void RendererAgg::_draw_path(path_t& path, bool has_clippath,
amask_ren_type r(pfa);
amask_bin_renderer_type ren(r);
ren.color(face.second);
agg::render_scanlines(theRasterizer, slineP8, ren);
agg::render_scanlines(theRasterizer, scanlineAlphaMask, ren);
}
else
{
Expand Down Expand Up @@ -1304,7 +1303,7 @@ void RendererAgg::_draw_path(path_t& path, bool has_clippath,
amask_ren_type r(pfa);
amask_aa_renderer_type ren(r);
ren.color(gc.color);
agg::render_scanlines(theRasterizer, slineP8, ren);
agg::render_scanlines(theRasterizer, scanlineAlphaMask, ren);
}
else
{
Expand All @@ -1320,7 +1319,7 @@ void RendererAgg::_draw_path(path_t& path, bool has_clippath,
amask_ren_type r(pfa);
amask_bin_renderer_type ren(r);
ren.color(gc.color);
agg::render_scanlines(theRasterizer, slineP8, ren);
agg::render_scanlines(theRasterizer, scanlineAlphaMask, ren);
}
else
{
Expand Down Expand Up @@ -1902,7 +1901,7 @@ RendererAgg::_draw_gouraud_triangle(const double* points,
pixfmt_amask_type pfa(pixFmt, alphaMask);
amask_ren_type r(pfa);
amask_aa_renderer_type ren(r, span_alloc, span_gen);
agg::render_scanlines(theRasterizer, slineP8, ren);
agg::render_scanlines(theRasterizer, scanlineAlphaMask, ren);
}
else
{
Expand Down
3 changes: 2 additions & 1 deletion src/_backend_agg.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ typedef agg::rasterizer_scanline_aa<agg::rasterizer_sl_clip_dbl> rasterizer;
typedef agg::scanline_p8 scanline_p8;
typedef agg::scanline_bin scanline_bin;
typedef agg::amask_no_clip_gray8 alpha_mask_type;
typedef agg::scanline_u8_am<alpha_mask_type> scanline_am;

typedef agg::renderer_base<agg::pixfmt_gray8> renderer_base_alpha_mask_type;
typedef agg::renderer_scanline_aa_solid<renderer_base_alpha_mask_type> renderer_alpha_mask_type;
Expand Down Expand Up @@ -215,7 +216,7 @@ class RendererAgg: public Py::PythonExtension<RendererAgg>
agg::pixfmt_gray8 pixfmtAlphaMask;
renderer_base_alpha_mask_type rendererBaseAlphaMask;
renderer_alpha_mask_type rendererAlphaMask;
agg::scanline_p8 scanlineAlphaMask;
scanline_am scanlineAlphaMask;

scanline_p8 slineP8;
scanline_bin slineBin;
Expand Down