|
From: <md...@us...> - 2010-06-24 17:59:55
|
Revision: 8464
http://matplotlib.svn.sourceforge.net/matplotlib/?rev=8464&view=rev
Author: mdboom
Date: 2010-06-24 17:59:48 +0000 (Thu, 24 Jun 2010)
Log Message:
-----------
Speed up Gouraud shading in Agg backend.
Modified Paths:
--------------
trunk/matplotlib/src/_backend_agg.cpp
trunk/matplotlib/src/_backend_agg.h
Modified: trunk/matplotlib/src/_backend_agg.cpp
===================================================================
--- trunk/matplotlib/src/_backend_agg.cpp 2010-06-24 17:12:26 UTC (rev 8463)
+++ trunk/matplotlib/src/_backend_agg.cpp 2010-06-24 17:59:48 UTC (rev 8464)
@@ -1824,19 +1824,15 @@
}
void
-RendererAgg::_draw_gouraud_triangle(const GCAgg& gc, const double* points,
+RendererAgg::_draw_gouraud_triangle(const double* points,
const double* colors,
- agg::trans_affine trans)
+ agg::trans_affine trans,
+ bool has_clippath)
{
typedef agg::rgba8 color_t;
typedef agg::span_gouraud_rgba<color_t> span_gen_t;
typedef agg::span_allocator<color_t> span_alloc_t;
- theRasterizer.reset_clipping();
- rendererBase.reset_clipping(true);
- set_clipbox(gc.cliprect, theRasterizer);
- bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
-
trans *= agg::trans_affine_scaling(1.0, -1.0);
trans *= agg::trans_affine_translation(0.0, (double)height);
@@ -1897,6 +1893,11 @@
PyArrayObject* points = NULL;
PyArrayObject* colors = NULL;
+ theRasterizer.reset_clipping();
+ rendererBase.reset_clipping(true);
+ set_clipbox(gc.cliprect, theRasterizer);
+ bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
+
try
{
points = (PyArrayObject*)PyArray_ContiguousFromAny
@@ -1916,7 +1917,8 @@
}
_draw_gouraud_triangle(
- gc, (double*)PyArray_DATA(points), (double*)PyArray_DATA(colors), trans);
+ (double*)PyArray_DATA(points), (double*)PyArray_DATA(colors),
+ trans, has_clippath);
}
catch (...)
{
@@ -1951,6 +1953,11 @@
PyArrayObject* points = NULL;
PyArrayObject* colors = NULL;
+ theRasterizer.reset_clipping();
+ rendererBase.reset_clipping(true);
+ set_clipbox(gc.cliprect, theRasterizer);
+ bool has_clippath = render_clippath(gc.clippath, gc.clippath_trans);
+
try
{
points = (PyArrayObject*)PyArray_ContiguousFromAny
@@ -1976,7 +1983,9 @@
for (int i = 0; i < PyArray_DIM(points, 0); ++i)
{
- _draw_gouraud_triangle(gc, (double*)PyArray_GETPTR1(points, i), (double*)PyArray_GETPTR1(colors, i), trans);
+ _draw_gouraud_triangle(
+ (double*)PyArray_GETPTR1(points, i),
+ (double*)PyArray_GETPTR1(colors, i), trans, has_clippath);
}
}
catch (...)
Modified: trunk/matplotlib/src/_backend_agg.h
===================================================================
--- trunk/matplotlib/src/_backend_agg.h 2010-06-24 17:12:26 UTC (rev 8463)
+++ trunk/matplotlib/src/_backend_agg.h 2010-06-24 17:59:48 UTC (rev 8464)
@@ -263,8 +263,8 @@
void
_draw_gouraud_triangle(
- const GCAgg& gc,
- const double* points, const double* colors, agg::trans_affine trans);
+ const double* points, const double* colors,
+ agg::trans_affine trans, bool has_clippath);
private:
void create_alpha_buffers();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|