Skip to content

Commit 0cabbc7

Browse files
shinmili38
authored andcommitted
Fix BitmapBackend::draw_line (adapt to new rect methods)
1 parent c88915b commit 0cabbc7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

plotters-bitmap/src/bitmap.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,12 +252,12 @@ impl<'a, P: PixelFormat> DrawingBackend for BitMapBackend<'a, P> {
252252
if (from.0 == to.0 || from.1 == to.1) && style.stroke_width() == 1 {
253253
if alpha >= 1.0 {
254254
if from.1 == to.1 {
255-
P::fill_rect_fast(self, from, to, r, g, b);
255+
P::fill_rect_fast(self, from, (to.0 + 1, to.1 + 1), r, g, b);
256256
} else {
257257
P::fill_vertical_line_fast(self, from.0, (from.1, to.1), r, g, b);
258258
}
259259
} else {
260-
P::blend_rect_fast(self, from, to, r, g, b, alpha);
260+
P::blend_rect_fast(self, from, (to.0 + 1, to.1 + 1), r, g, b, alpha);
261261
}
262262
return Ok(());
263263
}

plotters-bitmap/src/bitmap/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ fn test_draw_simple_lines() {
344344

345345
let nz_count = buffer.into_iter().filter(|x| *x != 0).count();
346346

347-
assert_eq!(nz_count, 6 * 1000 * 3);
347+
assert_eq!(nz_count, 5 * 1000 * 3);
348348
}
349349

350350
#[cfg(test)]

0 commit comments

Comments
 (0)