Skip to content

Commit e84df9d

Browse files
committed
Fixed filled circle, partially addressed issue #366
1 parent 9274414 commit e84df9d

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

plotters-backend/src/rasterizer/circle.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -322,8 +322,8 @@ pub fn draw_circle<B: DrawingBackend, S: BackendStyle>(
322322

323323
if fill {
324324
check_result!(b.draw_line((left, y), (right, y), &style.color()));
325-
check_result!(b.draw_line((x, top), (x, up), &style.color()));
326-
check_result!(b.draw_line((x, down), (x, bottom), &style.color()));
325+
check_result!(b.draw_line((x, top), (x, up - 1), &style.color()));
326+
check_result!(b.draw_line((x, down + 1), (x, bottom), &style.color()));
327327
} else {
328328
check_result!(b.draw_pixel((left, y), style.color().mix(1.0 - v)));
329329
check_result!(b.draw_pixel((right, y), style.color().mix(1.0 - v)));

plotters-bitmap/src/bitmap.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ impl<'a, P: PixelFormat> DrawingBackend for BitMapBackend<'a, P> {
228228
point: BackendCoord,
229229
color: BackendColor,
230230
) -> Result<(), DrawingErrorKind<BitMapBackendError>> {
231-
if point.0 < 0 || point.1 < 0 {
231+
if point.0 < 0 || point.1 < 0 || point.0 as u32 >= self.size.0 || point.1 as u32 >= self.size.1 {
232232
return Ok(());
233233
}
234234

0 commit comments

Comments
 (0)