Skip to content

Commit a92035c

Browse files
authored
Merge branch 'sync-next-release-devel' into next-release-devel
2 parents 85f61d1 + 7f8b12d commit a92035c

File tree

14 files changed

+84
-15
lines changed

14 files changed

+84
-15
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66

77
# Editor/IDE temporary files
88
.*.sw*
9-
.vscode/*
9+
.vscode/*
10+
Cargo.lock

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,18 @@
22

33
## Plotters latest
44

5+
## Plotters 0.3.4 (?)
6+
7+
## Plotters 0.3.3 (2022-08-19)
8+
9+
### Improved
10+
11+
- The EvcxR integration now supports bitmap output. (Thanks to @lisanhu)
12+
13+
### Fixed
14+
15+
- Fix the plotters crate's edition requirement
16+
517
## Plotters 0.3.2 (2022-07-05)
618

719
- Added

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
[workspace]
22
members = ["plotters", "plotters-backend", "plotters-bitmap", "plotters-svg"]
33
default-members = ["plotters"]
4-

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ extern crate plotters;
226226
use plotters::prelude::*;
227227
228228
let figure = evcxr_figure((640, 480), |root| {
229-
root.fill(&WHITE);
229+
root.fill(&WHITE)?;
230230
let mut chart = ChartBuilder::on(&root)
231231
.caption("y=x^2", ("Arial", 50).into_font())
232232
.margin(5)

doc-template/latest_version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.3.2
1+
0.3.3

plotters-bitmap/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ gif = { version = "0.11.2", optional = true }
1818
path = "../plotters-backend"
1919

2020
[target.'cfg(not(target_arch = "wasm32"))'.dependencies.image]
21-
version = "0.24.2"
21+
version = "0.24.3"
2222
optional = true
2323
default-features = false
2424
features = ["jpeg", "png", "bmp"]

plotters-svg/Cargo.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@ readme = "README.md"
1414
[dependencies.plotters-backend]
1515
path = "../plotters-backend"
1616

17+
[dependencies.image]
18+
version = "0.24.2"
19+
optional = true
20+
default-features = false
21+
features = ["jpeg", "png", "bmp"]
22+
1723
[features]
1824
debug = []
25+
bitmap_encoder = ["image"]
1926

2027
[dev-dependencies.plotters]
2128
default_features = false

plotters-svg/src/svg.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,18 +487,19 @@ impl<'a> DrawingBackend for SVGBackend<'a> {
487487
(w, h): (u32, u32),
488488
src: &'b [u8],
489489
) -> Result<(), DrawingErrorKind<Self::ErrorType>> {
490-
use image::png::PNGEncoder;
490+
use image::codecs::png::PngEncoder;
491+
use image::ImageEncoder;
491492

492493
let mut data = vec![0; 0];
493494

494495
{
495496
let cursor = Cursor::new(&mut data);
496497

497-
let encoder = PNGEncoder::new(cursor);
498+
let encoder = PngEncoder::new(cursor);
498499

499-
let color = image::ColorType::RGB(8);
500+
let color = image::ColorType::Rgb8;
500501

501-
encoder.encode(src, w, h, color).map_err(|e| {
502+
encoder.write_image(src, w, h, color).map_err(|e| {
502503
DrawingErrorKind::DrawingError(Error::new(
503504
std::io::ErrorKind::Other,
504505
format!("Image error: {}", e),

plotters/Cargo.toml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "plotters"
33
version = "0.4.0"
44
authors = ["Hao Hou <haohou302@gmail.com>"]
5-
edition = "2021"
5+
edition = "2018"
66
license = "MIT"
77
description = "A Rust drawing library focus on data plotting for both WASM and native applications"
88
repository = "https://github.com/plotters-rs/plotters"
@@ -14,7 +14,7 @@ exclude = ["doc-template", "plotters-doc-data"]
1414

1515
[dependencies]
1616
num-traits = "0.2.14"
17-
chrono = { version = "0.4.19", optional = true }
17+
chrono = { version = "0.4.20", optional = true }
1818

1919
[dependencies.plotters-backend]
2020
path = "../plotters-backend"
@@ -36,7 +36,7 @@ pathfinder_geometry = { version = "0.5.1", optional = true }
3636
font-kit = { version = "0.11.0", optional = true }
3737

3838
[target.'cfg(not(all(target_arch = "wasm32", not(target_os = "wasi"))))'.dependencies.image]
39-
version = "0.24.2"
39+
version = "0.24.3"
4040
optional = true
4141
default-features = false
4242
features = ["jpeg", "png", "bmp"]
@@ -100,15 +100,16 @@ fontconfig-dlopen = ["font-kit/source-fontconfig-dlopen"]
100100
# Misc
101101
datetime = ["chrono"]
102102
evcxr = ["svg_backend"]
103+
evcxr_bitmap = ["evcxr", "bitmap_backend", "plotters-svg/bitmap_encoder"]
103104
deprecated_items = [] # Keep some of the deprecated items for backward compatibility
104105

105106
[dev-dependencies]
106107
itertools = "0.10.0"
107108
criterion = "0.3.6"
108109
rayon = "1.5.1"
109110
serde_json = "1.0.82"
110-
serde = "1.0.138"
111-
serde_derive = "1.0.138"
111+
serde = "1.0.139"
112+
serde_derive = "1.0.140"
112113

113114
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
114115
rand = "0.8.3"

plotters/src/drawing/backend_impl/mocked.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,13 @@ impl DrawingBackend for MockedBackend {
269269

270270
impl Drop for MockedBackend {
271271
fn drop(&mut self) {
272+
// `self.drop_check` is typically a testing function; it can panic.
273+
// The current `drop` call may be a part of stack unwinding caused
274+
// by another panic. If so, we should never call it.
275+
if std::thread::panicking() {
276+
return;
277+
}
278+
272279
let mut temp = None;
273280
std::mem::swap(&mut temp, &mut self.drop_check);
274281

0 commit comments

Comments
 (0)