Skip to content

Commit 3020d13

Browse files
committed
added class variable _fill_color to RendererAgg to hold the
color to use in `clear` calls to the render_base. Changed all uses of `clear((...))` -> `clear(_fil_color)`.
1 parent b3fc5ff commit 3020d13

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/_backend_agg.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ RendererAgg::RendererAgg(unsigned int width, unsigned int height, double dpi,
430430
renderingBuffer.attach(pixBuffer, width, height, stride);
431431
pixFmt.attach(renderingBuffer);
432432
rendererBase.attach(pixFmt);
433-
rendererBase.clear(agg::rgba(1, 1, 1, 0));
433+
rendererBase.clear(_fill_color);
434434
rendererAA.attach(rendererBase);
435435
rendererBin.attach(rendererBase);
436436
hatchRenderingBuffer.attach(hatchBuffer, HATCH_SIZE, HATCH_SIZE,
@@ -1287,7 +1287,7 @@ void RendererAgg::_draw_path(path_t& path, bool has_clippath,
12871287
pixfmt hatch_img_pixf(hatchRenderingBuffer);
12881288
renderer_base rb(hatch_img_pixf);
12891289
renderer_aa rs(rb);
1290-
rb.clear(agg::rgba(0.0, 0.0, 0.0, 0.0));
1290+
rb.clear(_fill_color);
12911291
rs.color(gc.color);
12921292

12931293
try {
@@ -2425,7 +2425,7 @@ RendererAgg::clear(const Py::Tuple& args)
24252425
_VERBOSE("RendererAgg::clear");
24262426

24272427
args.verify_length(0);
2428-
rendererBase.clear(agg::rgba(0, 0, 0, 0));
2428+
rendererBase.clear(_fill_color);
24292429

24302430
return Py::Object();
24312431
}

src/_backend_agg.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ class RendererAgg: public Py::PythonExtension<RendererAgg>
241241

242242
const int debug;
243243

244+
agg::rgba _fill_color = agg::rgba(1, 1, 1, 0);
245+
246+
244247
protected:
245248
double points_to_pixels(const Py::Object& points);
246249
agg::rgba rgb_to_color(const Py::SeqBase<Py::Object>& rgb, double alpha);

0 commit comments

Comments
 (0)